Ejemplo n.º 1
0
        public ActionResult QueryData()
        {
            try
            {
                int    page    = Request.Form["page"] != "" ? Convert.ToInt32(Request.Form["page"]) : 0;
                int    size    = Request.Form["rows"] != "" ? Convert.ToInt32(Request.Form["rows"]) : 0;
                string sort    = Request.Form["sort"] != "" ? Request.Form["sort"] : "";
                string order   = Request.Form["order"] != "" ? Request.Form["order"] : "";
                string Name    = Request.Form["Name"] != null ? Request.Form["Name"] : "";
                string szEmpNo = WebCookieHelper.GetEmployeeInfo(2);
                if (page < 1)
                {
                    return(Content(""));
                }

                int totalCount = 0;

                var result = EnterRepository.GetRepositoryEnter().DrugPurchaseRepository.LoadPageList(Name, (page - 1) * size, size, szEmpNo, out totalCount).ToList();
                return(Json(new
                {
                    total = totalCount,
                    rows = result
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);
                throw;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            if (!WebCookieHelper.EmployeeCheckLogin())
            {
                return(Redirect("/Admin/Account/Login"));
            }

            ViewBag.Name = WebCookieHelper.GetEmployeeInfo((int)WebCookieHelper.EmployeeInfo.Name);
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult UpdateData(DrugPurchase model)
        {
            try
            {
                string szEmpNo = WebCookieHelper.GetEmployeeInfo(2);
                model.CreateEmpNo = szEmpNo;
                model.CreateTime  = DateTime.Now;
                bool blResult = false;
                int  id       = Request.Form["id"] != "" ? Convert.ToInt32(Request.Form["id"]) : 0;
                //DrugPurchase model = GetData(id);

                string writeMsg = "操作失败!";
                if (model != null)
                {
                    if (model.ID < 1)
                    {
                        EnterRepository.GetRepositoryEnter().DrugPurchaseRepository.AddEntity(model);
                        if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                        {
                            writeMsg = "增加成功!";
                        }
                        else
                        {
                            writeMsg = "增加失败!";
                        }
                    }
                    else
                    {
                        //清楚context中result对象
                        EnterRepository.GetRepositoryEnter().DrugPurchaseRepository.Get(m => m.ID == id);
                        EnterRepository.GetRepositoryEnter().DrugPurchaseRepository.EditEntity(model, new string[] { "DrugID", "PurchaseDate", "Supplier", "Specification", "Amount", "Unit", "Factory", "Batch", "ValidityTerm", "License", "InspectionReport", "Instructions", "Quality", "AcceptanceConclusion", "Buyer", "Examiner" });
                        if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                        {
                            writeMsg = "更新成功!";
                        }
                        else
                        {
                            writeMsg = "更新失败!";
                        }
                    }
                }
                return(Content(writeMsg));
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);
                throw;
            }
        }
Ejemplo n.º 4
0
        public ActionResult QueryEmployeeIDs()
        {
            try
            {
                if (!WebCookieHelper.EmployeeCheckLogin())
                {
                    return(RedirectToAction("Admin/Account/Login"));
                }
                JsonHelper json    = new JsonHelper();
                string     strJson = string.Empty;
                json.AddItem("id", "");
                json.AddItem("text", "所有");
                json.ItemOk();

                int    empid = WebCookieHelper.GetEmployeeId();
                string Name  = WebCookieHelper.GetEmployeeInfo((int)WebCookieHelper.EmployeeInfo.Name);
                if (!RightServices.CheckAuthority(SystemContext.RightPoint.ViewAllUsers, empid))
                {
                    json.AddItem("id", empid.ToString());
                    json.AddItem("text", Name);
                    json.ItemOk();
                }
                else
                {
                    var result = UsersServices.GetStaffEmployee(empid);
                    foreach (Employee item in result)
                    {
                        json.AddItem("id", item.ID.ToString());
                        json.AddItem("text", item.Name);
                        json.ItemOk();
                    }
                }
                strJson = json.ToEasyuiListJsonString();
                return(Content(strJson));
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);
                throw;
            }
        }