Example #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void OnStart()
        {
            if (CMD == "New")
            {
                HiddenDisp();
            }
            else if (CMD == "Edit")
            {
                HeadMenuButtonItem bi2 = new HeadMenuButtonItem();
                bi2.ButtonPopedom = PopedomType.Delete;
                bi2.ButtonName    = "信息"; //需要改
                bi2.ButtonUrlType = UrlType.JavaScript;
                bi2.ButtonUrl     = string.Format("DelData('?CMD=Delete&InfoID={0}')", InfoID);
                HeadMenuWebControls1.ButtonList.Add(bi2);

                HiddenDisp();
                InputData();
            }
            else if (CMD == "Delete")
            {
                //这是操作数据库的核心代码,工作原理是:首先要明确现在所操作的模块对应着数据库中的哪张表,然后创建这个表所对应的的逻辑处理层(bll)对象,如这里操作的表是supervision_Info,则要新建所对应的Maticsoft.BLL.supervision_Info对象
                Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
                //这是数据库实体类对象(简单来说就对应着这个表的一条记录),因为这里操作的表是supervision_Info,则对应的model是Maticsoft.Model.supervision_Info,然后通过上一行new的bll对象去执行数据库操作(这里使用的方法是GetModel,当然还有其他的方法,根据需要使用不同的方法),返回对应实体类对象
                Maticsoft.Model.supervision_Info model = bll.GetModel(InfoID);
                //bll执行删除操作,参数是这个实体类的ID值
                bll.Delete(model.InfoID);
                //以下方法的第4、5个参数需要更改
                EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", InfoID, "删除信息"), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
            }
        }
Example #2
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.supervision_Info supervision = new Maticsoft.BLL.supervision_Info();
            Maticsoft.Model.supervision_Info supervision_Info = supervision.GetModel(InfoID);
            if (supervision_Info == null)
            {
                supervision_Info = new Maticsoft.Model.supervision_Info();
            }

            //获取客户端通过Post方式传递过来的值的(需要更改)
            supervision_Info.I_FindDate = (DateTime)Common.sink(this.I_FindDate.UniqueID, MethodType.Post, 255, 0, DataType.Dat);
            supervision_Info.I_Type = Convert.ToInt32(this.I_Type.SelectedValue);
            supervision_Info.I_Content = (string)Common.sink(this.I_Content.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            supervision_Info.I_ReportDate = (DateTime)Common.sink(this.I_ReportDate.UniqueID, MethodType.Post, 0, 0, DataType.Dat);
            supervision_Info.I_ReportUserID = Convert.ToInt32(this.I_ReportUserID.Value);

            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    //如果是增加操作,就调用Add方法
                    supervision.Add(supervision_Info);
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    //如果是修改操作,就调用Update方法
                    supervision.Update(supervision_Info);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            //以下方法的第4个参数需要更改
                EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", InfoID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Example #3
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.supervision_Info   supervision      = new Maticsoft.BLL.supervision_Info();
            Maticsoft.Model.supervision_Info supervision_Info = supervision.GetModel(InfoID);
            if (supervision_Info == null)
            {
                supervision_Info = new Maticsoft.Model.supervision_Info();
            }

            //获取客户端通过Post方式传递过来的值的(需要更改)
            supervision_Info.I_FindDate     = (DateTime)Common.sink(this.I_FindDate.UniqueID, MethodType.Post, 255, 0, DataType.Dat);
            supervision_Info.I_Type         = Convert.ToInt32(this.I_Type.SelectedValue);
            supervision_Info.I_Content      = (string)Common.sink(this.I_Content.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            supervision_Info.I_ReportDate   = (DateTime)Common.sink(this.I_ReportDate.UniqueID, MethodType.Post, 0, 0, DataType.Dat);
            supervision_Info.I_ReportUserID = Convert.ToInt32(this.I_ReportUserID.Value);

            switch (CMD)
            {
            case "New":
                CMD_Txt = "增加";
                //如果是增加操作,就调用Add方法
                supervision.Add(supervision_Info);
                break;

            case "Edit":
                CMD_Txt = "修改";
                //如果是修改操作,就调用Update方法
                supervision.Update(supervision_Info);
                break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            //以下方法的第4个参数需要更改
            EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", InfoID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Example #4
0
 private void ShowInfo(int InfoID)
 {
     Maticsoft.BLL.supervision_Info   bll   = new Maticsoft.BLL.supervision_Info();
     Maticsoft.Model.supervision_Info model = bll.GetModel(InfoID);
     this.lblInfoID.Text         = model.InfoID.ToString();
     this.txtI_FindDate.Text     = model.I_FindDate.ToString();
     this.txtI_Type.Text         = model.I_Type.ToString();
     this.txtI_Content.Text      = model.I_Content;
     this.txtI_ReportDate.Text   = model.I_ReportDate.ToString();
     this.txtI_ReportUserID.Text = model.I_ReportUserID.ToString();
 }
Example #5
0
 private void ShowInfo(int InfoID)
 {
     Maticsoft.BLL.supervision_Info bll=new Maticsoft.BLL.supervision_Info();
     Maticsoft.Model.supervision_Info model=bll.GetModel(InfoID);
     this.lblInfoID.Text=model.InfoID.ToString();
     this.lblI_FindDate.Text=model.I_FindDate.ToString();
     this.lblI_Type.Text=model.I_Type.ToString();
     this.lblI_Content.Text=model.I_Content;
     this.lblI_ReportDate.Text=model.I_ReportDate.ToString();
     this.lblI_ReportUserID.Text=model.I_ReportUserID.ToString();
 }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int InfoID = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(InfoID);
             Response.Redirect("list.aspx");
         }
     }
 }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Maticsoft.BLL.supervision_Info bll=new Maticsoft.BLL.supervision_Info();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int InfoID=(Convert.ToInt32(Request.Params["id"]));
             bll.Delete(InfoID);
             Response.Redirect("list.aspx");
         }
     }
 }
