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); }
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); }
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"); }
public JsonResult LoadOrganizationStaffs(long nOrganId) { string strErrText; StaffSystem staff = new StaffSystem(); List<Staff> listStaff = staff.LoadStaffsByOrganId(nOrganId, LoginAccountId, LoginStaffName, out strErrText); if (listStaff == null) { throw new Exception(strErrText); } var ret = from s in listStaff select new { s.Id, s.FullName }; return Json(ret, JsonRequestBehavior.AllowGet); }
public ActionResult NewStaff(StaffViewModel model) { if (ModelState.IsValid) { //创建数据 Staff data = new Staff(); data.FamilyName = model.FamilyName; data.Name = model.Name ?? string.Empty; data.Sex = model.Sex; data.OrganId = model.OrganId; data.PositionId = model.PositionId; data.OfficeTel = model.OfficeTel ?? string.Empty; data.TelExt = model.TelExt ?? string.Empty; data.Fax = model.Fax ?? string.Empty; data.MobileTel1 = model.MobileTel1; data.MobileTel2 = model.MobileTel2 ?? string.Empty; data.MobileTel3 = model.MobileTel3 ?? string.Empty; data.EMail = model.EMail ?? string.Empty; data.QQ = model.QQ ?? string.Empty; data.IsOrganManager = model.IsOrganManager; data.IsOrganLeader = model.IsOrganLeader; data.BossStaffId = model.BossStaffId; //保存数据 string strErrText; StaffSystem staff = new StaffSystem(); if (staff.InsertStaff(data, LoginAccountId, LoginStaffName, out strErrText) > 0) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
public ActionResult ViewStaffDetails(string id) { string strErrText; //生成Model数据 long nStaffId = long.Parse(id); StaffSystem staff = new StaffSystem(); Staff data = staff.LoadStaff(nStaffId, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } StaffViewModel model = new StaffViewModel(); model.Id = data.Id; model.FamilyName = data.FamilyName; model.Name = data.Name; model.Sex = data.Sex; model.OrganId = data.OrganId; model.OrganName = data.OrganName; model.OrganFullName = data.OrganFullName; model.PositionId = data.PositionId; model.PositionName = data.PositionName; model.OfficeTel = data.OfficeTel; model.TelExt = data.TelExt; model.Fax = data.Fax; model.MobileTel1 = data.MobileTel1; model.MobileTel2 = data.MobileTel2; model.MobileTel3 = data.MobileTel3; model.EMail = data.EMail; model.QQ = data.QQ; model.IsOrganManager = data.IsOrganManager; model.IsOrganLeader = data.IsOrganLeader; model.BossStaffId = data.BossStaffId; model.BossStaffName = data.BossStaffName; return View(model); }
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); }
public ActionResult ModifyStaff(string id) { string strErrText; //生成Model数据 long nStaffId = long.Parse(id); StaffSystem staff = new StaffSystem(); Staff data = staff.LoadStaff(nStaffId, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } StaffViewModel model = new StaffViewModel(); model.Id = data.Id; model.FamilyName = data.FamilyName; model.Name = data.Name; model.Sex = data.Sex; model.OrganId = data.OrganId; model.PositionId = data.PositionId; model.OfficeTel = data.OfficeTel; model.TelExt = data.TelExt; model.Fax = data.Fax; model.MobileTel1 = data.MobileTel1; model.MobileTel2 = data.MobileTel2; model.MobileTel3 = data.MobileTel3; model.EMail = data.EMail; model.QQ = data.QQ; model.IsOrganManager = data.IsOrganManager; model.IsOrganLeader = data.IsOrganLeader; model.BossStaffId = data.BossStaffId; //生成组织部门下拉列表项 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", model.OrganId); //生成岗位下拉列表项 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", model.PositionId); //生成上司下拉列表项 List<Staff> listStaff = staff.LoadStaffsExcludeSelfAndSubordinates(nStaffId, 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.BossStaffId); return View(model); }
public ActionResult DeleteStaff(string id) { long nStaffId = long.Parse(id); if (nStaffId == LoginStaffId) { return Json(InnoSoft.LS.Resources.Strings.CanNotDeleteLoginStaff); } //删除数据 string strErrText; StaffSystem staff = new StaffSystem(); if (staff.DeleteStaff(nStaffId, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } }
public ActionResult ModifyAccount(string id) { string strErrText; //生成Model数据 long nAccountId = long.Parse(id); AuthenticateSystem auth = new AuthenticateSystem(); Account data = auth.LoadAccount(nAccountId, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } AccountViewModel model = new AccountViewModel(); model.Id = data.Id; model.Name = data.Name; model.Password = data.Password; model.AccountType = data.AccountType; model.OrganId = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? data.OrganId : 0; model.StaffId = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? data.StaffId : 0; model.CustomerId = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? 0 : data.OrganId; model.ContactName = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? string.Empty : data.StaffName; model.IsCancel = data.IsCancel; if (data.AccountType == InnoSoft.LS.Resources.Options.Staff) { //生成组织部门下拉列表 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 = "0" }); 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", model.OrganId); //生成空的客户下拉列表 List<Customer> listCustomer = new List<Customer>(); List<SelectListItem> selectListCustomer = new List<SelectListItem>(); selectListCustomer.Add(new SelectListItem { Text = string.Empty, Value = "0" }); selectListCustomer.AddRange(from c in listCustomer select new SelectListItem { Text = c.Name, Value = c.Id.ToString() }); ViewData["Customers"] = new SelectList(selectListCustomer, "Value", "Text"); } else { //生成空的组织部门下拉列表 { List<Organization> listOrganization = new List<Organization>(); List<SelectListItem> selectListOrganization = new List<SelectListItem>(); selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = "0" }); selectListOrganization.AddRange(from o in listOrganization select new SelectListItem { Text = o.FullName, Value = o.Id.ToString() }); ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text"); } //生成客户下拉列表 CustomerSystem customer = new CustomerSystem(); List<Customer> listCustomer = customer.LoadCustomers(LoginAccountId, LoginStaffName, out strErrText); if (listCustomer == null) { throw new Exception(strErrText); } List<SelectListItem> selectListCustomer = new List<SelectListItem>(); selectListCustomer.Add(new SelectListItem { Text = string.Empty, Value = "0" }); selectListCustomer.AddRange(from c in listCustomer orderby c.Name select new SelectListItem { Text = c.Name, Value = c.Id.ToString() }); ViewData["Customers"] = new SelectList(selectListCustomer, "Value", "Text", model.OrganId); } //生成员工下拉列表 if (data.AccountType == InnoSoft.LS.Resources.Options.Staff) { StaffSystem staff = new StaffSystem(); List<Staff> listStaff = staff.LoadStaffsByOrganId(model.OrganId, 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["Staffs"] = new SelectList(selectListStaff, "Value", "Text", model.StaffId); } else { List<Staff> listStaff = new List<Staff>(); 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.Name, Value = s.Id.ToString() }); ViewData["Staffs"] = new SelectList(selectListStaff, "Value", "Text"); } return View(model); }
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); }