Exemple #1
0
 private void ShowInfo(int id)
 {
     Maticsoft.BLL.Department   bll   = new Maticsoft.BLL.Department();
     Maticsoft.Model.Department model = bll.GetModel(id);
     this.lblid.Text             = model.id.ToString();
     this.lbldepartmentname.Text = model.departmentname;
     this.lblBeizhu.Text         = model.Beizhu;
     this.lblBY1.Text            = model.BY1.ToString();
     this.lblBY2.Text            = model.BY2.ToString();
     this.lblBY3.Text            = model.BY3.ToString();
     this.lblBY4.Text            = model.BY4;
     this.lblBY5.Text            = model.BY5;
     this.lblBY6.Text            = model.BY6;
     this.lblBY7.Text            = model.BY7;
 }
Exemple #2
0
        /// <summary>
        /// 获取部门列表
        /// </summary>
        /// <returns></returns>
        public ActionResult DepartmentItem(int page = 1, string SearchName = "")
        {
            Maticsoft.BLL.Department          BDepartment     = new Maticsoft.BLL.Department();
            List <Maticsoft.Model.Department> MDepartmentList = new List <Maticsoft.Model.Department>();
            int    pagecount = 0;
            string strWhere  = " ID>0  ";

            if (SearchName != "")
            {
                strWhere += " and Name like '%" + SearchName + "%'";
            }
            string  strorder = "IsActive Desc,PreID asc,Display asc";
            int     pageSize = 20;
            DataSet ds       = BDepartment.GetListByPage(strWhere, strorder, ((page - 1) * pageSize + 1), page * pageSize);//分页获取到数据

            pagecount = BDepartment.GetRecordCount(strWhere);
            if (ds != null)
            {
                MDepartmentList         = BDepartment.DataTableToList(ds.Tables[0]); //把datatable转化成List
                ViewData["currentpage"] = page;                                      //当前页码
                ViewData["pagecount"]   = pagecount;
            }
            return(View(MDepartmentList));
        }
Exemple #3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtdepartmentname.Text.Trim().Length == 0)
            {
                strErr += "departmentname不能为空!\\n";
            }
            if (this.txtBeizhu.Text.Trim().Length == 0)
            {
                strErr += "Beizhu不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtBY1.Text))
            {
                strErr += "BY1格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtBY2.Text))
            {
                strErr += "BY2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtBY3.Text))
            {
                strErr += "BY3格式错误!\\n";
            }
            if (this.txtBY4.Text.Trim().Length == 0)
            {
                strErr += "BY4不能为空!\\n";
            }
            if (this.txtBY5.Text.Trim().Length == 0)
            {
                strErr += "BY5不能为空!\\n";
            }
            if (this.txtBY6.Text.Trim().Length == 0)
            {
                strErr += "BY6不能为空!\\n";
            }
            if (this.txtBY7.Text.Trim().Length == 0)
            {
                strErr += "BY7不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int     id             = int.Parse(this.lblid.Text);
            string  departmentname = this.txtdepartmentname.Text;
            string  Beizhu         = this.txtBeizhu.Text;
            decimal BY1            = decimal.Parse(this.txtBY1.Text);
            decimal BY2            = decimal.Parse(this.txtBY2.Text);
            decimal BY3            = decimal.Parse(this.txtBY3.Text);
            string  BY4            = this.txtBY4.Text;
            string  BY5            = this.txtBY5.Text;
            string  BY6            = this.txtBY6.Text;
            string  BY7            = this.txtBY7.Text;


            Maticsoft.Model.Department model = new Maticsoft.Model.Department();
            model.id             = id;
            model.departmentname = departmentname;
            model.Beizhu         = Beizhu;
            model.BY1            = BY1;
            model.BY2            = BY2;
            model.BY3            = BY3;
            model.BY4            = BY4;
            model.BY5            = BY5;
            model.BY6            = BY6;
            model.BY7            = BY7;

            Maticsoft.BLL.Department bll = new Maticsoft.BLL.Department();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }