Ejemplo n.º 1
0
        public void Dispose()
        {
            SalaryRecordManager.RemoveAll();
            AssessmentManager.RemoveAll();
            EmployeeManager.RemoveAll();
            DepartmentManager.RemoveAll();

            PostManager.RemoveAll();
            LevelManager.RemoveAll();
            PerformanceManager.RemoveAll();
            BenefitManager.RemoveAll();
            try
            {
                FileInfo file   = new FileInfo("../../TestUnint.sql");
                string   script = file.OpenText().ReadToEnd();

                SystemDB db = new SystemDB();

                db.Database.ExecuteSqlCommand(script);
            }
            catch (Exception e)
            {
                Trace.WriteLine(Model.Utility.Utility.GetExceptionMsg(e));
            }
        }
 public EmployeeController()
 {
     this._employeeManager = new EmployeeManager();
     this._employeeDependentManager = new EmployeeDependentManager(this._employeeManager);
     this._benefitManager = new BenefitManager(this._employeeDependentManager);
     this._discountManager = new DiscountManager(this._benefitManager);
 }
Ejemplo n.º 3
0
        public ActionResult GetAllEntities()
        {
            OperateResult or = BenefitManager.GetAll();

            if (or.status == OperateStatus.Success &&
                or.data != null)
            {
                return(Json(or.data, JsonRequestBehavior.AllowGet));
            }


            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public ActionResult GetEntities(Pager pager)
        {
            OperateResult or = BenefitManager.GetByPager(new QueryParam {
                pager = pager
            });

            if (or.status == OperateStatus.Success &&
                or.data != null)
            {
                return(Json(or.data, JsonRequestBehavior.AllowGet));
            }

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public ActionResult EditEntity(BenefitInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(
                           new OperateResult
                {
                    content = Model.Utility.GetModelStateErrors(ModelState),
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = BenefitManager.Update(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "访问错误",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = BenefitManager.GetById(id.Value);

            return(View(or.data));
        }
Ejemplo n.º 7
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "访问错误",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = BenefitManager.Remove(id.Value);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
        public ActionResult CreateEntity(BenefitInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(
                           new OperateResult
                {
                    content = Model.Utility.GetModelStateErrors(ModelState),
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            BenefitManager manager = new BenefitManager();

            OperateResult or = manager.Add(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        public bool BenefitAddStub()
        {
            for (var i = 0; i < BenefitStubSize; i++)
            {
                BenefitInfo e = new BenefitInfo();

                e.code           = "B-" + i;
                e.benefitRewards = 2000 + i * 500;

                OperateResult or = BenefitManager.Add(e);
                if (or.status == OperateStatus.Error)
                {
                    StackTrace st  = new StackTrace(new StackFrame(true));
                    string     msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " +
                                     $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}";
                    Trace.WriteLine(msg);
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 10
0
 public void Setup()
 {
     _benefitManager = new BenefitManager();
 }