Beispiel #1
0
        public ActionResult NewPriceApproveStep()
        {
            string strErrText;

            //读取价格审批步骤数据
            FlowSystem flow = new FlowSystem();
            List<ApproveFlowStep> listStep = flow.LoadApproveFlowStepsByFlowType(InnoSoft.LS.Resources.Options.PriceApproveFlow, LoginAccountId, LoginStaffName, out strErrText);
            if (listStep == null)
            {
                throw new Exception(strErrText);
            }

            //生成新步骤序号
            int nStepNum = 1;
            if (listStep.Count > 0)
            {
                nStepNum = listStep[listStep.Count - 1].StepNum + 1;
            }

            //创建空的Model
            PriceApproveFlowStepViewModel model = new PriceApproveFlowStepViewModel();
            model.StepNum = nStepNum;

            model.Conditions = new List<PriceApproveFlowStepConditionViewModel>();
            model.Conditions.Add(new PriceApproveFlowStepConditionViewModel());

            //生成处理人下拉列表项
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStaff = new List<SelectListItem>();
            selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
                                     {
                                         Text = s.FullName,
                                         Value = s.Id.ToString()
                                     });
            ViewData["Disposers"] = new SelectList(selectListStaff, "Value", "Text");

            return View(model);
        }
Beispiel #2
0
        public ActionResult ModifyPriceApproveStep(string id)
        {
            string strErrText;

            //读取价格审批步骤数据
            FlowSystem flow = new FlowSystem();
            ApproveFlowStep data = flow.LoadApproveFlowStep(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //创建Model
            PriceApproveFlowStepViewModel model = new PriceApproveFlowStepViewModel();
            model.StepNum = data.StepNum;
            model.StepName = data.StepName;
            model.DisposerId = data.DisposerId;
            model.ConditionExpression = data.ConditionExpression;

            model.Conditions = new List<PriceApproveFlowStepConditionViewModel>();
            model.Conditions.Add(new PriceApproveFlowStepConditionViewModel());

            //生成处理人下拉列表项
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStaff = new List<SelectListItem>();
            selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
                                     {
                                         Text = s.FullName,
                                         Value = s.Id.ToString()
                                     });
            ViewData["Disposers"] = new SelectList(selectListStaff, "Value", "Text", model.DisposerId);

            return View(model);
        }
