protected void btn_antihs_Click(object sender, EventArgs e) { SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); DBCallCommon.openConn(sqlConn); SqlCommand sqlCmd = new SqlCommand("GouJiRuKuHeSuanAnti", sqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = 0; sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2); sqlCmd.Parameters["@gmonth"].Value = getMonth(); sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4); sqlCmd.Parameters["@gyear"].Value = getYear(); sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue; //增加返回值参数@retVal sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0) { string script = @"alert('反入库核算成功!');location.href ='FM_RuKu_Adjust_Accounts.aspx'"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1) { string script = @"alert('反入库核算失败!');'"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } }
protected void deletebt_Click(object sender, EventArgs e) { string sqltext; sqltext = "select * from EQU_tzsb order by Id"; setpagerparm("EQU_tzsb", "Id", "Id*1 as Id,Code,Name,Type,Specification,Ocode,Rcode,Ucode,Manufa,Position,Ustate,Redate,Remark", "", "Name LIKE'%" + name.Text.ToString().Trim() + "%'", 0, 10); DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext); string strId = ""; foreach (RepeaterItem e_id in tzsbRepeater.Items) { CheckBox chk = (CheckBox)e_id.FindControl("checkboxstaff"); if (chk.Checked) { strId += "'" + ((Label)e_id.FindControl("Id")).Text + "'" + ","; } } if (strId.Length > 1) { strId = strId.Substring(0, strId.Length - 1); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("delete from EQU_tzsb where Id in (" + strId + ")", sqlConn); DBCallCommon.openConn(sqlConn); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); dr.Close(); } DBCallCommon.closeConn(sqlConn); databind(); }
protected void deletebt_Click(object sender, EventArgs e) { string strId = ""; DDlpartment.SelectedValue = "00"; DDlgroup.SelectedValue = "00"; foreach (RepeaterItem e_id in tbds_staffinfoRepeater.Items) { CheckBox chk = (CheckBox)e_id.FindControl("checkboxstaff"); if (chk.Checked) { strId += "'" + ((Label)e_id.FindControl("ST_CODE")).Text + "'" + ","; } } if (strId.Length > 1) { strId = strId.Substring(0, strId.Length - 1); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("update TBDS_STAFFINFO set ST_PD=1 where ST_ID in (" + strId + ")", sqlConn); DBCallCommon.openConn(sqlConn); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); dr.Close(); } DBCallCommon.closeConn(sqlConn); databind(); }
protected void deletebt_Click(object sender, EventArgs e) { string strId = ""; foreach (RepeaterItem e_id in equipmentRepeater.Items) { CheckBox chk = (CheckBox)e_id.FindControl("checkboxstaff"); if (chk.Checked) { strId += "'" + ((Label)e_id.FindControl("Id")).Text + "'" + ","; } } if (strId.Length > 1) { strId = strId.Substring(0, strId.Length - 1); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand("delete from ESM_EQU where Id in (" + strId + ")", sqlConn); DBCallCommon.openConn(sqlConn); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); dr.Close(); } DBCallCommon.closeConn(sqlConn); UCPaging1.CurrentPage = 1; ReGetBoundData(); }
protected void Button_save_Click(object sender, EventArgs e) { string sqltext = ""; string state = ""; SqlCommand sqlCmd = new SqlCommand(); SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlConn.Open(); sqlCmd.Connection = sqlConn; foreach (RepeaterItem Reitem in tbpc_purshaseplanrealityRepeater.Items) { state = ((Label)Reitem.FindControl("PUR_STATE")).Text; if (state == "3") { sqltext = "update TBPC_PURCHASEPLAN set PUR_CGMAN=@PUR_CGMANCODE " + "where PUR_PTCODE=@PUR_PTCODE and PUR_CSTATE='0'"; sqlCmd.CommandText = sqltext; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", ((TextBox)Reitem.FindControl("PUR_PTCODE")).Text); sqlCmd.Parameters.AddWithValue("@PUR_CGMANCODE", ((Label)Reitem.FindControl("PUR_CGMANCODE")).Text); int rowsnum = sqlCmd.ExecuteNonQuery(); } } DBCallCommon.closeConn(sqlConn); repeaterdatabind(); ddl_caigouyuan.SelectedIndex = 0; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('保存成功!');", true); }
private void insertinitialdata() { string sqltext = ""; string submpid = Tb_mpid.Text.Substring(Tb_mpid.Text.IndexOf(".") + 1, 6); SqlConnection sqlConn = new SqlConnection(); SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlConn.Open(); sqlCmd.Connection = sqlConn; foreach (RepeaterItem Reitem in Purchaseplan_startcontentRepeater.Items) { sqltext = "INSERT INTO TBPC_PURCHASEPLAN(PUR_PCODE,PUR_PJID,PUR_PJNAME,PUR_ENGID,PUR_ENGNAME,PUR_PTCODE,PUR_MARID,PUR_MARNAME,PUR_MARNORM,PUR_MARTERIAL,PUR_GUOBIAO,PUR_FIXEDSIZE,PUR_NUM,PUR_NUNIT,PUR_USTNUM,PUR_RPNUM,PUR_PUNIT,PUR_STDATE,PUR_PRONODE,PUR_STATE) " + "VALUES(@PUR_PCODE,@PUR_PJID,@PUR_PJNAME,@PUR_ENGID,@PUR_ENGNAME,@PUR_PTCODE,@PUR_MARID,@PUR_MARNAME,@PUR_MARNORM,@PUR_MARTERIAL,@PUR_GUOBIAO,@PUR_FIXEDSIZE,@PUR_NUM,@PUR_NUNIT,@PUR_USTNUM,@PUR_RPNUM,@PUR_PUNIT,@PUR_STDATE,@PUR_PRONODE,@PUR_STATE)"; sqlCmd.CommandText = sqltext; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@PUR_PCODE", Tb_mpid.Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PJID", tb_pjid.Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PJNAME", tb_pj.Text); sqlCmd.Parameters.AddWithValue("@PUR_ENGID", tb_engid.Text); sqlCmd.Parameters.AddWithValue("@PUR_ENGNAME", tb_engid.Text); sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", ((Label)Reitem.FindControl("PUR_PTCODE")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARID", ((Label)Reitem.FindControl("PUR_MARID")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARNAME", ((Label)Reitem.FindControl("PUR_MARNAME")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARNORM", ((Label)Reitem.FindControl("PUR_MARNORM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARTERIAL", ((Label)Reitem.FindControl("PUR_MARTERIAL")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_GUOBIAO", ((Label)Reitem.FindControl("PUR_GUOBIAO")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_FIXEDSIZE", ((Label)Reitem.FindControl("PUR_FIXEDSIZE")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_NUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_NUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", '0'); sqlCmd.Parameters.AddWithValue("@PUR_RPNUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_PUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_STDATE", Tb_shijian.Text); sqlCmd.Parameters.AddWithValue("@PUR_PRONODE", '0'); sqlCmd.Parameters.AddWithValue("@PUR_STATE", '0'); int rowsnum = sqlCmd.ExecuteNonQuery(); } sqltext = "INSERT INTO TBPC_PCHSPLANRVW(PR_SHEETNO,PR_DEPID,PR_DEPNAME,PR_SQREID,PR_SQRENAME,PR_FZREID,PR_FZRENAME,PR_REVIEWA,PR_REVIEWANM,PR_REVIEWATIME,PR_STATE,PR_PRONODE) " + "VALUES('" + Tb_mpid.Text.ToString() + "' ,'" + tb_depid.Text + "','" + tb_dep.Text + "','" + Tb_shenqingrenid.Text + "','" + Tb_shenqingren.Text + "','" + Tb_fuzirenid.Text + "','" + Tb_fuziren.Text + "','" + TextBoxexecutorid.Text.ToString() + "','" + TextBoxexecutor.Text.ToString() + "','" + Tb_shijian.Text + "','000','0')"; DBCallCommon.ExeSqlText(sqltext); if (submpid == "JSB MS") { sqltext = "UPDATE TBPM_OUTSOURCETOTAL SET OST_STATE='9' WHERE OST_STATE='8' AND OST_OUTSOURCENO='" + Tb_mpid.Text.ToString() + "'"; } else { sqltext = "UPDATE TBPM_MPFORALLRVW SET MP_STATE='9' WHERE MP_STATE='8' AND MP_ID='" + Tb_mpid.Text.ToString() + "'"; } DBCallCommon.ExeSqlText(sqltext); DBCallCommon.closeConn(sqlConn); Response.Redirect("~/PC_Data/PC_TBPC_Purchaseplan_check_list.aspx"); }
protected void deletebt_Click(object sender, EventArgs e) { Dfinddept1.SelectedValue = "00"; Dfinddept2.SelectedValue = "00"; Radiogrouportw.Visible = false; //隐藏 Radiogrouportw.SelectedValue = "1"; //默认为岗位/班组 DataTable dt = null; SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); DBCallCommon.openConn(sqlConn); SqlCommand sqlCmd = new SqlCommand();//选择用 sqlCmd.Connection = sqlConn; SqlCommand sqlCmd1 = new SqlCommand();//删除用 sqlCmd1.Connection = sqlConn; string cannotstr; foreach (RepeaterItem e_id in tbds_depinfoRepeater.Items) { CheckBox chk = (CheckBox)e_id.FindControl("checkboxdep"); if (chk.Checked) { cannotstr = ((Label)e_id.FindControl("DEP_CODE")).Text; #region //查找对象 if (Radiogrouportw.SelectedValue == "0") { sqlCmd.CommandText = "select * from TBDS_STAFFINFO where ST_JOBCAT LIKE '" + cannotstr + "%'"; sqlCmd1.CommandText = "delete from TBDS_JOBCATINFO where JC_ID LIKE '" + cannotstr + "%'"; } else { sqlCmd.CommandText = "select * from TBDS_STAFFINFO where ST_DEPID LIKE '" + cannotstr + "%'"; sqlCmd1.CommandText = "delete from TBDS_DEPINFO where DEP_CODE LIKE '" + cannotstr + "%'"; } #endregion dt = DBCallCommon.GetDataTableUsingCmd(sqlCmd); if (dt.Rows.Count > 0) { Lnumber.Text = Convert.ToString(dt.Rows.Count); Response.Write("<script>alert('编码为" + cannotstr + "下有人员,不能删除,若想删除,请删除该编码下的所有人员!');</script>"); } else { sqlCmd1.ExecuteNonQuery();//执行删除操作 } } } UCPaging1.CurrentPage = 1; databind(); DBCallCommon.closeConn(sqlConn); }
/*****************************反核算***************************/ protected void btn_Antihs_Click(object sender, EventArgs e) { SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); DBCallCommon.openConn(sqlConn); SqlCommand sqlCmd = new SqlCommand("AntiAccounting", sqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2); sqlCmd.Parameters["@gmonth"].Value = getMonth(); sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4); sqlCmd.Parameters["@gyear"].Value = getYear(); sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue; //增加返回值参数@retVal sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0) { //反核算成功 string script = @"alert('反核算成功!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); btn_hs.Enabled = true; btn_antihs.Enabled = false; bindGrid(); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1) { //关账失败! string script = @"alert('系统未核算,不能反核算!');"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "error", script, true); ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 2) { //关账失败! string script = @"alert('系统反核算失败!');"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "error", script, true); ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } }
private void insertinitialdata() { string sqltext = ""; SqlConnection sqlConn = new SqlConnection(); SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlConn.Open(); sqlCmd.Connection = sqlConn; generate_caigoudan(DropDownList_PJ.SelectedValue.ToString(), downlist_eng.SelectedValue.ToString()); int i = 0; foreach (RepeaterItem Reitem in billsummarizingRepeater.Items) { i++; sqltext = "INSERT INTO TBPC_PURCHASEPLAN(PUR_PCODE,PUR_PJID,PUR_PJNAME,PUR_ENGID,PUR_ENGNAME,PUR_PTCODE,PUR_MARID,PUR_MARNAME,PUR_MARNORM,PUR_MARTERIAL,PUR_FIXEDSIZE,PUR_NUM,PUR_NUNIT,PUR_USTNUM,PUR_RPNUM,PUR_PUNIT,PUR_STDATE,PUR_PRONODE,PUR_STATE) " + "VALUES(@PUR_PCODE,@PUR_PJID,@PUR_PJNAME,@PUR_ENGID,@PUR_ENGNAME,@PUR_PTCODE,@PUR_MARID,@PUR_MARNAME,@PUR_MARNORM,@PUR_MARTERIAL,@PUR_FIXEDSIZE,@PUR_NUM,@PUR_NUNIT,@PUR_USTNUM,@PUR_RPNUM,@PUR_PUNIT,@PUR_STDATE,@PUR_PRONODE,@PUR_STATE)"; sqlCmd.CommandText = sqltext; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@PUR_PCODE", TextBox_pid.Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PJID", DropDownList_PJ.SelectedValue.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PJNAME", DropDownList_PJ.SelectedItem.Text); sqlCmd.Parameters.AddWithValue("@PUR_ENGID", downlist_eng.SelectedValue.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_ENGNAME", downlist_eng.SelectedItem.Text); sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", TextBox_pid.Text.ToString() + "_" + i.ToString().PadLeft(4, '0')); sqlCmd.Parameters.AddWithValue("@PUR_MARID", ((Label)Reitem.FindControl("PUR_MARID")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARNAME", ((Label)Reitem.FindControl("PUR_MARNAME")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARNORM", ((Label)Reitem.FindControl("PUR_MARNORM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_MARTERIAL", ((Label)Reitem.FindControl("PUR_MARTERIAL")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_FIXEDSIZE", ((Label)Reitem.FindControl("PUR_FIXEDSIZE")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_NUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_NUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", '0'); sqlCmd.Parameters.AddWithValue("@PUR_RPNUM", ((Label)Reitem.FindControl("PUR_NEDDNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_PUNIT", ((Label)Reitem.FindControl("PUR_NUNIT")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_STDATE", DateTime.Now.ToString("yyyy-MM-dd")); sqlCmd.Parameters.AddWithValue("@PUR_PRONODE", '0'); sqlCmd.Parameters.AddWithValue("@PUR_STATE", '0'); int rowsnum = sqlCmd.ExecuteNonQuery(); } string sqltext1 = "INSERT INTO TBPC_PCHSPLANRVW(PR_SHEETNO,PR_REVIEWA,PR_REVIEWANM,PR_REVIEWATIME,PR_STATE,PR_PRONODE) " + "VALUES('" + TextBox_pid.Text.ToString() + "' ,'" + TextBoxexecutorid.Text.ToString() + "','" + TextBoxexecutor.Text.ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','000','0')"; DBCallCommon.ExeSqlText(sqltext1); string sqltext2 = "UPDATE TBPM_MPFORALLRVW SET MP_STATE='9',MP_PRSHEETNO='" + TextBox_pid.Text.ToString() + "' WHERE MP_STATE='8' AND MP_PJID='" + DropDownList_PJ.SelectedValue.ToString() + "' AND MP_ENGID='" + downlist_eng.SelectedValue.ToString() + "'"; DBCallCommon.ExeSqlText(sqltext2); DBCallCommon.closeConn(sqlConn); Response.Redirect("~/PC_Data/PC_TBPC_Purchaseplan_check_list.aspx"); }
//private void getZanGuBuCha() //获取暂估差金额,,入库单金额=发票金额-暂估差 //{ // //核算后获取发票金额 // //暂估差额 // string strperiod = ddl_year.SelectedValue + "-" + ddl_month.SelectedValue; // string condition = "CONVERT(varchar(100),(DIFYEAR+'-'+DIFMONTH), 23) between '" + strperiod + "' and '" + strperiod + "'AND round(DIFAMTMNY,2)!=0"; // string sql = "select CAST(round(isnull(sum(DIFAMTMNY),0),2) AS FLOAT) as TotalAmount from View_FM_INHSDETAILDIFMAR where " + condition; // SqlDataReader sdr = DBCallCommon.GetDRUsingSqlText(sql); // if (sdr.Read()) // { // hfdZanGuChaAmount.Value = sdr["TotalAmount"].ToString(); // } // sdr.Close(); //} /*****************************入库核算***************************/ protected void btn_hs_Click(object sender, EventArgs e) { string sqlifrksh = "select * from View_SM_IN where WG_STATE<>'2'"; DataTable dtifrksh = DBCallCommon.GetDTUsingSqlText(sqlifrksh); if (dtifrksh.Rows.Count > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('存在未审核的入库单!')", true); return; } SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); DBCallCommon.openConn(sqlConn); SqlCommand sqlCmd = new SqlCommand("GouJiRuKuHeSuan", sqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = 0; sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2); sqlCmd.Parameters["@gmonth"].Value = getMonth(); sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4); sqlCmd.Parameters["@gyear"].Value = getYear(); sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue; //增加返回值参数@retVal sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0) { string script = @"alert('入库核算成功!');location.href ='FM_RuKu_Adjust_Accounts.aspx'"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1) { string script = @"alert('入库核算失败!');'"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } }
protected int tbds_tyofwinf_update(string JC_ID, string JC_NAME, string JC_DEPID, string JC_MANCLERK, string JC_FILLDATE, string JC_NOTE, string cmdstring) //修改数据库数据 { SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlCmd.CommandText = cmdstring; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@JC_ID", JC_ID); sqlCmd.Parameters.AddWithValue("@JC_NAME", ignoreSpaces(JC_NAME)); sqlCmd.Parameters.AddWithValue("@JC_DEPID", JC_DEPID); sqlCmd.Parameters.AddWithValue("@JC_MANCLERK", JC_MANCLERK); sqlCmd.Parameters.AddWithValue("@JC_FILLDATE", Convert.ToDateTime(JC_FILLDATE)); sqlCmd.Parameters.AddWithValue("@JC_NOTE", JC_NOTE); sqlConn.Open(); sqlCmd.Connection = sqlConn; int rowsnum = sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); return(rowsnum); }
private void Updatetbpc_purchaseplan() { string sqltext; SqlCommand sqlCmd = new SqlCommand(); SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlConn.Open(); sqlCmd.Connection = sqlConn; if (Label_view.Text == "000") { foreach (RepeaterItem Reitem in tbpc_purshaseplanbillRepeater.Items) { sqltext = "UPDATE TBPC_PURCHASEPLAN SET PUR_USTNUM=@PUR_USTNUM,PUR_RPNUM=@PUR_PLANNUM ,PUR_VICLERK=@PUR_VICLERK,PUR_STATE=@PUR_STATE WHERE PUR_PTCODE=@PUR_PTCODE AND PUR_PRONODE='0' AND PUR_PCODE=@PUR_PCODE"; sqlCmd.CommandText = sqltext; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", ((Label)Reitem.FindControl("PUR_PTCODE")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", ((TextBox)Reitem.FindControl("PUR_USEKCNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_VICLERK", TextBoxexecutor.Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PLANNUM", ((TextBox)Reitem.FindControl("PUR_PLANNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_PCODE", TextBox_pid.Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_STATE", '1'); int rowsnum = sqlCmd.ExecuteNonQuery(); } } else//100 { foreach (RepeaterItem Reitem in tbpc_purshaseplanbillRepeater.Items) { sqltext = "UPDATE TBPC_PURCHASEPLAN SET PUR_USTNUM=@PUR_USTNUM,PUR_RPNUM=@PUR_PLANNUM WHERE PUR_PTCODE=@PUR_PTCODE AND PUR_PRONODE='0'"; sqlCmd.CommandText = sqltext; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", ((Label)Reitem.FindControl("PUR_PTCODE")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", ((TextBox)Reitem.FindControl("PUR_USEKCNUM")).Text.Replace(" ", "")); sqlCmd.Parameters.AddWithValue("@PUR_PLANNUM", ((TextBox)Reitem.FindControl("PUR_PLANNUM")).Text.Replace(" ", "")); int rowsnum = sqlCmd.ExecuteNonQuery(); } } DBCallCommon.closeConn(sqlConn); }
protected void btnupdate_Click(object sender, EventArgs e) { string cmdstring; if (btnupdate.Text == "增加") { lblupdate.Visible = true; DBCallCommon.closeConn(sqlConn); cmdstring = "insert into TBDS_STAFFINFO(ST_NAME,ST_GENDER,ST_CODE,ST_DEPID,ST_FILLDATE,ST_NOTE,ST_POSITION,ST_SEQUEN,ST_IDCARD,ST_TELE,ST_REGIST,ST_MARRY,ST_POLITICAL,ST_AGE,ST_XUELI,ST_XUEWEI,ST_BIYE,ST_ZHUANYE,ST_BIYETIME,ST_EQXUELI,ST_EQZHICH,ST_ZHICH) values (@ST_NAME,@DropDownListgender,@ST_CODE,@DropDownListdept,@ST_FILLDATE,@ST_NOTE,@ST_POSITION,@ST_SEQUEN,@ST_IDCARD,@ST_TELE,@ST_REGIST,@ST_MARRY,@ST_POLITICAL,@ST_AGE,@ST_XUELI,@ST_XUEWEI,@ST_BIYE,@ST_ZHUANYE,@ST_BIYETIME,@ST_EQXUELI,@ST_EQZHICH,@ST_ZHICH)"; int dr1 = tbds_staffinf_update(ST_NAME.Text.ToString(), DropDownListgender.SelectedValue.ToString(), ST_CODE.Text.ToString(), DropDownListdept.SelectedValue.ToString(), DateTime.Now.ToString(), ST_NOTE.Text.ToString(), ST_POSITION.Text.ToString(), ST_SEQUEN.Text.ToString(), ST_IDCARD.Text.ToString(), ST_TELE.Text.ToString(), ST_REGIST.Text.ToString(), ST_MARRY.Text.ToString(), ST_POLITICAL.Text.ToString(), ST_AGE.Text.ToString(), ST_XUELI.Text.ToString(), ST_XUEWEI.Text.ToString(), ST_BIYE.Text.ToString(), ST_ZHUANYE.Text.ToString(), ST_BIYETIME.Text.ToString(), ST_EQXUELI.Text.ToString(), ST_EQZHICH.Text.ToString(), ST_ZHICH.Text.ToString(), cmdstring); //int dr1 = tbds_staffinf_update(ST_CODE.Text.ToString(), ST_NAME.Text.ToString(), DropDownListgender.SelectedValue.ToString(), ST_POSITION.Text.ToString(), "", DropDownListdept.SelectedValue.ToString(), "", ST_MANCLERK.Text.ToString(), ST_FILLDATE.Text.ToString(), ST_NOTE.Text.ToString(), "", ST_SEQUEN.Text.ToString(), cmdstring); if (dr1 == 1) { Response.Write("<script>javascript:window.close();</script>"); } else { lblupdate.Visible = true; lblupdate.Text = "操作失败"; } } else { ///ST_MANCLERK.Text = Session["UserName"].ToString(); cmdstring = "update TBDS_STAFFINFO SET ST_NAME=@ST_NAME,ST_CODE=@ST_CODE,ST_GENDER=@DropDownListgender,ST_DEPID=@DropDownListdept,ST_FILLDATE=@ST_FILLDATE,ST_NOTE=@ST_NOTE,ST_POSITION=@ST_POSITION,ST_SEQUEN=@ST_SEQUEN,ST_IDCARD=@ST_IDCARD,ST_TELE=@ST_TELE,ST_REGIST=@ST_REGIST,ST_MARRY=@ST_MARRY,ST_POLITICAL=@ST_POLITICAL,ST_AGE=@ST_AGE,ST_XUELI=@ST_XUELI,ST_XUEWEI=@ST_XUEWEI,ST_BIYE=@ST_BIYE,ST_ZHUANYE=@ST_ZHUANYE,ST_BIYETIME=@ST_BIYETIME,ST_EQXUELI=@ST_EQXUELI,ST_EQZHICH=@ST_EQZHICH,ST_ZHICH=@ST_ZHICH where ST_ID=" + Request.QueryString["ST_CODE"].ToString(); //cmdstring = "update TBDS_STAFFINFO SET ST_NAME=@ST_NAME,ST_CODE=@ST_CODE,ST_GENDER=@DropDownListgender,ST_POSITION=@ST_POSITION,ST_JOBCAT=@ST_JOBCAT,ST_DEPID=@DropDownListdept,ST_STATE=@DropDownListstate,ST_MANCLERK=@ST_MANCLERK,ST_FILLDATE=@ST_FILLDATE,ST_NOTE=@ST_NOTE,R_NAME=@R_NAME,ST_SEQUEN=@ST_SEQUEN WHERE ST_CODE='" + Session["code"] + "'"; int dr1 = tbds_staffinf_update(ST_NAME.Text.ToString(), DropDownListgender.SelectedValue.ToString(), ST_CODE.Text.ToString(), DropDownListdept.SelectedValue.ToString(), DateTime.Now.ToString(), ST_NOTE.Text.ToString(), ST_POSITION.Text.ToString(), ST_SEQUEN.Text.ToString(), ST_IDCARD.Text.ToString(), ST_TELE.Text.ToString(), ST_REGIST.Text.ToString(), ST_MARRY.Text.ToString(), ST_POLITICAL.Text.ToString(), ST_AGE.Text.ToString(), ST_XUELI.Text.ToString(), ST_XUEWEI.Text.ToString(), ST_BIYE.Text.ToString(), ST_ZHUANYE.Text.ToString(), ST_BIYETIME.Text.ToString(), ST_EQXUELI.Text.ToString(), ST_EQZHICH.Text.ToString(), ST_ZHICH.Text.ToString(), cmdstring); if (dr1 == 1) { Response.Write("<script>javascript:window.close();</script>"); } else { lblupdate.Visible = true; lblupdate.Text = "操作失败"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Title = "岗位信息管理"; lblupdate.Visible = false; lblupload2.Visible = false; string actionstr = Request.QueryString["action"].ToString(); GetDepartment1(); //获取部门下拉框的值 //getjobcat(); //获取工种下拉框的值 if (actionstr == "add") { btnupdate.Text = "增加"; //ST_MANCLERK.Text = Session["UserName"].ToString(); ST_FILLDATE.Text = System.DateTime.Now.ToString(); Panel2.CssClass = ""; TextBoxdept.Visible = false; Panel1.Enabled = true; } else if (actionstr == "update") { //ST_MANCLERK.Text = Session["UserName"].ToString(); ST_FILLDATE.Text = System.DateTime.Now.ToString(); Panel2.CssClass = ""; TextBoxdept.Visible = false; Panel1.Enabled = true; Showdata(); } else { btnupdate.Visible = false; DropDownListdept.Visible = false; Showdata(); } } DBCallCommon.closeConn(sqlConn); }
protected void btnSave_Replace(object sender, EventArgs e) { string sqltext; if (((Button)sender).CommandName == "Replace") { sqltext = "update " + tablename + " set " + ddlRepType.SelectedValue + "=REPLACE(" + ddlRepType.SelectedValue + ",'" + txtStart.Text.Trim() + "','" + txtEnd.Text.Trim() + "') WHERE " + ViewState["Org"].ToString() + ""; string conStr = DBCallCommon.GetStringValue("connectionStrings"); SqlConnection conn = new SqlConnection(conStr); SqlCommand sc = new SqlCommand(); sc.CommandType = CommandType.Text; sc.Connection = conn; sc.CommandText = sqltext; DBCallCommon.openConn(conn); int rowEffected = sc.ExecuteNonQuery(); DBCallCommon.closeConn(conn); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('替换成功!!!\\r\\r影响行数【" + rowEffected + "】');", true); } else if (((Button)sender).CommandName == "Add") { sqltext = "update " + tablename + " set " + ddlRepType.SelectedValue + "=" + ddlRepType.SelectedValue + "+' " + txtAdd.Text.Trim() + "' WHERE " + ViewState["Org"].ToString() + ""; string conStr = DBCallCommon.GetStringValue("connectionStrings"); SqlConnection conn = new SqlConnection(conStr); SqlCommand sc = new SqlCommand(); sc.CommandType = CommandType.Text; sc.Connection = conn; sc.CommandText = sqltext; DBCallCommon.openConn(conn); int rowEffected = sc.ExecuteNonQuery(); DBCallCommon.closeConn(conn); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('追加成功!!!\\r\\r影响行数【" + rowEffected + "】');", true); } }
protected int tbds_depinf_update(string DEP_CODE, string DEP_NAME, string fatherdept, string DEP_ISYENODE, string DEP_CY, string DEP_SFJY, string DEP_MANCLERK, string DEP_FILLDATE, string DEP_NOTE, string DEP_BZYN, string cmdstring) //修改数据库数据 { SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlCmd.CommandText = cmdstring; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@DEP_CODE", DEP_CODE); sqlCmd.Parameters.AddWithValue("@DEP_NAME", ignoreSpaces(DEP_NAME)); sqlCmd.Parameters.AddWithValue("@fatherdept", fatherdept); sqlCmd.Parameters.AddWithValue("@DEP_ISYENODE", DEP_ISYENODE); sqlCmd.Parameters.AddWithValue("@DEP_CY", DEP_CY); sqlCmd.Parameters.AddWithValue("@DEP_SFJY", DEP_SFJY); sqlCmd.Parameters.AddWithValue("@DEP_MANCLERK", DEP_MANCLERK); sqlCmd.Parameters.AddWithValue("@DEP_FILLDATE", Convert.ToDateTime(DEP_FILLDATE)); sqlCmd.Parameters.AddWithValue("@DEP_NOTE", DEP_NOTE); sqlCmd.Parameters.AddWithValue("@DEP_BZYN", DEP_BZYN); sqlConn.Open(); sqlCmd.Connection = sqlConn; int rowsnum = sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); return(rowsnum); }
protected int tbds_staffinf_update(string ST_NAME, string DropDownListgender, string ST_CODE, string DropDownListdept, string ST_FILLDATE, string ST_NOTE, string ST_POSITION, string ST_SEQUEN, string ST_IDCARD, string ST_TELE, string ST_REGIST, string ST_MARRY, string ST_POLITICAL, string ST_AGE, string ST_XUELI, string ST_XUEWEI, string ST_BIYE, string ST_ZHUANYE, string ST_BIYETIME, string ST_EQXUELI, string ST_EQZHICH, string ST_ZHICH, string cmdstring) { SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlCmd.CommandText = cmdstring; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@ST_NAME", ST_NAME); sqlCmd.Parameters.AddWithValue("@ST_CODE", ST_CODE); sqlCmd.Parameters.AddWithValue("@DropDownListgender", DropDownListgender); sqlCmd.Parameters.AddWithValue("@DropDownListdept", DropDownListdept); sqlCmd.Parameters.AddWithValue("@ST_FILLDATE", Convert.ToDateTime(ST_FILLDATE)); sqlCmd.Parameters.AddWithValue("@ST_NOTE", ST_NOTE); sqlCmd.Parameters.AddWithValue("@ST_SEQUEN", ST_SEQUEN); sqlCmd.Parameters.AddWithValue("@ST_IDCARD", ST_IDCARD); sqlCmd.Parameters.AddWithValue("@ST_TELE", ST_TELE); sqlCmd.Parameters.AddWithValue("@ST_POSITION", ST_POSITION); sqlCmd.Parameters.AddWithValue("@ST_REGIST", ST_REGIST); sqlCmd.Parameters.AddWithValue("@ST_MARRY", ST_MARRY); sqlCmd.Parameters.AddWithValue("@ST_POLITICAL", ST_POLITICAL); sqlCmd.Parameters.AddWithValue("@ST_AGE", ST_AGE); sqlCmd.Parameters.AddWithValue("@ST_XUELI", ST_XUELI); sqlCmd.Parameters.AddWithValue("@ST_XUEWEI", ST_XUEWEI); sqlCmd.Parameters.AddWithValue("@ST_BIYE", ST_BIYE); sqlCmd.Parameters.AddWithValue("@ST_ZHUANYE", ST_ZHUANYE); sqlCmd.Parameters.AddWithValue("@ST_BIYETIME", ST_BIYETIME); sqlCmd.Parameters.AddWithValue("@ST_EQXUELI", ST_EQXUELI); sqlCmd.Parameters.AddWithValue("@ST_EQZHICH", ST_EQZHICH); sqlCmd.Parameters.AddWithValue("@ST_ZHICH", ST_ZHICH); sqlConn.Open(); sqlCmd.Connection = sqlConn; int rowsnum = sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); return(rowsnum); }
private void insertallinitialdata() { string sqltext = ""; SqlConnection sqlConn = new SqlConnection(); SqlCommand sqlCmd = new SqlCommand(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); sqlConn.Open(); sqlCmd.Connection = sqlConn; DataTable glotb = SetDatetable(); for (int i = 0; i < DropDownList_PJ.Items.Count; i++) { sqltext = "SELECT DISTINCT d.MP_ENGID AS PUR_ENGID,d.MP_ENGNAME AS PUR_ENGNAME " + "FROM (SELECT MP_PID,MP_PJID,MP_ENGID,MP_ENGNAME FROM TBPM_MPFORBLJ " + "UNION ALL SELECT MP_PID,MP_PJID,MP_ENGID,MP_ENGNAME FROM TBPM_MPFORDQJ " + "UNION ALL SELECT MP_PID,MP_PJID,MP_ENGID,MP_ENGNAME FROM TBPM_MPFORDQO " + "UNION ALL SELECT MP_PID,MP_PJID,MP_ENGID,MP_ENGNAME FROM TBPM_MPFORGFB " + "UNION ALL SELECT MP_PID,MP_PJID,MP_ENGID,MP_ENGNAME FROM TBPM_MPFORHZY " + "UNION ALL SELECT MP_PID,MP_PJID,MP_ENGID,MP_ENGNAME FROM TBPM_MPFORQLM) AS d " + "WHERE (MP_PID IN (SELECT MP_ID AS MP_PID FROM TBPM_MPFORALLRVW WHERE (MP_STATE = '8')) AND MP_PJID='" + DropDownList_PJ.Items[i].Value.ToString() + "') "; DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext); if (dt.Rows.Count > 0) { for (int j = 0; j < dt.Rows.Count; j++) { generate_caigoudan(DropDownList_PJ.Items[i].Value.ToString(), dt.Rows[j]["PUR_ENGID"].ToString()); string expression = "PUR_PJID='" + DropDownList_PJ.Items[i].Value.ToString() + "' AND PUR_ENGID ='" + dt.Rows[j]["PUR_ENGID"].ToString() + "'"; string sortOrder = "PUR_MARID ASC"; DataRow[] foundRows = glotb.Select(expression, sortOrder); for (int k = 0; k < foundRows.Length; k++) { sqltext = "INSERT INTO TBPC_PURCHASEPLAN(PUR_PCODE,PUR_PJID,PUR_PJNAME,PUR_ENGID,PUR_ENGNAME,PUR_PTCODE,PUR_MARID,PUR_MARNAME,PUR_MARNORM,PUR_MARTERIAL,PUR_FIXEDSIZE,PUR_NUM,PUR_NUNIT,PUR_USTNUM,PUR_RPNUM,PUR_PUNIT,PUR_STDATE,PUR_PRONODE,PUR_STATE) " + "VALUES(@PUR_PCODE,@PUR_PJID,@PUR_PJNAME,@PUR_ENGID,@PUR_ENGNAME,@PUR_PTCODE,@PUR_MARID,@PUR_MARNAME,@PUR_MARNORM,@PUR_MARTERIAL,@PUR_FIXEDSIZE,@PUR_NUM,@PUR_NUNIT,@PUR_USTNUM,@PUR_RPNUM,@PUR_PUNIT,@PUR_STDATE,@PUR_PRONODE,@PUR_STATE)"; sqlCmd.CommandText = sqltext; sqlCmd.Parameters.Clear(); sqlCmd.Parameters.AddWithValue("@PUR_PCODE", TextBox_pid.Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PJID", DropDownList_PJ.Items[i].Value.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PJNAME", DropDownList_PJ.Items[i].Text.ToString()); sqlCmd.Parameters.AddWithValue("@PUR_ENGID", dt.Rows[j]["PUR_ENGID"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_ENGNAME", dt.Rows[j]["PUR_ENGNAME"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PTCODE", TextBox_pid.Text.ToString() + "_" + (k + 1).ToString().PadLeft(4, '0')); sqlCmd.Parameters.AddWithValue("@PUR_MARID", foundRows[k]["PUR_MARID"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_MARNAME", foundRows[k]["PUR_MARNAME"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_MARNORM", foundRows[k]["PUR_MARNORM"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_MARTERIAL", foundRows[k]["PUR_MARTERIAL"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_FIXEDSIZE", foundRows[k]["PUR_FIXEDSIZE"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_NUM", foundRows[k]["PUR_NEDDNUM"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_NUNIT", foundRows[k]["PUR_NUNIT"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_USTNUM", '0'); sqlCmd.Parameters.AddWithValue("@PUR_RPNUM", foundRows[k]["PUR_NEDDNUM"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_PUNIT", foundRows[k]["PUR_NUNIT"].ToString()); sqlCmd.Parameters.AddWithValue("@PUR_STDATE", DateTime.Now.ToString("yyyy-MM-dd")); sqlCmd.Parameters.AddWithValue("@PUR_PRONODE", '0'); sqlCmd.Parameters.AddWithValue("@PUR_STATE", '0'); int rowsnum = sqlCmd.ExecuteNonQuery(); } string sqltext1 = "INSERT INTO TBPC_PCHSPLANRVW(PR_SHEETNO,PR_REVIEWA,PR_REVIEWANM,PR_REVIEWATIME,PR_STATE,PR_PRONODE) " + "VALUES('" + TextBox_pid.Text.ToString() + "' ,'" + TextBoxexecutorid.Text.ToString() + "','" + TextBoxexecutor.Text.ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','000','0')"; DBCallCommon.ExeSqlText(sqltext1); } } } string sqltext2 = "UPDATE TBPM_MPFORALLRVW SET MP_STATE='9',MP_PRSHEETNO='" + TextBox_pid.Text.ToString() + "'WHERE MP_STATE='8'"; DBCallCommon.ExeSqlText(sqltext2); DBCallCommon.closeConn(sqlConn); Response.Redirect("~/PC_Data/PC_TBPC_Purchaseplan_check_list.aspx"); }
/*****************************月末出库核算***************************/ protected void btn_hs_Click(object sender, EventArgs e) { string sqlifcksh = "select * from View_SM_OUT where TotalState<>'2'"; DataTable dtifcksh = DBCallCommon.GetDTUsingSqlText(sqlifcksh); if (dtifcksh.Rows.Count > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('存在未审核的出库单!')", true); return; } SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); DBCallCommon.openConn(sqlConn); SqlCommand sqlCmd = new SqlCommand("YueMoChuKuHeSuan", sqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = 0; sqlCmd.Parameters.Add("@gmonth", SqlDbType.VarChar, 2); sqlCmd.Parameters["@gmonth"].Value = getMonth(); sqlCmd.Parameters.Add("@gyear", SqlDbType.VarChar, 4); sqlCmd.Parameters["@gyear"].Value = getYear(); sqlCmd.Parameters.Add("@retVal", SqlDbType.Int, 1).Direction = ParameterDirection.ReturnValue; //增加返回值参数@retVal sqlCmd.ExecuteNonQuery(); DBCallCommon.closeConn(sqlConn); if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 0) { string script = @"alert('出库核算成功!');location.href ='FM_YueMo_ChuKu_Adjust_Accounts.aspx'"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 1) { //关账失败! string script = @"alert('系统已核算!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 2) { //出现了未审核的入库单 //ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "ShowViewModal('2');", true); Response.Redirect("FM_YueMo_ChuKu_Adjust_Accounts_Error.aspx?errorID=2"); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 3) { //出现了未审核的出库单 //ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "ShowViewModal('3');", true); Response.Redirect("FM_YueMo_ChuKu_Adjust_Accounts_Error.aspx?errorID=3"); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 4) { //在核算期间,系统出现了新的入库单 //ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "ShowViewModal('4');", true); Response.Redirect("FM_YueMo_ChuKu_Adjust_Accounts_Error.aspx?errorID=4"); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 5) { //在核算期间,系统出现了新的出库单 //ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "ShowViewModal('5');", true); Response.Redirect("FM_YueMo_ChuKu_Adjust_Accounts_Error.aspx?errorID=5"); } else if (Convert.ToInt32(sqlCmd.Parameters["@retVal"].Value) == 6) { string script = @"alert('系统在统计库存数据时,发生了单据错误!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", script, true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Title = "组织结构管理"; lblupdate.Visible = false; string actionstr = Request.QueryString["action"].ToString(); GetDepartment(); if (actionstr == "add") //添加功能页面 { DEP_FILLDATE.Text = System.DateTime.Now.ToString(); DEP_MANCLERK.Text = Session["UserName"].ToString(); #region btnupdate.Text = "增加"; string addgropstr = Request.QueryString["selectaddgroup"].ToString(); //获取添加级别(一级/二级) if (addgropstr == "1") //一级,添加部门,默认无父节点,编码为两位 { fatherdept.Visible = false; fatherdeptl.Visible = false; this.Title = "添加部门"; Laddmessage.Text = "添加部门"; DEP_ISYENODE.SelectedValue = "N"; DEP_SFJY.SelectedValue = "0"; DEP_CY.SelectedValue = "0"; DEP_ISYENODE.Enabled = false; getdepcode(); fatherdept.Items.Clear(); ListItem item = new ListItem(); item.Text = "0"; item.Value = "0"; fatherdept.Items.Insert(0, item); } else //添加二级部门(班组/岗位),编码有父部门决定 { if (addgropstr == "2") { fatherdept.Visible = true; fatherdeptl.Visible = true; Laddmessage.Text = "添加班组/岗位"; DEP_ISYENODE.SelectedValue = "Y"; DEP_SFJY.SelectedValue = "0"; DEP_CY.SelectedValue = "0"; DEP_ISYENODE.Enabled = false; } else { if (addgropstr == "3") { fatherdept.Visible = true; fatherdeptl.Visible = true; Laddmessage.Text = "添加班组"; DEP_ISYENODE.SelectedValue = "Y"; DEP_SFJY.SelectedValue = "0"; DEP_CY.SelectedValue = "0"; DEP_ISYENODE.Enabled = false; } else { if (addgropstr == "4") { fatherdept.Visible = true; fatherdeptl.Visible = true; Laddmessage.Text = "添加工种"; DEP_ISYENODE.SelectedValue = "Y"; DEP_SFJY.SelectedValue = "0"; DEP_CY.SelectedValue = "0"; DEP_ISYENODE.Enabled = false; } } } } #endregion } else if (actionstr == "update") //修改功能页面 { DEP_FILLDATE.Text = System.DateTime.Now.ToString(); DEP_MANCLERK.Text = Session["UserName"].ToString(); string dep_codestr = Request.QueryString["DEP_CODE"].ToString(); //获取修改的部门编码 Session["depcode"] = dep_codestr; //存储修改的部门编码 DEP_CODE.Text = dep_codestr; fatherdept.Enabled = false; //编码自动生成,不允许人工输入 sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlConn; if (dep_codestr.Substring(0, 2) == "JC")//修改工种 { #region sqlCmd.CommandText = "select * from TBDS_JOBCATINFO where JC_ID='" + dep_codestr + "'"; sqlConn.Open(); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.Read()) //获取修改部门的原始信息 { fatherdept.Visible = true; fatherdept.SelectedValue = dr["JC_DEPID"].ToString();//显示父部门 Radiogrouportw.Visible = true; Radiogrouportw.Enabled = false; Radiogrouportw.SelectedValue = "0"; DEP_CODE.Text = dr["JC_ID"].ToString(); //显示其他信息 DEP_NAME.Text = dr["JC_NAME"].ToString(); DEP_ISYENODE.SelectedValue = "Y"; DEP_SFJY.SelectedValue = "0"; DEP_CY.SelectedValue = "0"; DEP_NOTE.Text = dr["JC_NOTE"].ToString(); } dr.Close(); #endregion } else //修改部门/班组/岗位 { #region sqlCmd.CommandText = "select * from TBDS_DEPINFO where DEP_CODE='" + dep_codestr + "'"; sqlConn.Open(); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.Read()) //获取修改部门的原始信息 { if (dr["DEP_FATHERID"].ToString() == "0") //无上级部门即为一级部门 { fatherdept.Visible = false; //父部门选择下拉框隐藏,默认值为“0” fatherdeptl.Visible = false; fatherdept.SelectedValue = "0"; } else //有上级部门即为二级部门 { fatherdept.Visible = true; fatherdept.SelectedValue = dr["DEP_CODE"].ToString().Substring(0, 2); //dr["DEP_FATHERID"].ToString();//显示父部门 } DEP_CODE.Text = dr["DEP_CODE"].ToString(); //显示其他信息 DEP_NAME.Text = dr["DEP_NAME"].ToString(); DEP_ISYENODE.SelectedValue = dr["DEP_ISYENODE"].ToString(); DEP_SFJY.SelectedValue = dr["DEP_SFJY"].ToString(); DEP_CY.SelectedValue = dr["DEP_CY"].ToString(); DEP_NOTE.Text = dr["DEP_NOTE"].ToString(); if (dr["DEP_CODE"].ToString().Substring(0, 2) == "04" && Convert.ToInt32(dr["DEP_CODE"].ToString().Length) >= 3) { tr1.Visible = true; rdbzyn.SelectedValue = dr["DEP_BZYN"].ToString().Trim(); } } dr.Close(); #endregion } DBCallCommon.closeConn(sqlConn); } else { string dep_codestr = Request.QueryString["DEP_CODE"].ToString(); //获取修改的部门编码 Session["depcode"] = dep_codestr; //存储修改的部门编码 DEP_CODE.Text = dep_codestr; fatherdept.Enabled = false; //编码自动生成,不允许人工输入 DEP_NAME.Enabled = false; DEP_SFJY.Enabled = false; DEP_CY.Enabled = false; DEP_NOTE.Enabled = false; rdbzyn.Enabled = false; btnupdate.Visible = false; sqlConn.ConnectionString = DBCallCommon.GetStringValue("connectionStrings"); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = sqlConn; if (dep_codestr.Substring(0, 2) == "JC")//修改工种 { #region sqlCmd.CommandText = "select * from TBDS_JOBCATINFO where JC_ID='" + dep_codestr + "'"; sqlConn.Open(); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.Read()) //获取修改部门的原始信息 { fatherdept.Visible = true; fatherdept.SelectedValue = dr["JC_DEPID"].ToString();//显示父部门 Radiogrouportw.Visible = true; Radiogrouportw.Enabled = false; Radiogrouportw.SelectedValue = "0"; DEP_CODE.Text = dr["JC_ID"].ToString(); //显示其他信息 DEP_NAME.Text = dr["JC_NAME"].ToString(); DEP_ISYENODE.SelectedValue = "Y"; DEP_SFJY.SelectedValue = "0"; DEP_CY.SelectedValue = "0"; DEP_NOTE.Text = dr["JC_NOTE"].ToString(); DEP_MANCLERK.Text = dr["JC_MANCLERK"].ToString(); DEP_FILLDATE.Text = dr["JC_FILLDATE"].ToString(); } dr.Close(); #endregion } else //修改部门/班组/岗位 { #region sqlCmd.CommandText = "select * from TBDS_DEPINFO where DEP_CODE='" + dep_codestr + "'"; sqlConn.Open(); SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.Read()) //获取修改部门的原始信息 { if (dr["DEP_FATHERID"].ToString() == "0") //无上级部门即为一级部门 { fatherdept.Visible = false; //父部门选择下拉框隐藏,默认值为“0” fatherdeptl.Visible = false; fatherdept.SelectedValue = "0"; } else //有上级部门即为二级部门 { fatherdept.Visible = true; fatherdept.SelectedValue = dr["DEP_CODE"].ToString().Substring(0, 2); //dr["DEP_FATHERID"].ToString();//显示父部门 } DEP_CODE.Text = dr["DEP_CODE"].ToString(); //显示其他信息 DEP_NAME.Text = dr["DEP_NAME"].ToString(); DEP_ISYENODE.SelectedValue = dr["DEP_ISYENODE"].ToString(); DEP_SFJY.SelectedValue = dr["DEP_SFJY"].ToString(); DEP_CY.SelectedValue = dr["DEP_CY"].ToString(); DEP_NOTE.Text = dr["DEP_NOTE"].ToString(); DEP_FILLDATE.Text = dr["DEP_FILLDATE"].ToString(); DEP_MANCLERK.Text = dr["DEP_MANCLERK"].ToString(); if (dr["DEP_CODE"].ToString().Substring(0, 2) == "04" && Convert.ToInt32(dr["DEP_CODE"].ToString().Length) >= 3) { tr1.Visible = true; rdbzyn.SelectedValue = dr["DEP_BZYN"].ToString().Trim(); } } dr.Close(); #endregion } DBCallCommon.closeConn(sqlConn); } } }