private List <string> addlist() { List <string> list = new List <string>(); Dictionary <string, string> dic1 = PanelDic.DicPan(panGXHT, "EQU_GXHT", new Dictionary <string, string>()); Dictionary <string, string> dic2 = PanelDic.DicPan(panSP, "EQU_GXHT", new Dictionary <string, string>()); string key = ""; string value = ""; foreach (KeyValuePair <string, string> pair in dic1) { key += pair.Key.ToString() + ","; value += "'" + pair.Value.ToString() + "',"; } foreach (KeyValuePair <string, string> pair in dic2) { key += pair.Key.ToString() + ","; value += "'" + pair.Value.ToString() + "',"; } key += "HT_SPZT";//审批总状态0-初始化,1-待审批,1y,2.1y,2.2y,2y,3y-审批中,3-已通过,4-已驳回, value += "'0'"; string sql = "insert into EQU_GXHT (" + key + ") values (" + value + ")"; list.Add(sql); for (int j = 0; j < rptSHBXX.Items.Count; j++) { if (((TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_TMoney")).Text.Trim() != "") { TextBox txt1 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Type"); TextBox txt2 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Name"); TextBox txt3 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Unit"); TextBox txt4 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Num"); TextBox txt5 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_UPrice"); TextBox txt6 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_TMoney"); TextBox txt7 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Note"); string sqlText1 = "insert into EQU_GX_Detail(EQU_FATHERID,EQU_Type,EQU_Name,EQU_Unit,EQU_Num,EQU_UPrice,EQU_TMoney,EQU_Note) values ('" + txt_HT_HTBH.Text + "','" + txt1.Text.Trim() + "' ,'" + txt2.Text.Trim() + "' ,'" + txt3.Text.Trim() + "' ,'" + txt4.Text.Trim() + "' ,'" + txt5.Text.Trim() + "' ,'" + txt6.Text.Trim() + "' ,'" + txt7.Text.Trim() + "')"; list.Add(sqlText1); } else { list = null; } } return(list); }
private List <string> alterlist() { List <string> list = new List <string>(); Dictionary <string, string> dic1 = PanelDic.DicPan(panGXHT, "EQU_GXHT", new Dictionary <string, string>()); Dictionary <string, string> dic2 = PanelDic.DicPan(panSP, "EQU_GXHT", new Dictionary <string, string>()); string sql = "update EQU_GXHT set "; foreach (KeyValuePair <string, string> pair in dic1) { sql += pair.Key + "='" + pair.Value + "',"; } foreach (KeyValuePair <string, string> pair in dic2) { sql += pair.Key + "='" + pair.Value + "',"; } sql = sql.Trim(',') + " where HT_HTBH='" + asd.id + "'"; list.Add(sql); string sqlText = "delete from EQU_GX_Detail where EQU_FATHERID='" + txt_HT_HTBH.Text.Trim() + "' "; list.Add(sqlText); for (int j = 0; j < rptSHBXX.Items.Count; j++) { if (((TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_TMoney")).Text.Trim() != "") { TextBox txt1 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Type"); TextBox txt2 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Name"); TextBox txt3 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Unit"); TextBox txt4 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Num"); TextBox txt5 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_UPrice"); TextBox txt6 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_TMoney"); TextBox txt7 = (TextBox)rptSHBXX.Items[j].FindControl("txt_EQU_Note"); string sqlText1 = "insert into EQU_GX_Detail(EQU_FATHERID,EQU_Type,EQU_Name,EQU_Unit,EQU_Num,EQU_UPrice,EQU_TMoney,EQU_Note) values ('" + txt_HT_HTBH.Text + "','" + txt1.Text.Trim() + "' ,'" + txt2.Text.Trim() + "' ,'" + txt3.Text.Trim() + "' ,'" + txt4.Text.Trim() + "' ,'" + txt5.Text.Trim() + "' ,'" + txt6.Text.Trim() + "' ,'" + txt7.Text.Trim() + "')"; list.Add(sqlText1); } else { list = null; } } return(list); }
private List <string> checklist() { Dictionary <string, string> dic = PanelDic.DicPan(panSP, "EQU_GXHT", new Dictionary <string, string>()); List <string> list = new List <string>(); string sql = ""; sql = "update EQU_GXHT set "; foreach (KeyValuePair <string, string> pair in dic) { sql += pair.Key + "='" + pair.Value + "',"; } sql = sql.Trim(','); sql += " where HT_HTBH='" + asd.id + "'"; list.Add(sql); if (rbl_HT_SPLX.SelectedValue == "1") { if (rbl_HT_SHR1_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='3' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } } if (rbl_HT_SPLX.SelectedValue == "2") { if (rbl_HT_SHR1_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='1y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } if (rbl_HT_SHR2_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='3' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } } if (rbl_HT_SPLX.SelectedValue == "3") { if (rbl_HT_SHR1_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='1y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } if (rbl_HT_SHR2_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='2y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } if (rbl_HT_SHR3_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='3' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } } //else if (rbl_HT_SPLX.SelectedValue == "4") //{ if (rbl_HT_SHR1_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='1y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); if (asd.userid == hid_HT_SHR1ID.Value) { string _emailto = DBCallCommon.GetEmailAddressByUserID(hid_HT_SHR2ID.Value); string _body = "设备购销合同审批任务:" + "\r\n合同编号:" + txt_HT_HTBH.Text.Trim() + "\r\n制单人:" + lb_HT_ZDR.Text.Trim() + "\r\n制单日期:" + lb_HT_ZDSJ.Text.Trim(); string _subject = "您有新的【设备购销合同】需要审批,请及时处理:" + txt_HT_HTBH.Text.Trim(); DBCallCommon.SendEmail(_emailto, null, null, _subject, _body); _emailto = DBCallCommon.GetEmailAddressByUserID(hid_HT_SHR3ID.Value); DBCallCommon.SendEmail(_emailto, null, null, _subject, _body); } } if (rbl_HT_SHR2_JL.SelectedValue == "y" && rbl_HT_SHR3_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='2y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); if (asd.userid == hid_HT_SHR2ID.Value || asd.userid == hid_HT_SHR3ID.Value) { string _emailto = DBCallCommon.GetEmailAddressByUserID(hid_HT_SHR4ID.Value); string _body = "设备购销合同审批任务:" + "\r\n合同编号:" + txt_HT_HTBH.Text.Trim() + "\r\n制单人:" + lb_HT_ZDR.Text.Trim() + "\r\n制单日期:" + lb_HT_ZDSJ.Text.Trim(); string _subject = "您有新的【设备购销合同】需要审批,请及时处理:" + txt_HT_HTBH.Text.Trim(); DBCallCommon.SendEmail(_emailto, null, null, _subject, _body); } } if (rbl_HT_SHR2_JL.SelectedValue == "y" && rbl_HT_SHR3_JL.SelectedValue == "") { sql = "update EQU_GXHT set HT_SPZT='2.1y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } if (rbl_HT_SHR2_JL.SelectedValue == "" && rbl_HT_SHR3_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='2.2y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } if (rbl_HT_SHR4_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='3y' where HT_HTBH='" + asd.id + "'"; list.Add(sql); if (asd.userid == hid_HT_SHR4ID.Value) { string _emailto = DBCallCommon.GetEmailAddressByUserID(hid_HT_SHR5ID.Value); string _body = "设备购销合同审批任务:" + "\r\n合同编号:" + txt_HT_HTBH.Text.Trim() + "\r\n制单人:" + lb_HT_ZDR.Text.Trim() + "\r\n制单日期:" + lb_HT_ZDSJ.Text.Trim(); string _subject = "您有新的【设备购销合同】需要审批,请及时处理:" + txt_HT_HTBH.Text.Trim(); DBCallCommon.SendEmail(_emailto, null, null, _subject, _body); } } if (rbl_HT_SHR5_JL.SelectedValue == "y") { sql = "update EQU_GXHT set HT_SPZT='3' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } //} if (rbl_HT_SHR1_JL.SelectedValue == "n" || rbl_HT_SHR2_JL.SelectedValue == "n" || rbl_HT_SHR3_JL.SelectedValue == "n" || rbl_HT_SHR4_JL.SelectedValue == "n" || rbl_HT_SHR5_JL.SelectedValue == "n") { sql = "update EQU_GXHT set HT_SPZT='4' where HT_HTBH='" + asd.id + "'"; list.Add(sql); } return(list); }
//保存申请单数据 protected void btnSave_OnClick(object sender, EventArgs e) { if (unitparam.action == "add") { Dictionary <string, string> dic1 = PanelDic.DicPan(PanelDetail, "OM_Express", new Dictionary <string, string>()); Dictionary <string, string> dic2 = PanelDic.DicPan(PanelShenhe, "OM_Express", new Dictionary <string, string>()); string key = ""; string value = ""; foreach (KeyValuePair <string, string> pair in dic1) { key += pair.Key.ToString() + ","; value += "'" + pair.Value.ToString() + "',"; } foreach (KeyValuePair <string, string> pair in dic2) { key += pair.Key.ToString() + ","; value += "'" + pair.Value.ToString() + "',"; } key += "E_State";//申请单状态0-初始化,1-待审批,2-已通过,3-已驳回,4-已反馈,5-反馈驳回 value += "'0'"; if (ddl_E_Type.SelectedValue != "0") { key += ",E_ItemName,E_ItemWeight"; value += ",'" + txt_E_ItemName.Text.Trim() + "','" + txt_E_ItemWeight.Text.Trim() + "'"; } else { key += ",E_FileName"; value += ",'" + txt_E_FileName.Text.Trim() + "'"; } string sql = "insert into OM_Express (" + key + ") values (" + value + ")"; try { DBCallCommon.ExeSqlText(sql); btnSave.Visible = false; btnSubmit.Visible = true; PanelDetail.Enabled = false; PanelShenhe.Enabled = false; } catch { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据保存失败!');", true); } } else { string sqltext = "delete from OM_Express where E_Code='" + unitparam.key + "'"; DBCallCommon.ExeSqlText(sqltext); Dictionary <string, string> dic1 = PanelDic.DicPan(PanelDetail, "OM_Express", new Dictionary <string, string>()); Dictionary <string, string> dic2 = PanelDic.DicPan(PanelShenhe, "OM_Express", new Dictionary <string, string>()); string key = ""; string value = ""; foreach (KeyValuePair <string, string> pair in dic1) { key += pair.Key.ToString() + ","; value += "'" + pair.Value.ToString() + "',"; } foreach (KeyValuePair <string, string> pair in dic2) { key += pair.Key.ToString() + ","; value += "'" + pair.Value.ToString() + "',"; } key += "E_State";//申请单状态0-初始化,1-待审批,2-已通过,3-已驳回,4-已反馈,5-反馈驳回 value += "'0'"; if (ddl_E_Type.SelectedValue != "0") { key += ",E_ItemName,E_ItemWeight"; value += ",'" + txt_E_ItemName.Text.Trim() + "','" + txt_E_ItemWeight.Text.Trim() + "'"; } else { key += ",E_FileName"; value += ",'" + txt_E_FileName.Text.Trim() + "'"; } string sql = "insert into OM_Express (" + key + ") values (" + value + ")"; try { DBCallCommon.ExeSqlText(sql); btnSave.Visible = false; btnSubmit.Visible = true; PanelDetail.Enabled = false; PanelShenhe.Enabled = false; } catch { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据保存失败!');", true); } } }