Beispiel #3
0
        public JsonResult LoadStaffs()
        {
            string strErrText;
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from s in listStaff
                      orderby s.FullName
                      select new
                      {
                          s.Id,
                          s.FullName
                      };

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Beispiel #4
0
        public ActionResult ExportStaffs()
        {
            string strErrText;

            //读取全部数据
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }

            //生成GridView
            BoundField colStaffId = new BoundField();
            colStaffId.HeaderText = InnoSoft.LS.Resources.Labels.StaffId;
            colStaffId.DataField = "StaffId";

            BoundField colStaffName = new BoundField();
            colStaffName.HeaderText = InnoSoft.LS.Resources.Labels.StaffName;
            colStaffName.DataField = "StaffName";

            BoundField colSex = new BoundField();
            colSex.HeaderText = InnoSoft.LS.Resources.Labels.Sex;
            colSex.DataField = "Sex";

            BoundField colOrganFullName = new BoundField();
            colOrganFullName.HeaderText = InnoSoft.LS.Resources.Labels.OrganName;
            colOrganFullName.DataField = "OrganFullName";

            BoundField colPositionName = new BoundField();
            colPositionName.HeaderText = InnoSoft.LS.Resources.Labels.PositionName;
            colPositionName.DataField = "PositionName";

            BoundField colOfficeTel = new BoundField();
            colOfficeTel.HeaderText = InnoSoft.LS.Resources.Labels.Tel;
            colOfficeTel.DataField = "OfficeTel";

            BoundField colTelExt = new BoundField();
            colTelExt.HeaderText = InnoSoft.LS.Resources.Labels.TelExt;
            colTelExt.DataField = "TelExt";

            BoundField colFax = new BoundField();
            colFax.HeaderText = InnoSoft.LS.Resources.Labels.Fax;
            colFax.DataField = "Fax";

            BoundField colMobileTel1 = new BoundField();
            colMobileTel1.HeaderText = InnoSoft.LS.Resources.Labels.MobileTel + "1";
            colMobileTel1.DataField = "MobileTel1";

            BoundField colMobileTel2 = new BoundField();
            colMobileTel2.HeaderText = InnoSoft.LS.Resources.Labels.MobileTel + "2";
            colMobileTel2.DataField = "MobileTel2";

            BoundField colMobileTel3 = new BoundField();
            colMobileTel3.HeaderText = InnoSoft.LS.Resources.Labels.MobileTel + "3";
            colMobileTel3.DataField = "MobileTel3";

            BoundField colEMail = new BoundField();
            colEMail.HeaderText = InnoSoft.LS.Resources.Labels.EMail;
            colEMail.DataField = "EMail";

            BoundField colQQ = new BoundField();
            colQQ.HeaderText = InnoSoft.LS.Resources.Labels.QQ;
            colQQ.DataField = "QQ";

            BoundField colBossName = new BoundField();
            colBossName.HeaderText = InnoSoft.LS.Resources.Labels.BossName;
            colBossName.DataField = "BossName";

            BoundField colIsOrganLeader = new BoundField();
            colIsOrganLeader.HeaderText = InnoSoft.LS.Resources.Labels.IsOrganLeader;
            colIsOrganLeader.DataField = "IsOrganLeader";

            BoundField colIsOrganManager = new BoundField();
            colIsOrganManager.HeaderText = InnoSoft.LS.Resources.Labels.IsOrganManager;
            colIsOrganManager.DataField = "IsOrganManager";

            var grid = new GridView();
            grid.Columns.Add(colStaffId);
            grid.Columns.Add(colStaffName);
            grid.Columns.Add(colSex);
            grid.Columns.Add(colOrganFullName);
            grid.Columns.Add(colPositionName);
            grid.Columns.Add(colOfficeTel);
            grid.Columns.Add(colTelExt);
            grid.Columns.Add(colFax);
            grid.Columns.Add(colMobileTel1);
            grid.Columns.Add(colMobileTel2);
            grid.Columns.Add(colMobileTel3);
            grid.Columns.Add(colEMail);
            grid.Columns.Add(colQQ);
            grid.Columns.Add(colBossName);
            grid.Columns.Add(colIsOrganLeader);
            grid.Columns.Add(colIsOrganManager);
            grid.AutoGenerateColumns = false;
            grid.DataSource = from s in listStaff
                              select new
                              {
                                  StaffId = s.Id,
                                  StaffName = s.FullName,
                                  Sex = s.Sex,
                                  OrganFullName = s.OrganFullName,
                                  PositionName = s.PositionName,
                                  OfficeTel = s.OfficeTel,
                                  TelExt = s.TelExt,
                                  Fax = s.Fax,
                                  MobileTel1 = s.MobileTel1,
                                  MobileTel2 = s.MobileTel2,
                                  MobileTel3 = s.MobileTel3,
                                  EMail = s.EMail,
                                  QQ = s.QQ,
                                  BossName = s.BossStaffName,
                                  IsOrganLeader = s.IsOrganLeader ? InnoSoft.LS.Resources.Options.Yes : InnoSoft.LS.Resources.Options.No,
                                  IsOrganManager = s.IsOrganManager ? InnoSoft.LS.Resources.Options.Yes : InnoSoft.LS.Resources.Options.No
                              };
            grid.DataBind();

            //导出GridView
            Response.ClearContent();
            Response.Charset = InnoSoft.LS.Resources.Encoding.ExcelCharset;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(InnoSoft.LS.Resources.Encoding.ExcelContent);
            Response.ContentType = "application/ms-excel";
            Response.Write("<meta http-equiv=Content-Type content=text/html charset=" + InnoSoft.LS.Resources.Encoding.ExcelCharset + ">");
            Response.AddHeader("content-disposition", "attachment; filename=Staff.xls");
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            grid.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();

            return View("SetStaff");
        }
Beispiel #5
0
        public ActionResult NewStaff()
        {
            string strErrText;

            //生成组织部门下拉列表项
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrganization.AddRange(from o in listOrganization
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text");

            //生成岗位下拉列表项
            PositionSystem position = new PositionSystem();
            List<Position> listPosition = position.LoadPositions(LoginAccountId, LoginStaffName, out strErrText);
            if (listPosition == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListPosition = new List<SelectListItem>();
            selectListPosition.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListPosition.AddRange(from p in listPosition
                                        select new SelectListItem
                                        {
                                            Text = p.Name,
                                            Value = p.Id.ToString()
                                        });

            ViewData["Positions"] = new SelectList(selectListPosition, "Value", "Text");

            //生成上司下拉列表项
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStaff = new List<SelectListItem>();
            selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
                                     {
                                         Text = s.FullName,
                                         Value = s.Id.ToString()
                                     });
            ViewData["Bosses"] = new SelectList(selectListStaff, "Value", "Text");

            //创建空的Model
            StaffViewModel model = new StaffViewModel();

            return View(model);
        }
Beispiel #6
0
        public JsonResult LoadStaffsGrid(string sidx, string sord, int page, int rows)
        {
            //读取全部数据
            string strErrText;
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listStaff.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "StaffId") + " " + (sord ?? "ASC");
            var data = listStaff.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from s in data
                      select new
                      {
                          id = s.Id,
                          cell = new string[]
                          {
                              s.Id.ToString(),
                              s.FullName,
                              s.Sex,
                              s.OrganFullName,
                              s.PositionName,
                              s.BossStaffName,
                              s.OfficeTel,
                              s.TelExt,
                              s.MobileTel1,
                              s.QQ
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }