protected void grdvw_ReportDetail_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_ReportDetail.Rows[e.RowIndex].Cells[2].Text;
        string strSql;

        string[] deletelist = new string[2];
        strSql = "DELETE FROM t_M_SampleInfor WHERE id= '" + strSelectedId + "'";
        //待修改,改项目删除后,相应要修改的信息

        //deletelist.SetValue("delete from t_操作员信息 where 所属角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 0);
        //deletelist.SetValue("delete from t_角色菜单关系表 where 角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 1);
        // deletelist.SetValue("DELETE FROM t_角色信息 WHERE 级别id = '" + strSelectedId + "'",2);

        deletelist.SetValue(strSql, 0);
        strSql = "DELETE FROM t_M_MonitorItem WHERE SampleID= '" + strSelectedId + "'";
        deletelist.SetValue(strSql, 1);

        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(2, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            WebApp.Components.Log.SaveLog("样品接收中删除样品信息" + txt_SampleID.Text.Trim() + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        else
        {
            WebApp.Components.Log.SaveLog("样品接收中删除样品信息" + txt_SampleID.Text.Trim() + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        ReportSelectQuery();
    }
Пример #2
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;

        string[] deletelist = new string[4];
        strSql = "DELETE FROM t_Y_FlowInfo WHERE id = '" + strSelectedId + "'";


        deletelist.SetValue(strSql, 0);
        strSql = "DELETE FROM t_Y_Detail WHERE itemid = '" + strSelectedId + "'";
        deletelist.SetValue(strSql, 1);
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(2, deletelist))
        {
            WebApp.Components.Log.SaveLogY("项目受理中删除项目信息(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 0);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            WebApp.Components.Log.SaveLogY("项目受理中删除项目信息(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 0);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
Пример #3
0
    //回退
    protected void btn_back_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
        }
        else
        {
            #region 编辑记录

            int i = 0;
            //项目状态修改
            string   strSql  = @"update t_Y_FlowInfo 
                        set StatusID=8  where id='" + strSelectedId + "'";
            string[] strList = new string[5];
            strList.SetValue(strSql, i++);

            //判断是否为第一次保存
            string  selectidstr = "select * from t_Y_Detail where itemid='" + strSelectedId + "' and flag='0' and statusid='9'";
            DataSet dsid        = new MyDataOp(selectidstr).CreateDataSet();
            //编辑
            if (dsid.Tables[0].Rows.Count > 0)
            {
                strSql = @"update t_Y_Detail 
                        set bz='" + txt_Remark_now.Text + "',CreateDate=getdate(),flag='1' where itemid='" + strSelectedId + "' and statusid='9' and id='" + SelectedId + "'";
            }
            //新加备注
            else
            {
                strSql = @"insert into t_Y_Detail
                                    (itemid,statusid,userid,CreateDate,bz,flag)  
                                    values('" + strSelectedId + "','9','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate(),'" + txt_Remark_now.Text + "','1')";
            }
            strList.SetValue(strSql, i++);
            //            //修改
            //            strSql = @"update t_Y_Detail
            //                                    set flag='1' where itemid='" + strSelectedId + "' and statusid='2'";
            //strList.SetValue(strSql, i++);
            strSql = "Insert into t_Y_BackInfo(itemid,functionid,remark,userid,createdate)values(" + strSelectedId + ",9,'" + txt_Remark_now.Text + "记录时间:" + DateTime.Now.ToString() + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate())";
            strList.SetValue(strSql, i++);
            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(i, strList);
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLogY("回退(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 9);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据保存成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLogY("回退(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 9);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据保存失败!');", true);
            }


            #endregion
            Query();
        }
    }
Пример #4
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;

        strSql = "select * from t_行业信息 where id = '" + strSelectedId + "'";
        DataSet ds = new MyDataOp(strSql).CreateDataSet();

        string[] list = new string[2];
        int      i    = 0;

        if (ds.Tables.Count == 1)
        {
            strSql = "update  t_委托单位 set 行业类别=12  WHERE 行业类别 = '" + strSelectedId + "'";
            list.SetValue(strSql, i++);
            strSql = "DELETE FROM t_行业信息 WHERE id = '" + strSelectedId + "'";
            list.SetValue(strSql, i++);
            MyDataOp mdo = new MyDataOp(strSql);
            if (mdo.DoTran(i, list))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
            }
            Query();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('没有该行业类型,数据删除失败!!')", true);
        }
    }
Пример #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string[] strlist = new string[2];
        int      i       = 0;

        this.NodeCheck(this.TreeView1.Nodes);
        if (FunctionID != "")
        {
            i++;
            FunctionID = FunctionID.Substring(0, FunctionID.Length - 1);
            strlist.SetValue(String.Format("update t_R_RoleMenu set checked='1' where MenuID in({0}) and RoleID='{1}'", FunctionID, Option), 0);
        }
        if (NoFunctionID != "")
        {
            i++;
            NoFunctionID = NoFunctionID.Substring(0, NoFunctionID.Length - 1);
            strlist.SetValue(String.Format("update t_R_RoleMenu set checked='0' where MenuID in({0}) and RoleID='{1}'", NoFunctionID, Option), 1);
        }



        string   str  = "";
        MyDataOp cmd  = new MyDataOp(str);
        bool     flag = cmd.DoTran(i, strlist);

        if (flag == true)
        {
            Response.Write("<script>alert('保存成功!');window.close();</script>");
        }
        else
        {
            Response.Write("<script>alert('保存失败!');</script>");
        }
    }