Example #8
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsDateTime(txtI_FindDate.Text))
            {
                strErr += "发现时间格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtI_Type.Text))
            {
                strErr += "信息类别格式错误!\\n";
            }
            if (this.txtI_Content.Text.Trim().Length == 0)
            {
                strErr += "信息内容不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtI_ReportDate.Text))
            {
                strErr += "报告时间格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtI_ReportUserID.Text))
            {
                strErr += "报告人格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      InfoID         = int.Parse(this.lblInfoID.Text);
            DateTime I_FindDate     = DateTime.Parse(this.txtI_FindDate.Text);
            int      I_Type         = int.Parse(this.txtI_Type.Text);
            string   I_Content      = this.txtI_Content.Text;
            DateTime I_ReportDate   = DateTime.Parse(this.txtI_ReportDate.Text);
            int      I_ReportUserID = int.Parse(this.txtI_ReportUserID.Text);


            Maticsoft.Model.supervision_Info model = new Maticsoft.Model.supervision_Info();
            model.InfoID         = InfoID;
            model.I_FindDate     = I_FindDate;
            model.I_Type         = I_Type;
            model.I_Content      = I_Content;
            model.I_ReportDate   = I_ReportDate;
            model.I_ReportUserID = I_ReportUserID;

            Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #9
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDateTime(txtI_FindDate.Text))
            {
                strErr+="发现时间格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtI_Type.Text))
            {
                strErr+="信息类别格式错误!\\n";
            }
            if(this.txtI_Content.Text.Trim().Length==0)
            {
                strErr+="信息内容不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtI_ReportDate.Text))
            {
                strErr+="报告时间格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtI_ReportUserID.Text))
            {
                strErr+="报告人格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int InfoID=int.Parse(this.lblInfoID.Text);
            DateTime I_FindDate=DateTime.Parse(this.txtI_FindDate.Text);
            int I_Type=int.Parse(this.txtI_Type.Text);
            string I_Content=this.txtI_Content.Text;
            DateTime I_ReportDate=DateTime.Parse(this.txtI_ReportDate.Text);
            int I_ReportUserID=int.Parse(this.txtI_ReportUserID.Text);

            Maticsoft.Model.supervision_Info model=new Maticsoft.Model.supervision_Info();
            model.InfoID=InfoID;
            model.I_FindDate=I_FindDate;
            model.I_Type=I_Type;
            model.I_Content=I_Content;
            model.I_ReportDate=I_ReportDate;
            model.I_ReportUserID=I_ReportUserID;

            Maticsoft.BLL.supervision_Info bll=new Maticsoft.BLL.supervision_Info();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Example #10
0
        /// <summary>
        /// 在编辑的时候将对应的值绑定到Label上
        /// </summary>
        private void InputData()
        {
            //这两句和73、75作用一样
            Maticsoft.BLL.supervision_Info   bll   = new Maticsoft.BLL.supervision_Info();
            Maticsoft.Model.supervision_Info model = bll.GetModel(InfoID);

            //以下几行需要更改
            this.I_FindDate.Text      = this.I_FindDate_Txt.Text = model.I_FindDate.ToShortDateString();
            this.I_Type.SelectedValue = model.I_Type + "";
            this.I_Type_Txt.Text      = getSuperisionNameByType(model.I_Type);
            this.I_Content.Text       = this.I_Content_Txt.Text = model.I_Content;
            this.I_ReportDate.Text    = this.I_ReportDate.Text = model.I_ReportDate.ToShortDateString();
            Maticsoft.BLL.sys_User   user_bll   = new Maticsoft.BLL.sys_User();
            Maticsoft.Model.sys_User user_model = user_bll.GetModel(model.I_ReportUserID);
            this.I_ReportUserID.Value        = user_model.UserID + "";
            this.I_ReportUserID_TextBox.Text = user_model.U_CName;
        }
Example #11
0
        /// <summary>
        /// 绑定列表数据
        /// </summary>
        private void BindData()
        {
            //排序
            string orderby = OrderType == 0 ? Orderfld + " asc" : Orderfld + " desc";
            //这一页开始的记录索引
            int startIndex = (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + 1;
            //这一页结束的记录索引
            int endIndex = this.AspNetPager1.CurrentPageIndex * this.AspNetPager1.PageSize;

            //需要更改
            Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
            //bll通过调用GetListByPage方法返回分页数据
            DataSet datas = bll.GetListByPage(SearchTerms, orderby, startIndex, endIndex);

            GridView1.DataSource = datas;
            GridView1.DataBind();
            //获取总记录数
            this.AspNetPager1.RecordCount = bll.GetRecordCount(SearchTerms);
        }
Example #12
0
        /// <summary>
        /// 绑定列表数据
        /// </summary>
        private void BindData()
        {
            //排序
            string orderby = OrderType == 0 ? Orderfld + " asc" : Orderfld + " desc";
            //这一页开始的记录索引
            int startIndex = (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + 1;
            //这一页结束的记录索引
            int endIndex = this.AspNetPager1.CurrentPageIndex * this.AspNetPager1.PageSize;
            Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();

            //bll通过调用GetListByPage方法返回分页数据
            DataSet datas = bll.GetListByPage(SearchTerms, orderby, startIndex, endIndex);
            GridView1.DataSource = datas;
            GridView1.DataBind();
            //获取总记录数
            this.AspNetPager1.RecordCount = bll.GetRecordCount(SearchTerms);
        }
Example #13
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.supervision_Inspect supervision_bll = new Maticsoft.BLL.supervision_Inspect();
            Maticsoft.Model.supervision_Inspect supervision_Inspect_model = supervision_bll.GetModel(InspectID);
            if (supervision_Inspect_model == null)
            {
                supervision_Inspect_model = new Maticsoft.Model.supervision_Inspect();
            }

            //获取客户端通过Post方式传递过来的值的
            supervision_Inspect_model.I_Date = (DateTime)Common.sink(this.I_Date.UniqueID, MethodType.Post, 255, 0, DataType.Dat);
            supervision_Inspect_model.I_Type = Convert.ToInt32(this.I_Type.SelectedValue);
            supervision_Inspect_model.I_Content = (string)Common.sink(this.I_Content.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            supervision_Inspect_model.I_Location = (string)Common.sink(this.I_Location.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            supervision_Inspect_model.I_MainProblem = (string)Common.sink(this.I_MainProblem.UniqueID, MethodType.Post, 0, 0, DataType.Str);
            supervision_Inspect_model.I_UserID = Convert.ToInt32(this.I_UserID.Value);

            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    supervision_Inspect_model.I_InfoID = InfoID;
                    //如果是增加操作,就调用Add方法
                    supervision_Inspect_model.InspectID = supervision_bll.Add(supervision_Inspect_model);
                    if (supervision_Inspect_model.InspectID > 0)
                    {
                        Maticsoft.BLL.supervision_Info supervision_Info_bll = new Maticsoft.BLL.supervision_Info();
                        Maticsoft.Model.supervision_Info supervision_Info_model = supervision_Info_bll.GetModel(InfoID);
                        supervision_Info_model.I_Status = 2;
                        supervision_Info_bll.Update(supervision_Info_model);
                    }
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    //如果是修改操作,就调用Update方法
                    supervision_bll.Update(supervision_Inspect_model);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", supervision_Inspect_model.InspectID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Example #14
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void OnStart()
        {
            if (CMD == "New")
            {
                HiddenDisp();
            }
            else if (CMD == "Edit")
            {
                HeadMenuButtonItem bi2 = new HeadMenuButtonItem();
                bi2.ButtonPopedom = PopedomType.Delete;
                bi2.ButtonName = "信息";  //需要改
                bi2.ButtonUrlType = UrlType.JavaScript;
                bi2.ButtonUrl = string.Format("DelData('?CMD=Delete&InfoID={0}')", InfoID);
                HeadMenuWebControls1.ButtonList.Add(bi2);

                HiddenDisp();
                InputData();
            }
            else if (CMD == "Delete")
            {
                //这是操作数据库的核心代码,工作原理是:首先要明确现在所操作的模块对应着数据库中的哪张表,然后创建这个表所对应的的逻辑处理层(bll)对象,如这里操作的表是supervision_Info,则要新建所对应的Maticsoft.BLL.supervision_Info对象
                Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
                //这是数据库实体类对象(简单来说就对应着这个表的一条记录),因为这里操作的表是supervision_Info,则对应的model是Maticsoft.Model.supervision_Info,然后通过上一行new的bll对象去执行数据库操作(这里使用的方法是GetModel,当然还有其他的方法,根据需要使用不同的方法),返回对应实体类对象
                Maticsoft.Model.supervision_Info model = bll.GetModel(InfoID);
                //bll执行删除操作,参数是这个实体类的ID值
                bll.Delete(model.InfoID);
                //以下方法的第4、5个参数需要更改
                EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", InfoID, "删除信息"), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
            }
        }
Example #15
0
        /// <summary>
        /// 在编辑的时候将对应的值绑定到Label上
        /// </summary>
        private void InputData()
        {
            //这两句和73、75作用一样
            Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
            Maticsoft.Model.supervision_Info model = bll.GetModel(InfoID);

            //以下几行需要更改
            this.I_FindDate.Text = this.I_FindDate_Txt.Text = model.I_FindDate.ToShortDateString();
            this.I_Type.SelectedValue = model.I_Type+"";
            this.I_Type_Txt.Text = getSuperisionNameByType(model.I_Type);
            this.I_Content.Text = this.I_Content_Txt.Text = model.I_Content;
            this.I_ReportDate.Text = this.I_ReportDate.Text = model.I_ReportDate.ToShortDateString();
            Maticsoft.BLL.sys_User user_bll = new Maticsoft.BLL.sys_User();
            Maticsoft.Model.sys_User user_model = user_bll.GetModel(model.I_ReportUserID);
            this.I_ReportUserID.Value = user_model.UserID + "";
            this.I_ReportUserID_TextBox.Text = user_model.U_CName;
        }
Example #16
0
        /// <summary>
        /// 在编辑的时候将对应的值绑定到Label上
        /// </summary>
        private void InputData()
        {
            //这两句和71、73作用一样
            Maticsoft.BLL.supervision_Info bll = new Maticsoft.BLL.supervision_Info();
            Maticsoft.Model.supervision_Info model = bll.GetModel(InfoID);

            //以下几行需要更改
            I_FindDate.Text = model.I_FindDate.ToShortDateString();
            I_Type.SelectedValue = model.I_Type+"";
            I_Content.Text = model.I_Content;
            I_ReportDate.Text = model.I_ReportDate.ToShortDateString();
            Maticsoft.BLL.sys_User user_bll = new Maticsoft.BLL.sys_User();
            Maticsoft.Model.sys_User user_model = user_bll.GetModel(model.I_ReportUserID);
            I_ReportUserID.Value = user_model.UserID + "";
            I_ReportUserID_input.Text = user_model.U_CName;
        }