예제 #1
0
 public vDepartment(Department department)
 {
     this.ID = department.ID;
     this.DepartmentName = department.DepartmentName;
     this.Remark = department.Remark;
     this.IsDelete = department.IsDelete;
     this.AddTime = department.AddTime.ToString();
 }
예제 #2
0
        /// <summary>
        /// 执行部门增加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult DoAdd(Department model)
        {
            AjaxModel ajaxModel = new AjaxModel();

            try
            {
                IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL;
                model.IsDelete = false;
                model.AddTime = DateTime.Now;
                bll.Add(model);
                ajaxModel.Statu = "ok";
                ajaxModel.Msg = "增加成功";
                ajaxModel.BackUrl = "/Admin/Department/Index";
            }
            catch
            {
                ajaxModel.Statu = "err";
                ajaxModel.Msg = "增加失败";
            }
            return Json(ajaxModel);
        }
예제 #3
0
        /// <summary>
        /// 执行修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult DoUpdate(Department model)
        {
            Department department = new Department();
            AjaxModel ajaxModel = new AjaxModel();
            try
            {
                IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL;
                department = bll.GetListBy(d => d.ID == model.ID).SingleOrDefault();
                department.DepartmentName = model.DepartmentName;
                department.Remark = model.Remark;
                bll.Modify(department, "DepartmentName", "Remark");
                ajaxModel.Statu = "ok";
                ajaxModel.Msg = "修改成功!";
                ajaxModel.BackUrl = "/Admin/Department/Index";
            }
            catch
            {
                ajaxModel.Statu = "err";
                ajaxModel.Msg = "修改失败!";
            }

            return Json(ajaxModel);
        }
예제 #4
0
 public ActionResult Update(int id)
 {
     Department department = new Department();
     IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL;
     department = bll.GetListBy(d => d.ID == id).SingleOrDefault();
     ViewBag.Department = department;
     return View();
 }