Пример #6
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;

        string[] strlist = new string[2];

        int i = 0;

        strSql = "DELETE FROM t_hyItem WHERE pid = '" + strSelectedId + "'";
        strlist.SetValue(strSql, i++);
        strSql = "DELETE FROM t_hyClassParam WHERE id = '" + strSelectedId + "'";
        strlist.SetValue(strSql, i++);
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(i, strlist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
    protected void grdvw_ReportDetail_RowEditing(object sender, GridViewEditEventArgs e)
    {
        strSelectedId = grdvw_ReportDetail.Rows[e.NewEditIndex].Cells[1].Text.Trim();
        string  SampleId  = grdvw_ReportDetail.Rows[e.NewEditIndex].Cells[2].Text.Trim();
        string  monitorid = grdvw_ReportDetail.Rows[e.NewEditIndex].Cells[4].Text.Trim();
        TextBox txt_value = grdvw_ReportDetail.Rows[e.NewEditIndex].Cells[7].FindControl("txt_value") as TextBox;

        string[] str = new string[2];
        int      i   = 0;

        if (txt_value.Text.Trim() != "")
        {
            string upstr = "update t_DrawSampleDetail set value='" + txt_value.Text + "',fxDate=getdate(),DataFlag=1,fxuser='******' where id='" + strSelectedId + "'";
            str.SetValue(upstr, i++);
            MyDataOp sqlobj = new MyDataOp(upstr);
            if (sqlobj.DoTran(i, str))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('分析数据登记成功!')", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('分析数据登记失败!')", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddUnSuccess", "alert('请填写分析数据后再保存!')", true);
        }

        ReportQuery();
    }
Пример #8
0
    protected void grdvw_drawList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_drawList.Rows[e.RowIndex].Cells[2].Text;
        strDrawId     = grdvw_drawList.Rows[e.RowIndex].Cells[1].Text;
        string namelist = grdvw_drawList.Rows[e.RowIndex].Cells[5].Text;
        string strSql;

        string[] deletelist = new string[4];
        int      i          = 0;

        strSql = "DELETE FROM t_DrawSample WHERE id = '" + strDrawId + "'";
        deletelist.SetValue(strSql, i++);
        strSql = "DELETE FROM t_DrawSampleDetail WHERE DrawID = '" + strDrawId + "'";
        deletelist.SetValue(strSql, i++);
        strSql = "update t_MonitorItemDetail set flag=0,fxDanID=0 where fxDanID='" + strDrawId + "'";
        deletelist.SetValue(strSql, i++);

        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(i, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        string logstr = "insert into t_Y_LogInfo(functionid,LogMessage,LogDate,UserID)values('79','删除样品领用记录" + strSelectedId + strDrawId + namelist + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";

        mdo.ExecuteCommand(logstr);
        DrawList();
        Query();
    }
Пример #9
0
    //提交
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
        }
        else
        {
            #region 编辑记录


            string[] updatestr = new string[4];
            int      i         = 0;
            string   strSql    = "";
            //判断是否为第一次保存
            string  selectidstr = "select * from t_Y_Detail where itemid='" + strSelectedId + "' and flag='0' and statusid='7'";
            DataSet dsid        = new MyDataOp(selectidstr).CreateDataSet();
            //编辑
            if (dsid.Tables[0].Rows.Count > 0)
            {
                strSql = @"update t_Y_FlowInfo 
                        set StatusID=8  where id='" + strSelectedId + "'";
                updatestr.SetValue(strSql, i++);
                strSql = @"update t_Y_Detail 
                        set bz='" + txt_Remark_now.Text + "',CreateDate=getdate(),flag='1' where itemid='" + strSelectedId + "' and statusid='7' and id='" + SelectedId + "' ";
                updatestr.SetValue(strSql, i++);
            }
            //新加备注
            else
            {
                strSql = @"update t_Y_FlowInfo 
                        set StatusID=8  where id='" + strSelectedId + "'";
                updatestr.SetValue(strSql, i++);
                strSql = @"insert into t_Y_Detail
                                    (itemid,statusid,userid,CreateDate,bz,flag)  
                                    values('" + strSelectedId + "','7','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate(),'" + txt_Remark_now.Text + "','1')";
                updatestr.SetValue(strSql, i++);
            }


            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(i, updatestr);
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLogY("编辑提交(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 7);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据保存成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLogY("编辑提交(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 7);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据保存失败!');", true);
            }


            #endregion
            Query();
        }
    }
    protected void grdvw_ReportDetail_RowSelecting(object sender, GridViewSelectEventArgs e)
    {
        strSelectedId = grdvw_ReportDetail.Rows[e.NewSelectedIndex].Cells[1].Text.Trim();
        string SampleId = grdvw_ReportDetail.Rows[e.NewSelectedIndex].Cells[2].Text.Trim();

        string[] str       = new string[3];
        int      i         = 0;
        string   monitorid = grdvw_ReportDetail.Rows[e.NewSelectedIndex].Cells[4].Text.Trim();
        TextBox  txt_value = grdvw_ReportDetail.Rows[e.NewSelectedIndex].Cells[7].FindControl("txt_value") as TextBox;

        string upstr = "update t_MonitorItemDetail set flag=0,fxDanID=null where fxDanID='" + strNowLyID + "' and MonitorItem='" + monitorid + "'";

        str.SetValue(upstr, i++);

        upstr = "update t_DrawSampleDetail set updatedate=getdate(),updateuser='******',yxflag=1 where id='" + strSelectedId + "'";
        str.SetValue(upstr, i++);
        if (checkDraw(strNowLyID, strSelectedId) == 1)
        {
            upstr = "update t_DrawSample set updatedate=getdate(),updateuser='******',yxflag=1 where id='" + strNowLyID + "'";
            str.SetValue(upstr, i++);
        }
        MyDataOp sqlobj = new MyDataOp(upstr);

        if (sqlobj.DoTran(i, str))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('申领退回成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Success", "alert('申领退回失败!')", true);
        }
        ReportQuery();
    }
