//正常情况下不允许删除仓位信息
        protected void Delete_Click(object sender, EventArgs e)
        {
            string        sql     = "";
            List <string> sqllist = new List <string>();

            foreach (RepeaterItem LabelID in Repeater1.Items)
            {
                CheckBox chk = (CheckBox)LabelID.FindControl("CheckBox1");
                if (chk.Checked)
                {
                    string id = ((Label)LabelID.FindControl("LabelID")).Text;
                    sql = "DELETE FROM TBWS_LOCATION WHERE WL_ID='" + id + "'";
                    sqllist.Add(sql);
                }
            }
            if (sqllist.Count > 0)
            {
                DBCallCommon.ExecuteTrans(sqllist);
                GetData();
            }
        }
        }  //删除功能建议在使用时隐藏

        protected void btnDelete_Click(object sender, EventArgs e)
        {
            List <string> sql = new List <string>();

            string sqltext = "";

            foreach (RepeaterItem LabelID in rptProNumCost.Items)
            {
                System.Web.UI.WebControls.CheckBox chk = (System.Web.UI.WebControls.CheckBox)LabelID.FindControl("CKBOX_SELECT");
                if (chk.Checked)
                {
                    string Id = ((System.Web.UI.WebControls.Label)LabelID.FindControl("lblId")).Text;


                    sqltext = "delete FROM TBDS_KaoHeTotal WHERE Id='" + Id + "'";
                    sql.Add(sqltext);
                }
            }
            DBCallCommon.ExecuteTrans(sql);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('删除成功!!!');", true);
            bindGrid();
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            List <string> sql = new List <string>();

            string sqltext = "";

            foreach (RepeaterItem LabelID in Det_Repeater.Items)
            {
                System.Web.UI.WebControls.CheckBox chk = (System.Web.UI.WebControls.CheckBox)LabelID.FindControl("CKBOX_SELECT");
                if (chk.Checked)
                {
                    string Id = ((HtmlInputHidden)LabelID.FindControl("hidId")).Value;


                    sqltext = "delete FROM TBDS_KaoHe_JXDetail WHERE Id='" + Id + "'";
                    sql.Add(sqltext);
                }
            }
            DBCallCommon.ExecuteTrans(sql);

            Response.Write("<script>alert('删除成功!')</script>");
            ShowData(hidConext.Value);
            CaculZongGZ(hidConext.Value);
        }
Beispiel #4
0
        //删除功能建议在使用时隐藏
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            List <string> sql     = new List <string>();
            string        sqlifsc = "select * from OM_GZHSB where GZ_YEARMONTH='" + dplYear.SelectedValue.ToString().Trim() + "-" + dplMoth.SelectedValue.ToString().Trim() + "' and OM_GZSCBZ='1'";

            System.Data.DataTable dtifsc = DBCallCommon.GetDTUsingSqlText(sqlifsc);
            if (dtifsc.Rows.Count > 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('该月已生成工资,不能删除!!!');", true);
                return;
            }
            string sqltext = "";

            foreach (RepeaterItem LabelID in rptProNumCost.Items)
            {
                System.Web.UI.WebControls.CheckBox chk = (System.Web.UI.WebControls.CheckBox)LabelID.FindControl("CKBOX_SELECT");
                if (chk.Checked)
                {
                    string check = ((System.Web.UI.WebControls.Label)LabelID.FindControl("lbLD_STID")).Text;
                    sqltext = "delete FROM OM_LDBX WHERE LD_STID='" + check + "' and LD_DATE='" + dplYear.SelectedValue.ToString().Trim() + "-" + dplMoth.SelectedValue.ToString().Trim() + "'";
                    sql.Add(sqltext);
                }
            }
            DBCallCommon.ExecuteTrans(sql);

            UCPaging1.CurrentPage = 1;
            this.InitVar();
            this.bindGrid();
        }
