private void BindData() { if (asd.Action == "edit") { string sql = string.Format("select * from OM_PXJH_SQ where PX_BH='{0}'", asd.Pxbh); DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); PanelDic.BindPanel(panJBXX, dt); sql = string.Format("select a.*,b.ST_SEQUEN from OM_PXDA as a left join TBDS_STAFFINFO as b on a.DA_CXRID=b.ST_ID where DA_XMBH='{0}'", asd.Pxbh); DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql); rptNR.DataSource = dt1; rptNR.DataBind(); NoData(); lb_PX_PJR.Text = asd.Username; lb_PX_PJSJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } else if (asd.Action == "read") { string sql = string.Format("select * from OM_PXJH_SQ where PX_BH='{0}'", asd.Pxbh); DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); PanelDic.BindPanel(panJBXX, dt); sql = string.Format("select a.*,b.ST_SEQUEN from OM_PXDA as a left join TBDS_STAFFINFO as b on a.DA_CXRID=b.ST_ID where DA_XMBH='{0}'", asd.Pxbh); DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql); rptNR.DataSource = dt1; rptNR.DataBind(); NoData(); lb_PX_PJR.Text = asd.Username; lb_PX_PJSJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } PowerControl(); }
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); }
private void BindData() { if (asd.action == "add") { lb_HT_ZDR.Text = asd.username; lb_HT_ZDSJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); string sql = "select ST_NAME,ST_ID,ST_POSITION from TBDS_STAFFINFO where ST_POSITION='1001'or ST_POSITION= '0401'or ST_POSITION= '0301'or ST_POSITION= '0102'or ST_POSITION= '0101' and ST_PD='0' order by ST_POSITION desc,ST_ID desc"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); txt_HT_SHR1.Text = dt.Rows[0][0].ToString(); txt_HT_SHR2.Text = dt.Rows[1][0].ToString(); txt_HT_SHR3.Text = dt.Rows[2][0].ToString(); txt_HT_SHR4.Text = dt.Rows[3][0].ToString(); hid_HT_SHR1ID.Value = dt.Rows[0][1].ToString(); hid_HT_SHR2ID.Value = dt.Rows[1][1].ToString(); hid_HT_SHR3ID.Value = dt.Rows[2][1].ToString(); hid_HT_SHR4ID.Value = dt.Rows[3][1].ToString(); hid_HT_ZDRID.Value = asd.userid.ToString(); txt_HT_SHR5.Text = dt.Rows[dt.Rows.Count - 1][0].ToString(); hid_HT_SHR5ID.Value = dt.Rows[dt.Rows.Count - 1][1].ToString(); txt_HT_HTBH.Text = GetHTBH(); DataTable dt1 = new DataTable(); rptSHBXX.DataSource = dt1; rptSHBXX.DataBind(); } if (asd.action == "alter") { string sql = "select * from EQU_GXHT where HT_HTBH='" + asd.id + "'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); PanelDic.BindPanel(panGXHT, dt); PanelDic.BindPanel(panSP, dt); string sql1 = "select EQU_ID,EQU_Type,EQU_Name,EQU_Unit,EQU_UPrice,EQU_Num,EQU_TMoney,EQU_Note from EQU_GX_Detail where EQU_FATHERID='" + asd.id + "' order by EQU_ID"; DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql1); rptSHBXX.DataSource = dt1; rptSHBXX.DataBind(); } if (asd.action == "read") { string sql = "select * from EQU_GXHT where HT_HTBH='" + asd.id + "'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); PanelDic.BindPanel(panGXHT, dt); PanelDic.BindPanel(panSP, dt); string sql1 = "select EQU_ID,EQU_Type,EQU_Name,EQU_Unit,EQU_UPrice,EQU_Num,EQU_TMoney,EQU_Note from EQU_GX_Detail where EQU_FATHERID='" + asd.id + "' order by EQU_ID"; DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql1); rptSHBXX.DataSource = dt1; rptSHBXX.DataBind(); } if (asd.action == "check") { string sql = "select * from EQU_GXHT where HT_HTBH='" + asd.id + "'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); PanelDic.BindPanel(panGXHT, dt); PanelDic.BindPanel(panSP, dt); if (asd.userid == dt.Rows[0]["HT_SHR1ID"].ToString()) { lb_HT_SHR1_SJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } if (asd.userid == dt.Rows[0]["HT_SHR2ID"].ToString()) { lb_HT_SHR2_SJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } if (asd.userid == dt.Rows[0]["HT_SHR3ID"].ToString()) { lb_HT_SHR3_SJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } if (asd.userid == dt.Rows[0]["HT_SHR4ID"].ToString()) { lb_HT_SHR4_SJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } if (asd.userid == dt.Rows[0]["HT_SHR5ID"].ToString()) { lb_HT_SHR5_SJ.Text = DateTime.Now.ToString("yyyy-MM-dd"); } string sql1 = "select EQU_ID,EQU_Type,EQU_Name,EQU_Unit,EQU_UPrice,EQU_Num,EQU_TMoney,EQU_Note from EQU_GX_Detail where EQU_FATHERID='" + asd.id + "' order by EQU_ID"; DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql1); rptSHBXX.DataSource = dt1; rptSHBXX.DataBind(); } }
//申请单数据绑定 private void binddetail() { string sql = ""; DataTable dt; if (unitparam.action == "add") { lb_E_Code.Text = GetCode(); lb_E_ZDR.Text = unitparam.username; lb_E_ZDRID.Text = unitparam.userid; lb_E_SQRDep.Text = unitparam.depname; lb_E_ZDTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string position = unitparam.depid + "01"; if (unitparam.depid == "15") { //对焊事业部于来义 position = "0301"; } if (unitparam.depid == "08" || unitparam.depid == "09") { position = "0401"; } else if (unitparam.depid == "13") { position = "1001"; } else if (unitparam.depid == "14" || unitparam.depid == "02") { //办公室刘晓静 position = "0210"; } else if (unitparam.depid == "12") { position = "1207"; } else if (unitparam.depid == "03") { position = "0302"; } sql = "select ST_NAME,ST_ID,ST_POSITION from TBDS_STAFFINFO where ST_POSITION='0207'or (ST_POSITION = '" + position + "'and ST_PD='0')"; dt = DBCallCommon.GetDTUsingSqlText(sql); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][2].ToString() != "0207") { txt_E_SHR.Text = dt.Rows[i][0].ToString(); txt_E_SHRID.Text = dt.Rows[i][1].ToString(); } else { lb_E_Surer.Text = dt.Rows[i][0].ToString(); hid_E_SurerID.Value = dt.Rows[i][1].ToString(); } } } else { sql = "select * from OM_Express where E_Code ='" + unitparam.key + "'"; dt = DBCallCommon.GetDTUsingSqlText(sql); PanelDic.BindPanel(PanelDetail, dt); PanelDic.BindPanel(PanelShenhe, dt); if (dt.Rows[0]["E_Type"].ToString() == "1") { td_wenjian0.Visible = false; td_wenjian1.Visible = false; td_wuping0.Visible = true; td_wuping1.Visible = true; td_wuping2.Visible = true; td_wuping3.Visible = true; txt_E_ItemName.Text = dt.Rows[0]["E_ItemName"].ToString(); txt_E_ItemWeight.Text = dt.Rows[0]["E_ItemWeight"].ToString(); } else { txt_E_FileName.Text = dt.Rows[0]["E_FileName"].ToString(); } if (unitparam.action == "sure") { txt_E_ExpressTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); txt_E_ExpressMoney.Text = ""; } } }
//保存申请单数据 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); } } }