예제 #1
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
            // return;
        }
        else
        {
            string compay = "0";
            string cyman  = "0";

            ////获取采样人,现场分析人
            //DAl.User.Users userobj = new DAl.User.Users();
            //Entity.User.Users user = null;//= new Entity.User.Users();
            //user = userobj.GetUsers(txt_xmfzr.Text.Trim());
            //if (user != null)
            //{
            //    cyman = user.UserID.ToString();
            //}
            //else
            //{
            //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('系统不存在项目负责人/报告编制人,请核实!');", true);
            //    return;
            //}
            Entity.AccessReport entity = new Entity.AccessReport();
            entity.classID = int.Parse(drop_rwtype.SelectedValue.ToString()); //任务类型
            if (entity.classID == 1)                                          //委托任务
            {
                DAl.Station stationobj = new DAl.Station();
                DataTable   dtstation  = stationobj.GetStationByName(txt_wtdepart.Text.Trim());

                if (dtstation.Rows.Count > 0)
                {
                    compay = dtstation.Rows[0]["id"].ToString();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('系统不存在该委托单位,请核实!');", true);
                    return;
                }
                entity.WTMan   = compay;//委托单位
                entity.lxEmail = txt_lxemail.Text.Trim();
                entity.lxMan   = txt_lxman.Text.Trim();;
                entity.lxtel   = txt_lxtel.Text.Trim();;
                entity.address = txt_address.Text.Trim();
            }
            entity.CreateDate  = DateTime.Now;                                         //创建时间
            entity.CreateUser  = Request.Cookies["Cookies"].Values["u_id"].ToString(); //创建人
            entity.WTDate      = DateTime.Parse(txt_CreateDate.Text.Trim());           //委托日期,任务接收日期
            entity.chargeman   = cyman;                                                //项目负责人
            entity.level       = drop_level.SelectedValue.ToString();                  //紧急程度
            entity.Mode        = drop_mode.SelectedValue.ToString();                   //监测方式
            entity.Remark      = drop_urgent.Text.Trim();                              //备注
            entity.WTNO        = txt_ReportID.Text.Trim();                             //委托协议编码,报告标识
            entity.ProjectName = txt_Projectname.Text.Trim();                          //项目名称
            entity.TypeID      = int.Parse(drop_ItemList.SelectedValue.ToString().Trim());
            DAl.Report reportobj = new DAl.Report();
            entity.StatusID = 0;
            #region 添加新纪录
            if (strReportId == "" || strReportId == "0")
            {
                if (reportobj.AddYS(entity) == 1)
                {
                    btn_Save.Visible = true;
                    WebApp.Components.Log.SaveLog("创建任务单添加成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('任务创建成功!')", true);

                    //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据添加成功!')", true);
                }
                else
                {
                    WebApp.Components.Log.SaveLog("创建任务单添加失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "alert('数据添加失败!')", true);
                }
            }
            #endregion
            else
            {
                entity.ID = int.Parse(strReportId);
                if (reportobj.UpateYS(entity) == 1)
                {
                    WebApp.Components.Log.SaveLog("创建任务单编辑成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据保存成功!')", true);
                }
                else
                {
                    WebApp.Components.Log.SaveLog("创建任务单编辑失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "hiddenDetail();alert('数据添保存失败!')", true);
                }
            }
        }
        Query();
    }
예제 #2
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        string strFlag = Verify();

        if (strFlag != "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true);
            return;
        }
        else
        {
            string compay = "0";
            string cyman  = "0";

            Entity.AccessReport entity = new Entity.AccessReport();
            entity.classID = int.Parse(drop_rwtype.SelectedValue.ToString());//任务类型

            compay = txt_wtdepart.Text.Trim();

            entity.WTMan   = compay;  //委托单位
            entity.lxEmail = txt_lxemail.Text.Trim();
            entity.lxMan   = txt_lxman.Text.Trim();;
            entity.lxtel   = txt_lxtel.Text.Trim();;
            entity.address = txt_address.Text.Trim();

            entity.CreateDate = DateTime.Now;                                         //创建时间
            entity.CreateUser = Request.Cookies["Cookies"].Values["u_id"].ToString(); //创建人
            entity.WTDate     = DateTime.Parse(txt_CreateDate.Text.Trim());           //委托日期,任务接收日期
            entity.chargeman  = cyman;                                                //项目负责人
            //entity.level = drop_level.SelectedValue.ToString();//紧急程度
            entity.Mode        = drop_mode.SelectedValue.ToString();                  //监测方式
            entity.Remark      = drop_urgent.Text.Trim();                             //备注
            entity.WTNO        = txt_ReportID.Text.Trim();                            //委托协议编码,报告标识
            entity.ProjectName = txt_Projectname.Text.Trim();                         //项目名称
            entity.TypeID      = int.Parse(drop_ItemList.SelectedValue.ToString().Trim());
            DAl.Report reportobj = new DAl.Report();
            entity.StatusID = 1;
            #region 添加新纪录
            if (strReportId == "" || strReportId == "0")
            {
                if (reportobj.AddYS(entity) == 1)
                {
                    WebApp.Components.Log.SaveLog("综合室受理提交成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('任务创建成功!')", true);

                    //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据添加成功!')", true);
                }
                else
                {
                    WebApp.Components.Log.SaveLog("综合室受理提交失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "alert('数据添加失败!')", true);
                }
            }
            #endregion
            else
            {
                entity.ID = int.Parse(strReportId);
                if (reportobj.UpateYS(entity) == 1)
                {
                    WebApp.Components.Log.SaveLog("综合室受理保存成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据保存成功!')", true);
                }
                else
                {
                    WebApp.Components.Log.SaveLog("综合室受理保存失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "hiddenDetail();alert('数据添保存失败!')", true);
                }
            }
            //entity.ID=int.Parse(strReportId);
            //           if (reportobj.UpateYS(entity)==1)

            //           {
            //               WebApp.Components.Log.SaveLog("创建样品原单编辑成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            //               ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据保存成功!')", true);


            //           }
            //           else
            //           {
            //               WebApp.Components.Log.SaveLog("创建样品原单编辑失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5);
            //               ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "hiddenDetail();alert('数据添保存失败!')", true);

            //           }
        }
        Query();
    }