public ActionResult AddCustomer(Ajax.Model.Customer customer, List<CustomerChargeItem> ccItems) { AjaxResult result = new AjaxResult(); customer.ID = Guid.NewGuid().ToString("N"); customer.CreateTime = DateTime.Now; customer.UpdateTime = DateTime.Now; customer.PY = Pinyin.GetPinyin(customer.Name); customer.Status = 0;//默认无效,需要审核 customer.OperatorID = MyTicket.CurrentTicket.EmployeeID; customer.Code = 0; //对应缴费项 foreach (CustomerChargeItem ccItem in ccItems) { ccItem.ID = WebHelper.GetNewGuidUpper(); ccItem.CustomerID = customer.ID; } try { new CustomerRule().Add(customer, ccItems); result.Success = true; result.Message = "客户添加成功"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 缴费 /// </summary> /// <returns></returns> public ActionResult Charge(string customerID) { AjaxResult result = new AjaxResult(); result.Success = new FirstMoneyRule().UpdateStatus(customerID, 1); result.Message = result.Success ? "缴费成功,等待审核。" : "缴费失败!"; return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult ApprovalAll() { AjaxResult result = new AjaxResult(); new AgreementsRule().ApprovalAll(); result.Success = true; result.Message = "保存成功。"; return Json(result, JsonRequestBehavior.AllowGet); }
public JsonResult AddArea(Area area) { AjaxResult result = new AjaxResult(); dynamic a = new AreaRule().AddArea(area); result.Success = a.Errormsg != null ? false : true; result.Message = result.Success ? "地区信息添加成功" : "error:" + a.Errormsg; return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult ApprovalAgree(string guids) { AjaxResult result = new AjaxResult(); string[] guidArray = guids.Trim(';').Split(';'); new AgreementsRule().RefuseAgree(new List<string>(guidArray), StatusEnum.AgreeStatusEnum.Approval); result.Success = true; result.Message = "保存成功。"; return Json(result, JsonRequestBehavior.AllowGet); }
public JsonResult AddMessageNew(string AcceptIDS, string Title, string Content) { AjaxResult result = new AjaxResult(); Message msg = new Message(); msg.Content = Content; msg.Title = Title; try { MessageRule msgR = new MessageRule(); if (string.IsNullOrEmpty(msg.ID))//新增 { msg.ID = Guid.NewGuid().ToString("N"); msg.OperatorID = MyTicket.CurrentTicket.UserID; msg.CreateDate = DateTime.Now; msgR.Add(msg); //不选接收人,默认发送给所有人 if (string.IsNullOrEmpty(AcceptIDS)) { List<Ajax.Model.Customer> acceptList = new CustomerRule().GetList(""); foreach (Ajax.Model.Customer c in acceptList) { AcceptIDS += c.OperatorID + ","; } } string[] strAcceptIDs = AcceptIDS.Remove(AcceptIDS.Length - 1, 1).Split(',');//Request.Form["txtAcceptIDs"].Split(','); //接收人 OperatorMsgRule omsgR = new OperatorMsgRule(); List<OperatorMsg> oMsgList = new List<OperatorMsg>(); foreach (string acceptID in strAcceptIDs) { if (string.IsNullOrEmpty(acceptID)) continue; OperatorMsg omsg = new OperatorMsg(); omsg.ID = Guid.NewGuid().ToString("N"); omsg.Status = 0;//默认为未读 omsg.MsgID = msg.ID; omsg.OperatorID = acceptID; oMsgList.Add(omsg); } omsgR.AddMul(oMsgList); result.Success = true; result.Message = "公告已经成功发出。"; } else//编辑 { result.Success = msgR.Update(msg); result.Message = result.Success ? "公告已经成功修改。" : "公告修改失败!"; } } catch (Exception ex) { result.Success = false; result.Message = "操作失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult ChargeAudit(string guids, bool isPass) { AjaxResult result = new AjaxResult(); try { result.Success = new ChargeRule().ChargeAudit(guids, isPass); result.Message = result.Success ? "审核成功。" : "审核操作失败。"; } catch (Exception ex) { result.Success = false; result.Message = "审核失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 删除票据分类 /// </summary> /// <param name="TypeID"></param> /// <returns></returns> public ActionResult DeleteInvoiceType(string TypeID) { AjaxResult result = new AjaxResult(); try { result.Success = new InvoiceTypeRule().Delete(TypeID); result.Message = result.Success ? "删除成功。" : "删除失败。"; } catch (Exception ex) { result.Success = false; result.Message = "error:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 删除单位 /// </summary> /// <param name="ID"></param> /// <returns></returns> public AjaxResult DeleteUnit(String ID) { AjaxResult result = new AjaxResult(); if (dal.IsUsed(ID)) { result.Success = false; result.Message = "单位已经在使用,不能删除"; } else { dal.DeleteUnit(ID); result.Success = true; result.Message = "单位删除成功"; } return result; }
/// <summary> /// 新增票据分类 /// </summary> /// <param name="IType"></param> /// <returns></returns> public ActionResult AddInvoiceType(InvoiceType IType) { AjaxResult result = new AjaxResult(); IType.ID = Guid.NewGuid().ToString("N"); try { new InvoiceTypeRule().Add(IType); result.Success = true; result.Message = "添加成功。"; } catch (Exception ex) { result.Success = false; result.Message = "error:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 新增期初欠费记录 /// </summary> /// <param name="fMoney"></param> /// <returns></returns> public ActionResult AddNewArrear(FirstMoney fMoney) { AjaxResult result = new AjaxResult(); fMoney.ID = Guid.NewGuid().ToString("N"); fMoney.Status = 0; try { new FirstMoneyRule().Add(fMoney); result.Success = true; result.Message = "期初欠费添加成功"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult AddEmployee(Employee emp) { AjaxResult result = new AjaxResult(); emp.ID = Guid.NewGuid().ToString("N"); emp.PY = Pinyin.GetPinyin(emp.Name); emp.Status = 1; try { new EmployeeRule().Add(emp); result.Success = true; result.Message = "职员信息新增成功。"; } catch (Exception ex) { result.Success = false; result.Message = "职员信息新增失败。" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult DeleteEmployee(string guids) { AjaxResult result = new AjaxResult(); try { if (!string.IsNullOrEmpty(guids)) { new EmployeeRule().DeleteList(guids.TrimEnd(',')); } result.Success = true; result.Message = "删除成功。"; } catch (Exception ex) { result.Success = false; result.Message = "删除失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult AddAnotherCharge(AnotherCharge aCharge) { AjaxResult result = new AjaxResult(); try { aCharge.ID = Guid.NewGuid().ToString("N"); aCharge.OperatorID = MyTicket.CurrentTicket.UserID; aCharge.ChargeDate = DateTime.Now; new AnotherChargeRule().Add(aCharge); result.Success = true; result.Message = "收费成功。"; } catch (Exception ex) { result.Success = false; result.Message = "收费失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult AddChargeItem(ChargeItem item) { AjaxResult result = new AjaxResult(); item.ID = Guid.NewGuid().ToString("N").ToUpper(); item.PY = Pinyin.GetPinyin(item.Name); ChargeItemRule rule = new ChargeItemRule(); item.Code = rule.GetNewCode(); try { rule.Add(item); result.Success = true; result.Message = "缴费项目添加成功。"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 新增票据登记 /// </summary> /// <param name="IR"></param> /// <returns></returns> public ActionResult AddInvoice(InvoiceRegister IR) { AjaxResult result = new AjaxResult(); IR.ID = Guid.NewGuid().ToString("N"); IR.RegisterTime = DateTime.Now; IR.OperatorID = MyTicket.CurrentTicket.EmployeeID; IR.UseStatus = 0; try { new InvoiceRegisterRule().Add(IR); result.Success = true; result.Message = "票据已经成功登记。"; } catch (Exception ex) { result.Success = false; result.Message = "票据登记失败" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult AddAgree(Agreements agree) { AjaxResult result = new AjaxResult(); try { agree.CheckTime = DateTime.MaxValue; agree.ID = WebHelper.GetNewGuidUpper(); agree.CheckOperatorID = MyTicket.CurrentTicket.UserID; agree.CreateTime = DateTime.Now; new AgreementsRule().Add(agree); result.Success = true; result.Message = "协议添加成功"; } catch (Exception ex) { result.Success = false; result.Message = "协议添加失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult Audit(string customerID, int status) { AjaxResult result = new AjaxResult(); if (!string.IsNullOrEmpty(customerID)) { CustomerRule cr = new CustomerRule(); try { cr.Audit(new List<string>(customerID.TrimEnd(',').Split(',')), status); result.Success = false; result.Message = "审批成功."; } catch (Exception ex) { result.Success = false; result.Message = "操作失败:" + ex.Message; } } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 执行年终结算 /// </summary> /// <returns></returns> public ActionResult CaculateYearFee(string strYear) { AjaxResult result = new AjaxResult(); if (string.IsNullOrEmpty(strYear)) { strYear = DateTime.Now.AddYears(-1).Year.ToString(); } try { new YearEndArrearRule().CaculateYearFee(strYear); result.Success = true; result.Message = "年终结算执行完成。"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult AddCustomerType(CustomerType customerType) { AjaxResult result = new AjaxResult(); customerType.ID = Guid.NewGuid().ToString().Replace("-", ""); try { if (new CustomerTypeRule().AddCustomerType(customerType)) { result.Success = true; result.Message = "客户类型新增成功。"; } else { result.Success = false; result.Message = "客户类型新增失败。"; } } catch (Exception ex) { result.Success = false; result.Message = "新增失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult SaveChargePolicy(List<Poly> ployList) { AjaxResult result = new AjaxResult(); if (ployList == null && ployList.Count == 0) { result.Success = false; result.Message = "策略保存失败:分级策略为空"; return Json(result, JsonRequestBehavior.AllowGet); } string delItemID = ployList[0].ItemID; try { if (ployList == null) { ployList = new List<Poly>(); } foreach (Poly p in ployList) { p.ID = Guid.NewGuid().ToString("N"); if (p.HignerBound == -1) { p.HignerBound = int.MaxValue; } } new PolyRule().SavePolys(ployList, delItemID); result.Success = true; result.Message = "策略保存成功。"; } catch (Exception ex) { result.Success = true; result.Message = "策略保存失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 计算客户总费用 /// </summary> /// <param name="customerId">客户id</param> /// <returns></returns> private ActionResult CaculateCustomerTotalFee(string customerId) { AjaxResult result = new AjaxResult(); try { result.Success = true; result.Message = new ChargeRule().CaculateCustomerFee(customerId).ToString("n2"); } catch (Exception ex) { result.Success = false; result.Message = "计费出错:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 用户登录 /// </summary> /// <returns></returns> public ActionResult GoLogin(string userName, string pwd, string validateCode) { AjaxResult result = new AjaxResult(); OperatorRule operatorRule = new OperatorRule(); #if DEBUG validateCode = Session["ValidateCode"].ToString(); #endif if (validateCode != Session["ValidateCode"].ToString()) { result.Success = false; result.Message = "验证码输入错误。"; } else { Logon logon = new Logon() { Password = pwd, Username = userName }; if (UserManager.ValidateUser(logon, Response)) { List<Ticket> currentTicketList = new List<Ticket>(); if (HttpContext.Cache["UserList"] != null) { currentTicketList = HttpContext.Cache["UserList"] as List<Ticket>; } if (currentTicketList.Count == 1) { //MyTicket.CurrentTicket = currentTicketList[0]; //唯一角色的用户直接进入系统 result.Success = true; result.Url = "/Home/Index"; //记录登录日志 LoginLog log = new LoginLog(); log.OperatorID = MyTicket.CurrentTicket.UserID; log.CreateTime = DateTime.Now; log.Type = 1; log.ID = WebHelper.GetNewGuidUpper(); new LoginLogRule().Add(log); return Json(result, JsonRequestBehavior.AllowGet); } else { return Json(currentTicketList, JsonRequestBehavior.AllowGet); } } else { result.Success = false; result.Message = "用户名或者密码错误。"; return Json(result, JsonRequestBehavior.AllowGet); } List<dynamic> userList = operatorRule.Login(userName, pwd); if (userList == null || userList.Count == 0) { result.Success = false; result.Message = "用户名或者密码错误。"; } else { List<Ticket> currentTicketList = new List<Ticket>(); foreach (dynamic t in userList) { if (currentTicketList.Count<Ticket>(ct => ct.GroupName == t.GROUPNAME) > 0) { continue;//同一用户多账号相同角色去重复 } Ticket myTicket = new Ticket(); myTicket.DeptID = t.DEPTID; myTicket.DeptName = t.DEPTNAME; myTicket.EmployeeID = t.EMPID; myTicket.EmployeeName = t.EMPNAME; myTicket.GroupID = t.GROUPID; myTicket.GroupName = t.GROUPNAME; myTicket.UserID = t.ID; myTicket.UserName = t.OPERNAME; myTicket.IsAdmin = (t.ISADMIN == "1") ? true : false; //myTicket.VoteList = new GroupVoteRule().GetOperVotes(t.GROUPID, t.ID);//获取权限列表 myTicket.VoteDic = new Dictionary<string, int>(); foreach (OperatorVote item in new GroupVoteRule().GetOperVotes(t.GROUPID, t.ID)) { myTicket.VoteDic.Add(item.PoupID, item.VoteType); } //myTicket.CurrentOperator = operatorRule.GetModel(t.ID); currentTicketList.Add(myTicket); } if (currentTicketList.Count == 1) { //MyTicket.CurrentTicket = currentTicketList[0];//唯一角色的用户直接进入系统 result.Success = true; result.Url = "/Home/Index"; //记录登录日志 LoginLog log = new LoginLog(); log.OperatorID = MyTicket.CurrentTicket.UserID; log.CreateTime = DateTime.Now; log.Type = 1; log.ID = WebHelper.GetNewGuidUpper(); new LoginLogRule().Add(log); } else { Session["currentUserList"] = currentTicketList;//记录角色列表,等待用户选择 return Json(currentTicketList, JsonRequestBehavior.AllowGet); } } } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult ModifyEmployee(Employee emp) { AjaxResult result = new AjaxResult(); try { emp.PY = Pinyin.GetPinyin(emp.Name); bool flag = new EmployeeRule().Update(emp); if (flag) { result.Success = true; result.Message = "客户信息更新成功。"; } } catch (Exception ex) { result.Success = false; result.Message = "客户信息更新失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult ModifyAgree(Agreements a) { AjaxResult result = new AjaxResult(); try { result.Success = new AgreementsRule().Update(a); result.Message = "协议修改成功。"; } catch { result.Success = false; result.Message = "协议修改失败。"; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 期初欠费审核 /// </summary> /// <param name="guids"></param> /// <param name="isPass"></param> /// <returns></returns> public ActionResult ChargeAudit(string guids, bool isPass) { AjaxResult result = new AjaxResult(); result.Success = new FirstMoneyRule().ChargeAudit(guids, isPass); result.Message = result.Success ? "审核成功。" : "审核失败!"; return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult TempChargeAdd(TempCharge tCharge, List<TempChargeDetail> tChargeDetail) { AjaxResult result = new AjaxResult(); try { tCharge.ID = Guid.NewGuid().ToString("N"); tCharge.OperatorID = MyTicket.CurrentTicket.UserID; new TempChargeRule().AddTempCharge(tCharge, tChargeDetail); result.Success = true; result.Message = "收费成功"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 新增票据分类 /// </summary> /// <param name="IType"></param> /// <returns></returns> public ActionResult EditInvoiceType(InvoiceType IType) { AjaxResult result = new AjaxResult(); if (!string.IsNullOrEmpty(IType.ID)) { result.Success = new InvoiceTypeRule().Update(IType); result.Message = result.Success ? "修改成功。" : "修改失败"; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 标记为坏账 /// </summary> /// <param name="strID"></param> /// <returns></returns> public ActionResult MarkBadFee(string strID) { AjaxResult result = new AjaxResult(); result.Success = new YearEndArrearRule().UpdateStatus(strID, "2"); result.Message = result.Success ? "标记成功。" : "标记失败!"; return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 期初欠费记录删除 /// </summary> /// <param name="customerID"></param> /// <returns></returns> public ActionResult Delete(string customerID) { AjaxResult result = new AjaxResult(); result.Success = new FirstMoneyRule().UpdateStatus(customerID, 3); result.Message = result.Success ? "期初欠费记录已成功删除。" : "欠费记录删除失败!"; return Json(result, JsonRequestBehavior.AllowGet); }