日期:2014-05-17 浏览次数:20479 次
private void AddUserWork(int id) { if (string.IsNullOrEmpty(txtcompany1.Text)) { action = 1; } try { for (int i = 1; i < 11; i++) { string companyid = "txtcompany" + i.ToString(); string caddressid = "txtcaddress" + i.ToString(); string positionid = "txtposition" + i.ToString(); string salarid = "txtsalar" + i.ToString(); string prizeid = "txtprize" + i.ToString(); string contactid = "txtcontact" + i.ToString(); string ctelid = "txtctel" + i.ToString(); string causeid = "txtcause" + i.ToString(); string enteryearid = "ddlenteryear" + i.ToString(); string entermonthid = "ddlentermonth" + i.ToString(); string leaveyearid = "ddlleaveyear" + i.ToString(); string leavemonthid = "dllleavemonth" + i.ToString(); TextBox txtcompany = (TextBox)Panel3.FindControl(companyid); TextBox txtcaddress = (TextBox)Panel3.FindControl(caddressid); TextBox txtposition = (TextBox)Panel3.FindControl(positionid); TextBox txtsalar = (TextBox)Panel3.FindControl(salarid); TextBox txtprize = (TextBox)Panel3.FindControl(prizeid); TextBox txtcontact = (TextBox)Panel3.FindControl(contactid); TextBox txtctel = (TextBox)Panel3.FindControl(ctelid); TextBox txtcause = (TextBox)Panel3.FindControl(causeid); DropDownList ddlenteryear = (DropDownList)Panel3.FindControl(enteryearid); DropDownList ddlentermonth = (DropDownList)Panel3.FindControl(entermonthid); DropDownList ddlleaveyear = (DropDownList)Panel3.FindControl(leaveyearid); DropDownList dllleavemonth = (DropDownList)Panel3.FindControl(leavemonthid); if (!string.IsNullOrEmpty(txtcompany.Text)) { string edudate = ""; string graduate = ""; edudate = ddlenteryear.SelectedValue + "-" + ddlentermonth.SelectedValue + "-01"; graduate = ddlleaveyear.SelectedValue + "-" + dllleavemonth.SelectedValue + "-01"; if (!UserInfoDB.AddUserWork(id, txtcompany.Text, txtcaddress.Text, txtposition.Text, Convert.ToDateTime(edudate), Convert.ToDateTime(graduate), txtsalar.Text, txtcause.Text, txtcontact.Text, txtctel.Text, txtprize.Text)) { action = 1; } } } } catch (Exception ex) { string error = ex.Message; } }