Пример #11
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strReportId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;

        string[] deletelist = new string[4];
        string   str        = "select id from t_M_SampleInfor where ReportID= '" + strReportId + "'";
        // strSql = "DELETE FROM t_MonitorItemDetail ";
        string  condition = "";
        int     i         = 0;
        DataSet ds        = new MyDataOp(str).CreateDataSet();

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            if (i == 0)
            {
                condition = " WHERE SampleID= '" + dr[0].ToString() + "'";
            }
            else
            {
                condition += " or SampleID= '" + dr[0].ToString() + "'";
            }
            i++;
        }



        strSql = "DELETE FROM t_M_SampleInfor WHERE ReportID= '" + strReportId + "'";
        deletelist.SetValue(strSql, 0);
        strSql = "DELETE FROM t_M_ReporInfo WHERE id= '" + strReportId + "'";
        deletelist.SetValue(strSql, 1);
        if (condition != "")
        {
            i = 3;
            //strSql = "DELETE FROM t_M_MonitorItem " + condition;
            //deletelist.SetValue(strSql, 2);
            strSql = "DELETE FROM t_MonitorItemDetail " + condition;
            deletelist.SetValue(strSql, 2);
        }
        else
        {
            i = 2;
        }

        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(i, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            WebApp.Components.Log.SaveLog("样品接收中删除样品信息" + txt_ReportID.Text.Trim() + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        else
        {
            WebApp.Components.Log.SaveLog("样品接收中删除样品信息" + txt_ReportID.Text.Trim() + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
Пример #12
0
    protected void GridView_Report_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = GridView_Report.Rows[e.RowIndex].Cells[1].Text;
        string strSql;
        string fileUrl = GridView_Report.Rows[e.RowIndex].Cells[4].Text;

        if (fileUrl != "&nbsp;")
        {
            string[] deletelist = new string[2];


            strSql = "update t_M_ReporInfo set ReportAddress=null,fileflag=0,ReportUploadDate=null WHERE id= '" + strSelectedId + "'";
            //待修改,改项目删除后,相应要修改的信息

            //deletelist.SetValue("delete from t_操作员信息 where 所属角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 0);
            //deletelist.SetValue("delete from t_角色菜单关系表 where 角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 1);
            // deletelist.SetValue("DELETE FROM t_角色信息 WHERE 级别id = '" + strSelectedId + "'",2);

            deletelist.SetValue(strSql, 0);
            MyDataOp mdo = new MyDataOp(strSql);
            if (mdo.DoTran(1, deletelist))
            {
                try
                {
                    fileUrl = fileUrl.Replace("\\", "/");
                    int kkp = fileUrl.LastIndexOf('/');

                    //string link1 = fileUrl.Substring(kkp-1, fileUrl.Length - kkp);
                    FileInfo file = new FileInfo(fileUrl);
                    file.Delete();

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('报告删除成功!')", true);
                }
                catch (Exception deletemsg)
                {
                    WebApp.Components.Log.SaveLog("报告编制中删除报告异常:(" + strSelectedId + ")" + deletemsg, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);
                }
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告编制中删除报告:(" + strSelectedId + ")失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 6);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('报告删除失败!')", true);
            }
            string  str = "select id,ReportNumber 报告编号,ReportUploadDate 报告上传日期,ReportAddress 报告地址 from t_M_ReporInfo where id='" + strSelectedId + "' and fileflag=1";
            DataSet ds  = new MyDataOp(str).CreateDataSet();
            GridView_Report.DataSource = ds;
            GridView_Report.DataBind();
        }
    }
Пример #13
0
    //提交
    protected void btn_SampleReport_Click(object sender, EventArgs e)
    {
        string strSql = "";

        string[] strlist = new string[2];
        if (txt_VerifyTime.Text.Trim() != "")
        {
            string ddstr = "";
            if (txt_VerifyRemark.Text.Trim() != "")
            {
                ddstr = "ReportProofRemark='" + txt_VerifyRemark.Text.Trim() + "记录时间:" + txt_VerifyTime.Text.Trim() + "',";
            }
            else
            {
                ddstr = "ReportProofRemark = null,";
            }
            //保存收到报告的时间
            strSql = @"update t_M_ReporInfo set StatusID=4, " + ddstr + "ReportProofDate='" + txt_VerifyTime.Text.Trim() + "',ReportProofUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' where id='" + strReportId + "'";
            strlist.SetValue(strSql, 0);
            //strSql = @"update t_M_SampleInfor set StatusID=1 where id='" + strSelectedId + "'";
            //strlist.SetValue(strSql, 1);
            //}
            //else
            //{
            //    strSql = @"update t_M_BackInfo set flag=1 , updateUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',UpdateDate=getdate() where SampleID='" + strSelectedId + "'";
            //}
            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(1, strlist);
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLog("报告审核中保存:(" + strReportId + ")!成功", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('数据保存成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告审核中保存:(" + strReportId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('数据保存失败!');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('请选择收到时间!');", true);
        }
        ReportQuery();
    }
Пример #14
0
    //保存
    protected void btn_SaveReport_Click(object sender, EventArgs e)
    {
        string strSql = "";

        string[] strlist = new string[2];
        if (txt_checktime.Text.Trim() != "")
        {
            string ddstr = "";
            if (txt_CheckRemark.Text.Trim() != "")
            {
                ddstr = "ReportWriteRemark='" + txt_CheckRemark.Text.Trim() + "记录时间:" + txt_checktime.Text.Trim() + "',";
            }
            else
            {
                ddstr = "ReportWriteRemark = null,";
            }
            //保存收到报告的时间
            strSql = @"update t_M_ReporInfo set " + ddstr + "ReportWriteDate='" + txt_checktime.Text.Trim() + "',ReportWriteUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' where id='" + strReportId + "'";
            strlist.SetValue(strSql, 0);

            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(1, strlist);
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLog("报告校核中保存:(" + strReportId + ")!成功", Request.Cookies["Cookies"].Values["u_id"].ToString(), 7);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('数据保存成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告校核中保存:(" + strReportId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 7);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('数据保存失败!');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('请选择收到时间!');", true);
        }



        ReportQuery();
    }
Пример #15
0
    protected void grv_Item_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strHyId = grv_Item.Rows[e.RowIndex].Cells[1].Text.Trim();
        string[] delstrlist = new string[3];
        int      i          = 0;
        string   delstr     = "delete from t_OUTNOItem where  paramid='" + strHyId + "'";

        delstrlist.SetValue(delstr, i++);
        delstr = "delete from t_OUTNOParam where  id='" + strHyId + "'";
        delstrlist.SetValue(delstr, i++);
        MyDataOp mydo = new MyDataOp(delstr);

        if (mydo.DoTran(i, delstrlist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据删除成功!');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据删除失败!');", true);
        }
        ItemParam();
    }
Пример #16
0
    protected void grdvw_ListAnalysisItem_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string strSql;

        string[] deletelist = new string[1];
        strSql = "DELETE FROM t_M_MonitorItem WHERE SampleID='" + strSelectedId + "'and id= '" + grdvw_ListAnalysisItem.Rows[e.RowIndex].Cells[1].Text + "'";
        //待修改,改项目删除后,相应要修改的信息


        deletelist.SetValue(strSql, 0);
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(1, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        queryAnalysisItem();
    }
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;

        string[] strlist = new string[2];
        int      i       = 0;
        string   strSql  = "delete from t_委托单位  where id='" + strSelectedId + "'";

        strlist.SetValue(strSql, i++);
        MyDataOp mdo     = new MyDataOp(strSql);
        bool     success = mdo.DoTran(i, strlist);

        if (success)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
            Query();
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
    }
    //提交
    protected void btn_SampleReport_Click(object sender, EventArgs e)
    {
        string strSql = "";

        string[] strlist = new string[2];
        if (txt_endtime.Text.Trim() != "" && txt_receivetime.Text.Trim() != "")
        {
            string ddstr = "";
            if (txt_endtime.Text.Trim() != "")
            {
                ddstr = ",ReportBindDate='" + txt_endtime.Text + "'";
            }
            else
            {
                ddstr = ",ReportBindDate=null";
            }
            //保存收到报告的时间
            strSql = @"update t_M_ReporInfo set  StatusID=6,ReportBindReceiveDate='" + txt_receivetime.Text.Trim() + "'" + ddstr + " where id='" + strReportId + "'";
            strlist.SetValue(strSql, 0);

            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(1, strlist);
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLog("报告装订中保存:(" + strReportId + ")!成功", Request.Cookies["Cookies"].Values["u_id"].ToString(), 10);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('数据保存成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告装订中保存:(" + strReportId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 10);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存失败!');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('未填写完整,不能提交!');", true);
        }
        ReportQuery();
    }
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;

        strSql = "DELETE FROM t_R_Role WHERE RoleID = '" + strSelectedId + "'";
        string[] deletelist = new string[4];
        deletelist.SetValue(strSql, 0);
        deletelist.SetValue("delete from t_R_RoleMenu where RoleID='" + strSelectedId + "'", 1);
        deletelist.SetValue("delete from t_R_UserInfo where RoleID='" + strSelectedId + "'", 2);
        deletelist.SetValue("delete from t_roleitem where roleid='" + strSelectedId + "'", 3);
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(4, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
Пример #20
0
    //回退
    protected void btn_BackReport_Click(object sender, EventArgs e)
    {
        string ReportStr = "update t_M_ReporInfo set ReportProofDate=null, ReportProofRemark='" + txt_VerifyRemark.Text.Trim() + "记录时间:" + txt_VerifyTime.Text.Trim() + "',ReportProofUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',StatusID=2 where id='" + strReportId + "'";

        string[] strlist = new string[2];
        strlist.SetValue(ReportStr, 0);
        ReportStr = @"Insert into t_M_Backinfo(SampleID,CreateDate,Remark,UserID,FuntionID) values('" + strReportId + "',getdate(),'" + txt_VerifyRemark.Text.Trim() + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',3)";

        strlist.SetValue(ReportStr, 1);
        MyDataOp mdo = new MyDataOp(ReportStr);

        if (mdo.DoTran(2, strlist))
        {
            WebApp.Components.Log.SaveLog("报告审核中回退:(" + strReportId + ")!成功", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert('数据保存成功!');", true);
        }
        else
        {
            WebApp.Components.Log.SaveLog("报告审核中回退:(" + strReportId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetailAnalysis();alert(数据保存失败!');", true);
        }
        ReportQuery();
    }
Пример #21
0
    protected void grdvw_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = grdvw_List.Rows[e.RowIndex].Cells[1].Text;
        string strSql;

        string[] deletelist = new string[4];
        strSql = "DELETE FROM t_操作员级别 WHERE 级别 = '" + strSelectedId + "'";
        deletelist.SetValue("delete from t_操作员信息 where 所属角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 0);
        deletelist.SetValue("delete from t_角色菜单关系表 where 角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 1);
        deletelist.SetValue("DELETE FROM t_角色信息 WHERE 级别id = '" + strSelectedId + "'", 2);

        deletelist.SetValue(strSql, 3);
        MyDataOp mdo = new MyDataOp(strSql);

        if (mdo.DoTran(4, deletelist))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除成功!')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('数据删除失败!')", true);
        }
        Query();
    }
Пример #22
0
    //报告编制中的上传报告
    protected void grdvw_Report_RowEditing(object sender, GridViewEditEventArgs e)
    {
        string strSql = "";

        string[] strlist = new string[2];
        strReportId = grdvw_Report.Rows[e.NewEditIndex].Cells[2].Text.Trim();
        string  strquery = "select * from  t_M_ReporInfo where StatusID=3 and ReportProofDate is null and  id='" + strReportId + "'";
        DataSet ds       = new MyDataOp(strquery).CreateDataSet();

        if (ds.Tables[0].Rows.Count <= 0)
        {
            //保存收到报告的时间
            strSql = @"update t_M_ReporInfo set StatusID=4, ReportCheckDate=getdate(),ReportCheckUserID='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "' where id='" + strReportId + "'";
            strlist.SetValue(strSql, 0);

            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(1, strlist);
            if (blSuccess == true)
            {
                WebApp.Components.Log.SaveLog("报告审核中保存:(" + strReportId + ")!成功", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", ";alert('报告提交成功!');", true);
            }
            else
            {
                WebApp.Components.Log.SaveLog("报告审核中保存:(" + strReportId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('报告提交失败!');", true);
            }
        }
        else
        {
            WebApp.Components.Log.SaveLog("报告审核中保存:(" + strReportId + ")!失败", Request.Cookies["Cookies"].Values["u_id"].ToString(), 8);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('报告未审核,请审核后提交!');", true);
        }

        ReportQuery();
    }
Пример #23
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (btn_OK.Text == "编辑")
        {
            AllTxtCanWrite();
            btn_OK.Text   = "确定";
            lbl_Type.Text = "编辑";
        }
        else
        {
            #region 当按钮文字为“确定”时,执行添加或编辑操作

            int num   = 0;
            int dw    = 0;
            int hours = 0;
            if (txt_num.Text.Trim() != "")
            {
                try
                {
                    num = int.Parse(txt_num.Text.Trim());
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请正确填写样品的有效性!');", true);
                }
                dw = rbl_dw.SelectedIndex;
                if (dw == 0)
                {
                    hours = num;
                }
                else
                {
                    hours = num * 24;
                }
            }
            //添加新纪录
            if (lbl_Type.Text == "添加")
            {
                string str = "select id,AIName from t_M_AnalysisItemEx where AIName='" + txt_AIName.Text + "' and ClassID='" + dropList_type.SelectedValue.ToString().Trim() + "'";

                DataSet dscheck = new MyDataOp(str).CreateDataSet();
                if (dscheck.Tables[0].Rows.Count > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('已存在该分析项目!请直接在原有分析项目上修改信息!');", true);
                }
                else
                {
                    string strSql = @"insert into t_M_AnalysisItemEx
                        (ClassID,AIName,AICode,num,dw,hours)  
                        values('" + dropList_type.SelectedValue.ToString() + "','" + txt_AIName.Text + "','" + txt_AICode.Text + "','" + num + "','" + dw + "','" + hours + "')";
                    if (txt_AICode.Text.Trim() == "")
                    {
                        strSql = @"insert into t_M_AnalysisItemEx
                        (ClassID,AIName,num,dw,hours)  
                        values('" + dropList_type.SelectedValue.ToString() + "','" + txt_AIName.Text + "','" + num + "','" + dw + "','" + hours + "')";
                    }
                    MyDataOp mdo       = new MyDataOp(strSql);
                    bool     blSuccess = mdo.ExecuteCommand();
                    if (blSuccess == true)
                    {
                        string  strc = "select id,AIName from t_M_ANItemInf where AIName='" + txt_AIName.Text + "' and ClassID='" + dropList_type.SelectedValue.ToString().Trim() + "'";
                        DataSet dsc  = new MyDataOp(strc).CreateDataSet();
                        strSelectedId = dsc.Tables[0].Rows[0][0].ToString().Trim();
                        string[] strlist = new string[cbl_Method.Items.Count + 1];
                        int      j       = 0;
                        strlist.SetValue("delete from t_M_AIStandard where AIID='" + strSelectedId + "'", j++);
                        for (int i = 0; i < cbl_Method.Items.Count; i++)
                        {
                            if (cbl_Method.Items[i].Selected)
                            {
                                string temp = " insert into t_M_AIStandard(AIID,Standardid,Standard)valuse('" + strSelectedId + "','" + cbl_Method.Items[i].Value.ToString().Trim() + "','" + cbl_Method.Items[i].Text.Trim() + "')";
                                strlist.SetValue(temp, j++);
                            }
                        }
                        if (j > 0)
                        {
                            if (mdo.DoTran(j, strlist))
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('分析项目添加成功,分析方法配置失败!');", true);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                    }
                    txt_AIName.Text = "";
                    txt_AICode.Text = "";

                    Query();
                }
            }

            //编辑记录
            if (lbl_Type.Text == "编辑")
            {
                string str = "select id,AIName from t_M_AnalysisItemEx where AIName='" + txt_AIName.Text + "' and ClassID='" + dropList_type.SelectedValue.ToString().Trim() + "' and id!='" + strSelectedId + "'";

                DataSet dscheck = new MyDataOp(str).CreateDataSet();
                if (dscheck.Tables[0].Rows.Count > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('已存在同名称的分析项目!请直接在原有分析项目上修改信息!');", true);
                }
                else
                {
                    string strSql = @"update t_M_AnalysisItemEx 
                            set ClassID = '" + dropList_type.SelectedValue.ToString() + "',AIName='" + txt_AIName.Text + "',AICode = '" + txt_AICode.Text + "',num='" + num + "',dw='" + dw + "',hours='" + hours + "' where id = '" + strSelectedId + "'";
                    if (txt_AICode.Text.Trim() == "")
                    {
                        strSql = @"update t_M_AnalysisItemEx 
                            set ClassID = '" + dropList_type.SelectedValue.ToString() + "',AIName='" + txt_AIName.Text + "',AICode = null,num='" + num + "',dw='" + dw + "',hours='" + hours + "' where id = '" + strSelectedId + "'";
                    }

                    MyDataOp mdo       = new MyDataOp(strSql);
                    bool     blSuccess = mdo.ExecuteCommand();
                    if (blSuccess == true)
                    {
                        string[] strlist = new string[cbl_Method.Items.Count + 1];
                        int      j       = 0;
                        strlist.SetValue("delete from t_M_AIStandard where AIID='" + strSelectedId + "'", j++);
                        for (int i = 0; i < cbl_Method.Items.Count; i++)
                        {
                            if (cbl_Method.Items[i].Selected)
                            {
                                string temp = " insert into t_M_AIStandard(AIID,Standardid,Standard)values('" + strSelectedId + "','" + cbl_Method.Items[i].Value.ToString().Trim() + "','" + cbl_Method.Items[i].Text.Trim() + "')";
                                strlist.SetValue(temp, j++);
                            }
                        }
                        if (j > 0)
                        {
                            if (mdo.DoTran(j, strlist))
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('分析项目编辑成功!');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('分析项目编辑成功,分析方法配置失败!');", true);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true);
                    }
                    txt_AIName.Text = "";
                    txt_AICode.Text = "";
                    Query();
                }
            }
            #endregion
        }
    }
Пример #24
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //string sql_sel = "select count(*) from t_R_User_IsWrite where userid = " + Option;
        //DataSet ds_sel = new MyDataOp(sql_sel).CreateDataSet();
        //if (ds_sel.Tables[0].Rows[0][0].ToString() == "0")
        //{

        string  sql = "select t_R_Menu.id from  t_R_Menu inner join t_R_RoleMenu on t_R_RoleMenu.MenuID=t_R_Menu.ID  where RoleID='" + RoleID + "' order by t_R_Menu.OrderID";
        DataSet ds  = new MyDataOp(sql).CreateDataSet();

        string[] list = new string[ds.Tables[0].Rows.Count + 1];
        list.SetValue("Delete from t_R_User_IsWrite where userid='" + Option + "'", 0);

        for (int j = 0, lenth = ds.Tables[0].Rows.Count; j < lenth; j++)
        {
            list.SetValue("insert into t_R_User_IsWrite(userid,menuid,isWrite) values(" + Option + "," + ds.Tables[0].Rows[j][0].ToString() + "," + 0 + ")", j + 1);
        }
        string   sqlstr = "";
        MyDataOp mdo    = new MyDataOp(sqlstr);

        mdo.DoTran(ds.Tables[0].Rows.Count, list);
        //}

        string[] strlist = new string[2];
        int      i       = 0;

        this.NodeCheck(this.TreeView1.Nodes);
        if (FunctionID != "")
        {
            i++;
            FunctionID = FunctionID.Substring(0, FunctionID.Length - 1);
            strlist.SetValue(String.Format("update t_R_User_IsWrite set isWrite='1' where menuid in({0}) and userid='{1}'", FunctionID, Option), 0);
        }
        if (NoFunctionID != "")
        {
            i++;
            NoFunctionID = NoFunctionID.Substring(0, NoFunctionID.Length - 1);
            strlist.SetValue(String.Format("update t_R_User_IsWrite set isWrite='0' where menuid in({0}) and userid='{1}'", NoFunctionID, Option), 1);
        }

        bool flag = true;

        for (int j = 0; j < strlist.Length; j++)
        {
            if (strlist[j] != null && strlist[j] != "")
            {
                MyDataOp cmd = new MyDataOp(strlist[j]);
                flag = cmd.ExecuteCommand() && flag;
            }
        }

        if (flag == true)
        {
            Response.Write("<script>alert('保存成功!');window.close();</script>");
        }
        else
        {
            Response.Write("<script>alert('保存失败!');</script>");
        }
        // string[] strlist = new string[2];
        // int i = 0;
        // this.NodeCheck(this.TreeView1.Nodes);
        // if (FunctionID != "")
        // {
        //     i++;
        //     FunctionID = FunctionID.Substring(0, FunctionID.Length - 1);
        //     strlist.SetValue(String.Format("update t_R_RoleMenu set checked='1' where MenuID in({0}) and RoleID='{1}'", FunctionID, Request.Cookies["Cookies"].Values["Option"].ToString()), 0);

        // }
        // if (NoFunctionID != "")
        // {
        //     i++;
        //     NoFunctionID = NoFunctionID.Substring(0, NoFunctionID.Length - 1);
        //     strlist.SetValue(String.Format("update t_R_RoleMenu set checked='0' where MenuID in({0}) and RoleID='{1}'", NoFunctionID, Request.Cookies["Cookies"].Values["Option"].ToString()), 1);

        // }



        // string str = "";
        //MyDataOp cmd=new MyDataOp(str);
        //bool flag= cmd.DoTran(i,strlist);
        // if(flag==true)
        // {
        //             Response.Write("<script>alert('保存成功!');window.close();</script>");
        //  }
        // else
        // {
        //      Response.Write("<script>alert('保存失败!');</script>");
        // }
    }
Пример #25
0
    public void analysis(DateTime s, DateTime e)
    {
        DateTime dt_s = s; //DateTime.Parse(DateTime.Now.Date.AddDays(-1).ToString("yyyy-MM-dd")+" 00:00:00");//DateTime.Parse("2009-11-01 00:00:00");
        DateTime dt_e = e; //DateTime.Parse(DateTime.Now.Date.AddDays(-1).ToString("yyyy-MM-dd")+" 23:59:59");//DateTime.Parse("2009-11-01 23:59:59");//

        for (DateTime dt = s; dt < e;)
        {
            if (dt.AddHours(24) == e)
            {
                dt_s = s; dt_e = e;
                dt   = dt.AddHours(24);
            }
            else
            {
                dt_s = dt;
                dt_e = dt.AddDays(1).AddSeconds(-1);
                dt   = dt.AddDays(1);
            }

            string str = @"SELECT SUM(N) AS Expr1, MonitorItem, CreateDate " +
                         "FROM (SELECT SUM(num) AS N, MonitorItem, LEFT(CONVERT(varchar, AccessDate, 120), 10) CreateDate " +
                         " FROM t_M_MonitorItem INNER JOIN" +
                         "   t_M_SampleInfor ON " +
                         " t_M_SampleInfor.id = t_M_MonitorItem.SampleID" +
                         " WHERE (AccessDate BETWEEN '" + dt_s + "' AND '" + dt_e + "')" +
                         " GROUP BY MonitorItem, AccessDate) a" +
                         " GROUP BY MonitorItem, CreateDate" +
                         " ORDER BY CreateDate, MonitorItem";
            DataSet ds   = new MyDataOp(str).CreateDataSet();
            string  str2 = @"SELECT SUM(N) AS Expr1, MonitorItem, ReportDate " +
                           "FROM (SELECT SUM(num) AS N, MonitorItem, LEFT(CONVERT(varchar, t_M_MonitorItem.ReportDate, 120), 10) ReportDate " +
                           " FROM t_M_MonitorItem INNER JOIN" +
                           "   t_M_SampleInfor ON " +
                           " t_M_SampleInfor.id = t_M_MonitorItem.SampleID inner join t_M_ReporInfo ON t_M_SampleInfor.ReportID = t_M_ReporInfo.id where " +
                           " (t_M_MonitorItem.ReportDate BETWEEN '" + dt_s + "' AND '" + dt_e + "') " +
                           " GROUP BY MonitorItem, t_M_MonitorItem.ReportDate) a" +
                           " GROUP BY MonitorItem, ReportDate" +
                           " ORDER BY ReportDate, MonitorItem";
            //"select sum(N),MonitorItem,ReportDate from (select sum(num) as N,MonitorItem,LEFT(CONVERT(varchar, ReportDate, 120), 10) ReportDate from t_M_MonitorItem where (ReportDate between '" + dt_s + "' and '" + dt_e + "') group by MonitorItem,ReportDate) as b group by MonitorItem,ReportDate ";
            DataSet ds2 = new MyDataOp(str2).CreateDataSet();
            int     i   = 0;
            int     m   = 1;
            m = ds.Tables[0].Rows.Count + ds2.Tables[0].Rows.Count;
            string[] ListStr = new string[m];
            foreach (DataRow dr in ds.Tables[0].Rows)
            {//检查统计的日期的数据是否已存在
                string  checkstr = "select cdate from t_M_AccessDayInfo where cdate='" + dr[2].ToString() + "' and itemid='" + dr[1].ToString() + "'";
                DataSet checkds  = new MyDataOp(checkstr).CreateDataSet();
                if (checkds.Tables[0].Rows.Count == 0)
                {
                    ListStr.SetValue("Insert into t_M_AccessDayInfo(itemid,num,cdate,ttdate)values('" + dr[1].ToString() + "','" + dr[0].ToString() + "','" + dr[2].ToString() + "',getdate())", i++);
                }
                else
                {
                    ListStr.SetValue("update t_M_AccessDayInfo set num='" + dr[0].ToString() + "',ttdate=getdate() where cdate='" + dr[2].ToString() + "' and itemid='" + dr[1].ToString() + "'", i++);
                }
            }


            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                string  checkstr = "select cdate from t_M_EndDayInfo where cdate='" + dr[2].ToString() + "'";
                DataSet checkds  = new MyDataOp(checkstr).CreateDataSet();
                if (checkds.Tables[0].Rows.Count == 0)
                {
                    ListStr.SetValue("Insert into t_M_EndDayInfo(itemid,num,cdate,ttdate)values('" + dr[1].ToString() + "','" + dr[0].ToString() + "','" + dr[2].ToString() + "',getdate())", i++);
                }
                else
                {
                    ListStr.SetValue("update t_M_EndDayInfo set num='" + dr[0].ToString() + "',ttdate=getdate()) where cdate='" + dr[2].ToString() + "' and itemid='" + dr[1].ToString() + "'", i++);
                }
            }
            if (i > 0)
            {
                MyDataOp doOp   = new MyDataOp(str);
                bool     status = doOp.DoTran(i, ListStr);
                if (!status)
                {
                    WebApp.Components.Log.SaveLog("自动统计日报失败!" + DateTime.Now.ToString(), "1", 0);
                }
            }
        }
    }
Пример #26
0
    protected void GridView_Report_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        strSelectedId = GridView_Report.Rows[e.RowIndex].Cells[1].Text;
        string strSql;
        int    ddfid = int.Parse(GridView_Report.Rows[e.RowIndex].Cells[6].Text);

        if (strSelectedId != "" && (ddfid >= int.Parse(strFId) || (int.Parse(Request.Cookies["Cookies"].Values["u_level"].ToString()) <= 6)))
        {
            string fileUrl = GridView_Report.Rows[e.RowIndex].Cells[5].Text;
            if (fileUrl != "&nbsp;")
            {
                string[] deletelist = new string[2];


                strSql = "Delete from t_Y_fileinfo WHERE id= '" + strSelectedId + "'";
                //待修改,改项目删除后,相应要修改的信息

                //deletelist.SetValue("delete from t_操作员信息 where 所属角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 0);
                //deletelist.SetValue("delete from t_角色菜单关系表 where 角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 1);
                // deletelist.SetValue("DELETE FROM t_角色信息 WHERE 级别id = '" + strSelectedId + "'",2);

                deletelist.SetValue(strSql, 0);
                MyDataOp mdo = new MyDataOp(strSql);
                if (mdo.DoTran(1, deletelist))
                {
                    try
                    {
                        fileUrl = fileUrl.Replace("\\", "/");
                        int kkp = fileUrl.LastIndexOf('/');

                        //string link1 = fileUrl.Substring(kkp-1, fileUrl.Length - kkp);
                        FileInfo file = new FileInfo(fileUrl);
                        file.Delete();
                        WebApp.Components.Log.SaveLogY("删除文件:项目编号:" + strRId + "(" + strSelectedId + ")成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), int.Parse(strFId));

                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('文件删除成功!')", true);
                    }
                    catch (Exception deletemsg)
                    {
                        WebApp.Components.Log.SaveLogY("删除文件异常:项目编号:" + strRId + "(" + strSelectedId + ")" + deletemsg, Request.Cookies["Cookies"].Values["u_id"].ToString(), int.Parse(strFId));
                    }
                }
                else
                {
                    WebApp.Components.Log.SaveLogY("删除文件异常:项目编号:" + strRId + "(" + strSelectedId + ")失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), int.Parse(strFId));
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('文件删除失败!')", true);
                }
                string  str     = "select id,rid 项目编号,userid 上传者,fileName 文件名,address 文件地址,fid from t_Y_fileinfo where rid='" + strRId + "' and fid<=" + strFId + "";
                DataSet ds      = new MyDataOp(str).CreateDataSet();
                string  strtemp = "select Name,UserID from t_R_UserInfo";
                DataSet ds_User = new MyDataOp(strtemp).CreateDataSet();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    foreach (DataRow drr in ds_User.Tables[0].Rows)
                    {
                        if (dr["上传者"].ToString() == drr["UserID"].ToString())
                        {
                            dr["上传者"] = drr["Name"].ToString();
                        }
                        //if (dr["ReportProofUserID"].ToString() == drr["UserID"].ToString())
                        //    dr["ReportProofUserID"] = drr["Name"].ToString();
                        //if (dr["ReportSignUserID"].ToString() == drr["UserID"].ToString())
                        //    dr["ReportSignUserID"] = drr["Name"].ToString();
                    }
                }
                if (ds.Tables[0].Rows.Count == 0)
                {
                    //没有记录仍保留表头
                    ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
                    GridView_Report.DataSource = ds;
                    GridView_Report.DataBind();
                    int intColumnCount = GridView_Report.Rows[0].Cells.Count;
                    GridView_Report.Rows[0].Cells.Clear();
                    GridView_Report.Rows[0].Cells.Add(new TableCell());
                    GridView_Report.Rows[0].Cells[0].ColumnSpan = intColumnCount;
                }
                else
                {
                    GridView_Report.DataSource = ds;
                    GridView_Report.DataBind();
                }
            }
        }


        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('你没有权限删除该文件!')", true);
        }
    }
Пример #27
0
    /// <summary>
    /// 提交于编辑确定的区别在于项目的状态是否改变
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
        }
        else
        {
            int flag = 0;
            //if(cb_if.Checked)
            //    flag = 1;
            string strSql = "";
            #region 添加新纪录
            if (lbl_Type.Text == "添加")
            {
                strSql = @"insert into t_Y_FlowInfo
                                    (itemname,accessman,accessdate,accessremark,StatusID,wtdw,lxman,lxtel,ckflag)  
                                    values('" + drop_ItemName.SelectedValue + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate(),'" + txt_Remark.Text + "','2','" + txt_wtdw.Text.Trim() + "','" + txt_man.Text.Trim() + "','" + txt_tel.Text.Trim() + "'," + flag + ")";

                MyDataOp mdo       = new MyDataOp(strSql);
                bool     blSuccess = mdo.ExecuteCommand();
                if (blSuccess == true)
                {
                    string  selectidstr = "select max(id) from t_Y_FlowInfo where itemname='" + drop_ItemName.SelectedValue + "' and accessman='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "'";
                    DataSet dsid        = new MyDataOp(selectidstr).CreateDataSet();
                    if (dsid.Tables[0].Rows.Count > 0)
                    {
                        strSelectedId = dsid.Tables[0].Rows[0][0].ToString();
                        strSql        = @"insert into t_Y_Detail
                                    (itemid,statusid,userid,CreateDate,bz,flag)  
                                    values('" + strSelectedId + "','1','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate(),'" + txt_Remark.Text + "','1')";
                        MyDataOp mdo3 = new MyDataOp(strSql);
                        if (mdo3.ExecuteCommand())
                        {
                            WebApp.Components.Log.SaveLogY("项目受理中添加项目信息" + drop_ItemName.SelectedItem.Text + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 1);
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                        }
                        else
                        {
                            WebApp.Components.Log.SaveLogY("项目受理中添加项目信息(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 1);
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                        }
                    }
                    else
                    {
                        WebApp.Components.Log.SaveLogY("项目受理中添加项目信息(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 1);
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                    }
                }
            }
            #endregion

            #region 编辑记录
            if (lbl_Type.Text == "编辑")
            {
                string[] updatestr = new string[4];
                int      i         = 0;
                //判断是否为第一次保存
                string  selectidstr = "select * from t_Y_Detail where itemid='" + strSelectedId + "' and flag='0' and statusid='1'";
                DataSet dsid        = new MyDataOp(selectidstr).CreateDataSet();
                //编辑
                if (dsid.Tables[0].Rows.Count > 0)
                {
                    strSql = @"update t_Y_FlowInfo 
                        set itemname='" + drop_ItemName.SelectedValue + "',accessremark='" + txt_Remark.Text + "',StatusID='2' ,wtdw='" + txt_wtdw.Text.Trim() + "',lxman='" + txt_man.Text.Trim() + "',lxtel='" + txt_tel.Text.Trim() + "' ,ckflag=" + flag + " where id='" + strSelectedId + "'";
                    updatestr.SetValue(strSql, i++);
                    strSql = @"update t_Y_Detail 
                        set bz='" + txt_Remark.Text + "',CreateDate=getdate(),flag='1' where itemid='" + strSelectedId + "' and statusid='1' and id='" + SelectedId + "'";
                    updatestr.SetValue(strSql, i++);
                }
                //新备注
                else
                {
                    strSql = @"update t_Y_FlowInfo 
                        set itemname='" + drop_ItemName.SelectedValue + "',accessremark='" + txt_Remark.Text + "',StatusID='2' ,wtdw='" + txt_wtdw.Text.Trim() + "',lxman='" + txt_man.Text.Trim() + "',lxtel='" + txt_tel.Text.Trim() + "' ,ckflag=" + flag + "   where id='" + strSelectedId + "'";
                    updatestr.SetValue(strSql, i++);
                    strSql = @"insert into t_Y_Detail
                                    (itemid,statusid,userid,CreateDate,bz,flag)  
                                    values('" + strSelectedId + "','1','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate(),'" + txt_Remark.Text + "','1')";
                    updatestr.SetValue(strSql, i++);
                }
                MyDataOp mdo4      = new MyDataOp(strSql);
                bool     blSuccess = mdo4.DoTran(i, updatestr);
                if (blSuccess == true)
                {
                    WebApp.Components.Log.SaveLogY("项目受理中编辑项目信息(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 1);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true);
                }
                else
                {
                    WebApp.Components.Log.SaveLogY("项目受理中编辑项目信息(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 1);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true);
                }
            }
        }

        #endregion
        Query();
    }
    protected void btn_OKAnalysis_Click(object sender, EventArgs e)
    {
        string        retstr   = "";
        List <string> namelist = new List <string>();

        namelist = getnum(lbl_sample.Text, ref retstr);
        if (retstr != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('" + retstr + "');", true);
            return;
        }
        int sampleNum = namelist.Count;;

        //自动通过样品编号计算
        if (sampleNum == 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
            WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        else
        {
            try
            {
                if (int.Parse(txt_num.Text.Trim()) != sampleNum)
                {
                    if (int.Parse(txt_num.Text.Trim()) != 0)
                    {
                        sampleNum = int.Parse(txt_num.Text.Trim());
                    }

                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
                        WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                        return;
                    }
                }
                else
                {
                    int      selectnum = 0;
                    string   str       = "";
                    int      M         = cb_analysisList.Items.Count;
                    string[] liststr   = new string[M + 1 + M * sampleNum];
                    int      i         = 0;
                    //更新样品单表
                    liststr.SetValue("update t_M_SampleInfor set snum='" + sampleNum + "' where id='" + strSelectedId + "'", i++);
                    foreach (ListItem LI in cb_analysisList.Items)
                    {
                        if (LI.Selected)
                        {
                            selectnum++;
                            //分析项目表
                            str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                            DataSet dscheck = new MyDataOp(str).CreateDataSet();
                            if (dscheck.Tables[0].Rows.Count <= 0)
                            {
                                str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + LI.Value + "','" + sampleNum + "')";
                                liststr.SetValue(str, i++);
                            }
                            else
                            {
                                str = "update t_M_MonitorItem set Num='" + sampleNum + "' where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                                liststr.SetValue(str, i++);
                            }
                            dscheck.Dispose();
                            //string strcheckup = "Delete from t_MonitorItemDetail where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";
                            //liststr.SetValue(strcheckup, i++);
                            for (int j = 0; j < sampleNum; j++)
                            {
                                string    strcheck      = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[j] + "' and MonitorItem='" + LI.Value + "' ";
                                DataSet   dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                DataRow[] seldr         = dsdetialcheck.Tables[0].Select(" SampleID<>'" + strSelectedId + "'");
                                if (seldr.Length <= 0)
                                {
                                    DataRow[] checkdr = dsdetialcheck.Tables[0].Select(" SampleID='" + strSelectedId + "'");
                                    if (checkdr.Length <= 0)
                                    {
                                        str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo,createdate,createuser) values('" + strSelectedId + "','" + LI.Value + "','" + namelist[j] + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                                        liststr.SetValue(str, i++);
                                    }
                                }
                                else
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品重复,请检查!');", true);
                                    WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品重复,请检查!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                            DataSet dscheck = new MyDataOp(str).CreateDataSet();
                            if (dscheck.Tables[0].Rows.Count > 0)
                            {
                                str = "delete from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                                liststr.SetValue(str, i++);
                                string strcheckup = "Delete from t_MonitorItemDetail where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                                liststr.SetValue(strcheckup, i++);
                            }
                            dscheck.Dispose();
                        }
                    }
                    if (selectnum == 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请选择分析项目!');", true);
                        return;
                    }
                    else
                    {
                        MyDataOp OpObj = new MyDataOp(str);
                        if (OpObj.DoTran(i, liststr))
                        {
                            bool detailret = true;
                            if (txt_own.Text.Trim() != "")
                            {
                                string   strown   = txt_own.Text.Trim();
                                string[] strlist  = strown.Split(',', ',');
                                string[] liststr2 = new string[strlist.Length + 1];
                                for (int j = 0; j < strlist.Length; j++)
                                {
                                    if (strlist[j].ToString().Trim() != "")
                                    {
                                        str = "select id,AIName from t_M_AnalysisItem where AIName='" + strlist[j].ToString() + "'";

                                        DataSet dscheck = new MyDataOp(str).CreateDataSet();
                                        if (dscheck.Tables[0].Rows.Count > 0)
                                        {
                                            str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + sampleNum + "')";
                                            liststr2.SetValue(str, i++);
                                            for (int m = 0; m < sampleNum; m++)
                                            {
                                                string    strcheck      = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[m] + "' and MonitorItem='" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "' ";
                                                DataSet   dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                                DataRow[] seldr         = dsdetialcheck.Tables[0].Select(" SampleID<>'" + strSelectedId + "'");
                                                if (seldr.Length <= 0)
                                                {
                                                    DataRow[] checkdr = dsdetialcheck.Tables[0].Select(" SampleID='" + strSelectedId + "'");
                                                    if (checkdr.Length <= 0)
                                                    {
                                                        str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo,createdate,createuser) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + namelist[m] + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                                                        liststr2.SetValue(str, i++);
                                                    }
                                                }
                                                else
                                                {
                                                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品重复,请检查!');", true);
                                                    WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品重复,请检查!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                                    return;
                                                }
                                            }
                                            //for (int m = 0; m < sampleNum; m++)
                                            //{
                                            //    string strcheck = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[m] + "' and  SampleID!='" + strSelectedId + "'";
                                            //    DataSet dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                            //    if (dsdetialcheck.Tables[0].Rows.Count <= 0)
                                            //    {
                                            //        string strcheckup = "Delete from t_MonitorItemDetail where SampleID='" + strSelectedId + "'";
                                            //        liststr2.SetValue(strcheckup, i++);

                                            //        str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + namelist[m] + "')";
                                            //        liststr2.SetValue(str, i++);

                                            //    }
                                            //    else
                                            //    {
                                            //        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不能重复!');", true);
                                            //        Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不能重复!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                            //        return;
                                            //    }
                                            //}
                                        }
                                        else
                                        {
                                            str = @"insert into t_M_AnalysisItem
                    (ClassID,AIName,AICode)  
                    values('1','" + strlist[j] + "','" + strlist[j] + "')";
                                            MyDataOp mdo       = new MyDataOp(str);
                                            bool     blSuccess = mdo.ExecuteCommand();
                                            if (blSuccess == true)
                                            {
                                                DataSet myDR = new MyDataOp("select id from t_M_AnalysisItem where AIName='" + strlist[j] + "'").CreateDataSet();

                                                if (myDR.Tables[0].Rows.Count > 0)
                                                {
                                                    string itemname = myDR.Tables[0].Rows[0]["id"].ToString();
                                                    myDR.Dispose();
                                                    str = @"insert into t_M_MonitorItem
                    (SampleID,MonitorItem,Num,UserID,CreateDate)  
                    values('" + strSelectedId + "','" + itemname + "','" + sampleNum + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate())";
                                                    liststr2.SetValue(str, i++);
                                                    for (int m = 0; m < sampleNum; m++)
                                                    {
                                                        string    strcheck      = "select SampleNo,SampleID from t_MonitorItemDetail where SampleNo='" + namelist[m] + "' and MonitorItem='" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "' ";
                                                        DataSet   dsdetialcheck = new MyDataOp(strcheck).CreateDataSet();
                                                        DataRow[] seldr         = dsdetialcheck.Tables[0].Select(" SampleID<>'" + strSelectedId + "'");
                                                        if (seldr.Length <= 0)
                                                        {
                                                            DataRow[] checkdr = dsdetialcheck.Tables[0].Select(" SampleID='" + strSelectedId + "'");
                                                            if (checkdr.Length <= 0)
                                                            {
                                                                str = "insert into t_MonitorItemDetail(SampleID,MonitorItem,SampleNo,createdate,createuser) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + namelist[m] + "',getdate(),'" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "')";
                                                                liststr2.SetValue(str, i++);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品重复,请检查!');", true);
                                                            WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品重复,请检查!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                                            return;
                                                        }
                                                    }
                                                }
                                            }
                                        }


                                        dscheck.Dispose();
                                    }
                                }
                                MyDataOp OpObj2 = new MyDataOp(str);
                                detailret = OpObj.DoTran(i, liststr);
                            }
                            if (detailret)
                            {
                                WebApp.Components.Log.SaveLog("样品接收添加分析项目" + strSampleId + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);

                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存成功!');", true);
                                DataBindAll();
                                txt_own.Text = "";
                            }
                            else
                            {
                                WebApp.Components.Log.SaveLog("样品接收添加分析项目" + strSampleId + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存失败!');", true);
                            }
                        }
                    }
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
                WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            }



            Query();
        }
    }
    protected void btn_SampleSave_Click(object sender, EventArgs e)
    {
        string        retstr   = "";
        List <string> namelist = new List <string>();

        namelist = getnum(lbl_sample.Text, ref retstr);
        if (retstr != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('" + retstr + "');", true);
            return;
        }
        int sampleNum = namelist.Count;;  //自动通过样品编号计算

        try
        {
            if (int.Parse(txt_num.Text.Trim()) != sampleNum)
            {
                if (int.Parse(txt_num.Text.Trim()) != 0)
                {
                    sampleNum = int.Parse(txt_num.Text.Trim());
                }

                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);
                    WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                }
            }



            string   str     = "";
            int      M       = cb_analysisList.Items.Count;
            string[] liststr = new string[M + 1];
            int      i       = 0;
            liststr.SetValue("update t_M_SampleInfor set snum='" + sampleNum + "' where id='" + strSelectedId + "'", i++);
            foreach (ListItem LI in cb_analysisList.Items)
            {
                if (LI.Selected)
                {
                    str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                    DataSet dscheck = new MyDataOp(str).CreateDataSet();
                    if (dscheck.Tables[0].Rows.Count <= 0)
                    {
                        str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + LI.Value + "','" + sampleNum + "')";
                        liststr.SetValue(str, i++);
                    }
                    else
                    {
                        str = "update t_M_MonitorItem set Num='" + sampleNum + "' where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                        liststr.SetValue(str, i++);
                    }
                    dscheck.Dispose();
                }
                else
                {
                    str = "select MonitorItem from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "' ";

                    DataSet dscheck = new MyDataOp(str).CreateDataSet();
                    if (dscheck.Tables[0].Rows.Count > 0)
                    {
                        str = "delete from t_M_MonitorItem where SampleID='" + strSelectedId + "' and MonitorItem='" + LI.Value + "'";
                        liststr.SetValue(str, i++);
                    }
                    dscheck.Dispose();
                }
            }
            if (txt_own.Text.Trim() != "")
            {
                string   strown  = txt_own.Text.Trim();
                string[] strlist = strown.Split(',', ',');
                for (int j = 0; j < strlist.Length; j++)
                {
                    if (strlist[j].ToString().Trim() != "")
                    {
                        str = "select id,AIName from t_M_AnalysisItem where AIName='" + strlist[j].ToString() + "'";

                        DataSet dscheck = new MyDataOp(str).CreateDataSet();
                        if (dscheck.Tables[0].Rows.Count > 0)
                        {
                            str = "insert into t_M_MonitorItem(SampleID,MonitorItem,Num) values('" + strSelectedId + "','" + dscheck.Tables[0].Rows[0][0].ToString().Trim() + "','" + sampleNum + "')";
                            liststr.SetValue(str, i++);
                        }
                        else
                        {
                            str = @"insert into t_M_AnalysisItem
                    (ClassID,AIName,AICode)  
                    values('1','" + strlist[j] + "','" + strlist[j] + "')";
                            MyDataOp mdo       = new MyDataOp(str);
                            bool     blSuccess = mdo.ExecuteCommand();
                            if (blSuccess == true)
                            {
                                DataSet myDR = new MyDataOp("select id from t_M_AnalysisItem where AIName='" + strlist[j] + "'").CreateDataSet();

                                if (myDR.Tables[0].Rows.Count > 0)
                                {
                                    string itemname = myDR.Tables[0].Rows[0]["id"].ToString();
                                    myDR.Dispose();
                                    str = @"insert into t_M_MonitorItem
                    (SampleID,MonitorItem,Num,UserID,CreateDate)  
                    values('" + strSelectedId + "','" + itemname + "','" + sampleNum + "','" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "',getdate())";
                                    liststr.SetValue(str, i++);
                                }
                            }
                        }
                        dscheck.Dispose();
                    }
                }
            }
            str = "select * from t_M_MonitorItem where SampleID='" + strSelectedId + "'";
            DataSet ds = new MyDataOp(str).CreateDataSet();
            if (ds.Tables[0].Rows.Count > 0)
            {
                str = "update t_M_SampleInfor set StatusID=1 where id='" + strSelectedId + "'";

                liststr.SetValue(str, i++);
                MyDataOp OpObj = new MyDataOp(str);
                if (OpObj.DoTran(i, liststr))
                {
                    WebApp.Components.Log.SaveLog("样品接收添加分析项目" + lbl_sample.Text + "(" + strSelectedId + ")成功!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存成功!');", true);
                    DataBindAll();
                    txt_own.Text = "";
                }
                else
                {
                    WebApp.Components.Log.SaveLog("样品接收添加分析项目" + lbl_sample.Text + "(" + strSelectedId + ")失败!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据保存失败!');", true);
                }
                ds.Dispose();
            }
            else
            {
                WebApp.Components.Log.SaveLog("样品接收添加分析项目" + lbl_sample.Text + "(" + strSelectedId + ")未保存分析项目时提交!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请添加分析项目!再提交');", true);
            }
        }
        catch
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('样品编号不符合规定!');", true);

            WebApp.Components.Log.SaveLog("样品接收编辑样品" + strSampleId + "(" + strSelectedId + ")样品编号不符合规定!!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
        }
        Query();
        //queryAnalysisItem();
    }
Пример #30
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        #region 当按钮文字为“确定”时,执行添加或编辑操作
        //合法性校验
        //string strErrorInfo = Verify();
        //if (strErrorInfo != "")
        //{
        //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert(\"" + strErrorInfo + "\");", true);
        //    return;
        //}
        string strSql = "";
        #region
        string[] strInsert = new string[100];
        string   sql       = "";
        int      j         = 0;

        string  strEquipment = @"select * from t_chart_item";
        DataSet dse          = new MyDataOp(strEquipment).CreateDataSet();
        int     level        = 0;

        foreach (GridViewRow gr in GridView1.Rows)
        {
            DataRow [] dr = dse.Tables[0].Select("id='" + gr.Cells[1].Text.Trim() + "'");
            if (dr.Length > 0)
            {
                //foreach (DataRow dr in dse.Tables[0].Rows)
                //{
                int    Flag       = 0;
                string straddress = dr[0]["address"].ToString();

                CheckBox savecheckbox = (CheckBox)gr.FindControl("CheckBox");
                TextBox  savetextbox  = (TextBox)gr.FindControl("TextBox");
                //选中的设备
                if (savecheckbox.Checked)
                {
                    int x;
                    int y;
                    x = int.Parse(dr[0]["x"].ToString());
                    y = int.Parse(dr[0]["y"].ToString());
                    int    h       = int.Parse(dr[0]["h"].ToString());
                    int    w       = int.Parse(dr[0]["w"].ToString());
                    string address = dr[0]["address"].ToString();
                    sql = "select * from t_chart_main where  type='" + strSelectedId + "' and pid='" + gr.Cells[1].Text.Trim() + "'";
                    DataSet ds = new MyDataOp(sql).CreateDataSet();
                    if (ds.Tables[0].Rows.Count <= 0)
                    {
                        strSql = @"Insert into t_chart_main(type,pid,name,x,y,h,w,address)values('" + strSelectedId + "','" + gr.Cells[1].Text.Trim() + "','" + gr.Cells[2].Text.Trim() + "','" + x + "','" + y + "','" + h + "','" + w + "','" + address + "')";
                        strInsert.SetValue(strSql, j++);
                    }
                }
                //  没有选中的设备
                else
                {
                    sql = "select * from t_chart_main where  type='" + strSelectedId + "' and pid='" + gr.Cells[1].Text.Trim() + "'";
                    DataSet ds = new MyDataOp(sql).CreateDataSet();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        sql = "Delete from t_chart_main where type='" + strSelectedId + "' and pid='" + gr.Cells[1].Text.Trim() + "' ";
                        strInsert.SetValue(sql, j++);
                    }
                }
            }
        }

        if (j > 0)
        {
            MyDataOp mdo       = new MyDataOp(strSql);
            bool     blSuccess = mdo.DoTran(j, strInsert);
            if (blSuccess == true)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('保存成功!');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('保存失败!');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请选择图片!');", true);
        }

        #endregion


        #endregion
    }