Beispiel #5
0
        protected void btn_Audit_Click(object sender, EventArgs e)
        {
            //邮件提醒参数
            string subject    = "";
            string body_title = "";
            string sendto     = "";

            if (ViewState["action"].ToString() == "view" || ViewState["action"].ToString() == "Editor") //查看  ,提交到审批
            {
                List <string> sqlstr = new List <string>();
                if (lbl_spzt.Text == "0")
                {
                    if (check_audit_Per())  //检查是否选择了审核人
                    {
                        string pa_code    = tb_doc.Text.Trim();
                        string pa_fir_per = firstid.Value;
                        string pa_sec_per = secondid.Value;
                        string pa_thi_per = thirdid.Value;
                        //审核人不能相同
                        if (((pa_fir_per != pa_sec_per) && (pa_sec_per != pa_thi_per)) || ((pa_sec_per == "") && (pa_thi_per == "")))
                        {
                            string sqltext = "insert into View_TBPM_SCWXAUDIT (PM_DocuNum,Fir_Per,Fir_Jg,Sec_Per,Sec_Jg,Thi_Per,Thi_Jg,Rank)" +
                                             " values ('" + pa_code + "','" + pa_fir_per + "','0','" + pa_sec_per + "','0','" + pa_thi_per + "','0','" + rblSHDJ.SelectedIndex.ToString() + "')";
                            sqlstr.Add(sqltext);
                            string sqlupdatezt = "update TBPM_SCWXRVW set PM_SPZT='1' where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                            sqlstr.Add(sqlupdatezt);
                            DBCallCommon.ExecuteTrans(sqlstr);
                            //制单人提交后向第一个审批人发送邮件
                            subject = "您有新的生产外协计划需要审批——" + tb_doc.Text.ToString();
                            sendto  = txt_first.Text.Trim();
                            this.SendMail(subject, body_title, sendto);
                            Response.Redirect("../PM_Data/PM_Xie_Audit_List.aspx");
                            // Response.Redirect("../PM_Data/PM_Xie_union.aspx");
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('审核人不能相同!');", true); return;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择审核人!');", true); return;
                    }
                }
                else if (lbl_spzt.Text == "4")
                {
                    if (check_audit_Per())  //检查是否选择了审核人
                    {
                        string pa_code    = tb_doc.Text.Trim();
                        string pa_fir_per = firstid.Value;
                        string pa_sec_per = secondid.Value;
                        string pa_thi_per = thirdid.Value;

                        //审核人不能相同
                        if (((pa_fir_per != pa_sec_per) && (pa_sec_per != pa_thi_per)) || ((pa_sec_per == "") && (pa_thi_per == "")))
                        {
                            string update1 = "update View_TBPM_SCWXAUDIT set Fir_Per='" + pa_fir_per + "',Fir_Jg='0',Fir_Yj='',Fir_Sj='',Sec_Per='" + pa_sec_per + "',Sec_Jg='0'" +
                                             " ,Sec_Yj='',Sec_Sj='',Thi_Per='" + pa_thi_per + "',Thi_Jg='0',Thi_Yj='',Thi_Sj='',Rank='" + rblSHDJ.SelectedIndex.ToString() + "' where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                            string update2 = "update TBPM_SCWXRVW set PM_SPZT='1' where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                            sqlstr.Add(update1);
                            sqlstr.Add(update2);
                            DBCallCommon.ExecuteTrans(sqlstr);
                            //制单人提交后向第一个审批人发送邮件
                            subject = "驳回后的生产外协计划已修改,请重新审批——" + tb_doc.Text.ToString();
                            sendto  = txt_first.Text.Trim();
                            this.SendMail(subject, body_title, sendto);
                            Response.Redirect("../PM_Data/PM_Xie_Audit_List.aspx");
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('审核人不能相同!');", true); return;
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择审核人!');", true); return;
                    }
                }
            }
            else if (ViewState["action"].ToString() == "audit")             //审批 ,提交审批意见
            {
                string spyj = "";                                           // 审批意见
                string spsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); //审批时间
                string spjg = "";                                           //审批结果,0:未审批,1:同意,2:拒绝

                string set_text = "";                                       //更新内容

                //记录审批人是第几级
                string submit_type = "";
                if (Session["UserID"].ToString() == firstid.Value.ToString())
                {
                    spyj     = first_opinion.Text.ToString();
                    spjg     = rbl_first.SelectedValue.ToString();
                    set_text = "set Fir_Yj='" + spyj + "',Fir_Sj='" + spsj + "',Fir_Jg='" + spjg + "' ";

                    submit_type = "1";
                }
                else if (Session["UserID"].ToString() == secondid.Value.ToString())
                {
                    spyj     = second_opinion.Text.ToString();
                    spjg     = rbl_second.SelectedValue.ToString();
                    set_text = "set Sec_Yj='" + spyj + "',Sec_Sj='" + spsj + "',Sec_Jg='" + spjg + "' ";

                    submit_type = "2";
                }
                else if (Session["UserID"].ToString() == thirdid.Value.ToString())
                {
                    spyj     = third_opinion.Text.ToString();
                    spjg     = rbl_third.SelectedValue.ToString();
                    set_text = "set Thi_Yj='" + spyj + "',Thi_Sj='" + spsj + "',Thi_Jg='" + spjg + "' ";

                    submit_type = "3";
                }

                if (spjg == "" || spjg == null)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择【同意】或【不同意】!');", true); return;
                }
                List <string> sqlstr  = new List <string>();
                string        sqltext = "update TBPM_SCWXAUDIT " + set_text + " where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                sqlstr.Add(sqltext);

                //更新审批状态,0:保存;1:提交未审批;2:审批中;3:已通过;4:已驳回;
                string spzt        = (spjg == "1") ? "2" : "4";
                string sqlupdatezt = "update TBPM_SCWXRVW set PM_SPZT='" + spzt + "'where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                sqlstr.Add(sqlupdatezt);
                DBCallCommon.ExecuteTrans(sqlstr);
                //如果同意则向下一级审批人发送邮件通知
                if (spjg == "1")
                {
                    switch (submit_type)
                    {
                    case "1":
                        subject = "您有新的生产外协计划需要审批,请即时处理——" + tb_doc.Text.ToString();
                        sendto  = txt_second.Text.Trim();
                        break;

                    case "2":
                        subject = "您有新的生产外协计划需要审批,请即时处理——" + tb_doc.Text.ToString();
                        sendto  = txt_third.Text.Trim();
                        break;
                    }
                    if (sendto != "")
                    {
                        this.SendMail(subject, body_title, sendto);
                    }
                }
                //如果驳回则向制单人发送邮件通知
                else if (spjg == "2")
                {
                    subject    = "生产外协计划已驳回——" + tb_doc.Text.ToString();
                    body_title = "您提交的生产外协计划申请于" + DateTime.Now.ToString() + "被驳回";
                    sendto     = tb_executor.Text.Trim();
                    this.SendMail(subject, body_title, sendto);
                    List <string> list = new List <string>();
                    //驳回状态改变
                    foreach (RepeaterItem reitem in tbpc_otherpurbill_lookRepeater.Items)
                    {
                        string msid   = ((Label)reitem.FindControl("lb_zj")).Text.ToString();
                        int    docnum = Convert.ToInt32(tb_doc.Text);

                        string sqltext01 = "update  TBPM_WXDetail set MS_scwaixie='3' where MS_ID='" + msid + "'and MS_WSID='" + docnum + "' ";
                        list.Add(sqltext01);
                        //string sqltext02 = " update TBMP_TASKDQO set MS_scwaixie='3' where MS_ID='" + msid + "'";
                        //list.Add(sqltext02);
                    }
                    DBCallCommon.ExecuteTrans(list);
                }

                //检查是否全部同意,如果全部同意则改为3。根据审核等级判断,只判断最后一个是否同意即可
                bool      YesOrNo = false;
                string    sqlJG   = "select * from TBPM_SCWXAUDIT where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                DataTable dt      = DBCallCommon.GetDTUsingSqlText(sqlJG);
                if (dt.Rows.Count > 0)
                {
                    switch (rblSHDJ.SelectedValue.ToString())
                    {
                    case "1":
                        if (dt.Rows[0]["Fir_Jg"].ToString() == "1")
                        {
                            YesOrNo = true;
                        }
                        break;

                    case "2":
                        if (dt.Rows[0]["Sec_Jg"].ToString() == "1")
                        {
                            YesOrNo = true;
                        }

                        break;

                    case "3":
                        if (dt.Rows[0]["Thi_Jg"].ToString() == "1")
                        {
                            YesOrNo = true;
                        }
                        break;
                    }
                }
                if (YesOrNo)
                {
                    string strupdatezp2 = "update TBPM_SCWXRVW set PM_SPZT='3' where PM_DocuNum='" + tb_doc.Text.ToString() + "'";
                    sqlstr.Clear();
                    sqlstr.Add(strupdatezp2);
                    foreach (RepeaterItem LabelID in tbpc_otherpurbill_lookRepeater.Items)
                    {
                        Label lb_zj  = ((Label)LabelID.FindControl("lb_zj"));
                        int   docnum = Convert.ToInt32(tb_doc.Text);
                        //strupdatezp2 = "update TBMP_TASKDQO set MS_scwaixie='4' where MS_ID='" + lb_zj.Text.Trim() + "' and MS_PID='" + tb_pid.Text.ToString() + "' ";
                        //sqlstr.Add(strupdatezp2);
                        strupdatezp2 = "update TBPM_WXDetail set MS_scwaixie='4' where MS_ID='" + lb_zj.Text.Trim() + "' and MS_PID='" + tb_pid.Text.ToString() + "'and MS_WSID='" + docnum + "' ";
                        sqlstr.Add(strupdatezp2);
                    }
                    DBCallCommon.ExecuteTrans(sqlstr);
                }
                Response.Redirect("../PM_Data/PM_Xie_Audit_List.aspx");
                //Response.Write("<script>alert('提交成功!!!');window.close();</script>");
            }
        }