Exemple #1
0
        /// <summary>
        /// 执行年终结算
        /// </summary>
        /// <param name="strYear">结算年份</param>
        /// <returns></returns>
        public void CaculateYearFee(string strYear)
        {
            decimal totalFee = 0;
            //获取欠费用户列表
            string          strWhere            = @" and PID is null and status=1 
                                 and beginChargeDate between '{0}-1-1 0:00:00' and '{0}-12-31 23:59:59'";
            List <Customer> arrearsCustomerList = new CustomerRule().GetList(string.Format(strWhere, strYear));

            foreach (Customer c in arrearsCustomerList)
            {
                totalFee = new ChargeRule().CaculateCustomerFee(c.ID);
                YearEndArrear yeaInfo = new YearEndArrear()
                {
                    ID         = Guid.NewGuid().ToString("N"),
                    CustomerID = c.ID,
                    Money      = totalFee,
                    Status     = 0,
                    Year       = Convert.ToInt32(strYear)
                };
                new YearEndArrearRule().Add(yeaInfo);
                //更新起始缴费时间
                c.BeginChargeDate = Convert.ToDateTime(string.Format("{0}-1-1", DateTime.Now.Year - 1));
                new CustomerRule().Update(c);
            }
        }
 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);
 }
Exemple #3
0
        /// <summary>
        /// 获取欠费详细信息
        /// </summary>
        /// <param name="customerIDList"></param>
        /// <returns></returns>
        public JsonResult GetArrearInfo(string customerIDs)
        {
            CustomerRule cusRule = new CustomerRule();
            AgreementsRule agreeRule = new AgreementsRule();
            ChargeRule chRule = new ChargeRule();
            ChargeItemRule chargeItemRule = new ChargeItemRule();

            List<object> arrearList = new List<object>();
            string[] customerIDArray = customerIDs.Split(',');
            foreach (string customerID in customerIDArray)
            {
                // 客户信息
                var customer = cusRule.CustomerDetail(customerID);
                // 协议信息
                var agreements = agreeRule.GetAgreementObjectByCustomerID(customerID);
                decimal totalFee = chRule.CaculateCustomerFee(customerID);
                //缴费总月份
                Ajax.Model.Customer c = new CustomerRule().GetModel(customerID);
                int monthCount = chRule.GetMonthCount(Convert.ToDateTime(c.BeginChargeDate));
                // 缴费项目信息
                List<dynamic> chargeItemList = new ChargeItemRule().SearchChargeItem(customerID);
                var chargeItem = from chargeItems in chargeItemList
                                 select new
                                 {
                                     Name = chargeItems.NAME,
                                     Price = chargeItemRule.GetPriceByItemID(chargeItems.ID, Convert.ToDecimal(chargeItems.COUNT), customerID),
                                     Count = chargeItems.COUNT,
                                     AgreeMentMoney = chargeItems.AGREEMENTMONEY,
                                     ItemCount = monthCount * CaculateItemCount(chargeItems.AGREEMENTMONEY, Convert.ToString(chargeItemRule.GetPriceByItemID(chargeItems.ID, Convert.ToDecimal(chargeItems.COUNT), customerID)), chargeItems.COUNT)
                                 };
                //子客户费用信息
                List<Ajax.Model.Customer> customerChildrenList = new CustomerRule().GetChildrenCustomer(customerID);
                var childrenCustomer = from childC in customerChildrenList
                                       select new
                                       {
                                           Name = childC.Name,
                                           Fee = chRule.CaculateCustomerFee(childC.ID, false)
                                       };

                arrearList.Add(new { customer, agreements, monthCount, totalFee, chargeItem, childrenCustomer });
            }
            return Json(arrearList, 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);
 }
Exemple #5
0
 /// <summary>
 /// 执行年终结算
 /// </summary>
 /// <param name="strYear">结算年份</param>
 /// <returns></returns>
 public void CaculateYearFee(string strYear)
 {
     decimal totalFee = 0;
     //获取欠费用户列表
     string strWhere = @" and PID is null and status=1
                          and beginChargeDate between '{0}-1-1 0:00:00' and '{0}-12-31 23:59:59'";
     List<Customer> arrearsCustomerList = new CustomerRule().GetList(string.Format(strWhere, strYear));
     foreach (Customer c in arrearsCustomerList)
     {
         totalFee = new ChargeRule().CaculateCustomerFee(c.ID);
         YearEndArrear yeaInfo = new YearEndArrear()
         {
             ID = Guid.NewGuid().ToString("N"),
             CustomerID = c.ID,
             Money = totalFee,
             Status = 0,
             Year = Convert.ToInt32(strYear)
         };
         new YearEndArrearRule().Add(yeaInfo);
         //更新起始缴费时间
         c.BeginChargeDate = Convert.ToDateTime(string.Format("{0}-1-1", DateTime.Now.Year - 1));
         new CustomerRule().Update(c);
     }
 }
 public JsonResult CustomerDelete(string customerID)
 {
     CustomerRule rule = new CustomerRule();
     return Json(rule.Delete(customerID), JsonRequestBehavior.AllowGet);
 }
Exemple #7
0
        /// <summary>
        /// 缴费操作
        /// </summary>
        /// <param name="CustomerID">客户ID</param>
        /// <param name="ChargeMonth">缴费月数</param>
        /// <param name="ChargeMoney">缴费金额</param>
        /// <returns></returns>
        public string Charge(string CustomerID, int ChargeMonth, decimal ChargeMoney, string operatorID)
        {
            CustomerRule customerRule = new CustomerRule();

            Ajax.DAL.ChargeDAL chargeDAL     = new DAL.ChargeDAL();
            Customer           customer      = customerRule.GetModel(CustomerID);
            SysParameterRule   parameterRule = new SysParameterRule();
            dynamic            result        = new System.Dynamic.ExpandoObject();

            int     status   = 0;       // 缴费状态,0 不自动审批,1 自动审批
            decimal allMoney = 0m;

            status = Convert.ToInt32(parameterRule.GetSysParameterValue(Ajax.Common.CommonEnums.SysParameterEnums.ChargeAutoPass));

            if (customer == null)
            {
                result = "客户不存在";
                return(result);
            }
            if (customer.Status != 1)
            {
                result = "客户状态非启用,不能缴费";
                return(result);
            }
            Agreements agreement = new AgreementsRule().GetAgreementByCustomerID(CustomerID);

            // 定义缴费主表对象
            Ajax.Model.Charge charge = new Ajax.Model.Charge()
            {
                AgreementID = agreement == null ? null : agreement.ID,
                BeginDate   = agreement == null ? customer.BeginChargeDate.Value : agreement.BeginDate,
                EndDate     = agreement == null?customer.BeginChargeDate.Value.AddMonths(ChargeMonth) : agreement.EndDate,
                                  CreateDate        = DateTime.Now,
                                  CustomerID        = CustomerID,
                                  ID                = Guid.NewGuid().ToString("N"),
                                  IsAgreementCharge = agreement == null ? 0 : 1,
                                  Money             = ChargeMoney,
                                  OperatorID        = operatorID,
                                  Status            = status
            };
            // 协议缴费,不计算缴费明细
            if (agreement != null)
            {
                string temp = chargeDAL.ChargeByAgreement(charge, agreement);
                if (!string.IsNullOrEmpty(temp))
                {
                    result = temp;
                }
                else
                {
                    result = "缴费成功";
                }
            }
            // 非协议缴费,计算缴费明细
            else
            {
                // 明细缴费
                List <Ajax.Model.ChargeDetail> chargeDetailList = new List <Ajax.Model.ChargeDetail>();                         // 缴费明细
                List <CustomerChargeItem>      myChargeItem     = new List <CustomerChargeItem>();
                myChargeItem = new CustomerChargeItemRule().GetListBycustomerID(CustomerID);
                ChargeItemRule chargeitemRule = new ChargeItemRule();
                //	先添加本客户
                foreach (CustomerChargeItem item in myChargeItem)
                {
                    Ajax.Model.ChargeDetail chargeDetail = new Ajax.Model.ChargeDetail()
                    {
                        ChargeID     = charge.ID,
                        CreateDate   = DateTime.Now,
                        ID           = Guid.NewGuid().ToString("N"),
                        ChargeItemID = item.ItemID,
                        ItemMoney    = chargeitemRule.GetPriceByItemID(item.ItemID, item.Count, CustomerID) * ChargeMonth,
                        Month        = ChargeMonth,
                        Status       = status
                    };
                    allMoney += chargeDetail.ItemMoney;
                    chargeDetailList.Add(chargeDetail);
                }

                List <Customer> childCustomerList = customerRule.GetChildrenCustomer(CustomerID);
                foreach (Customer c in childCustomerList)
                {
                    myChargeItem = new CustomerChargeItemRule().GetListBycustomerID(c.ID);
                    foreach (CustomerChargeItem item in myChargeItem)
                    {
                        Ajax.Model.ChargeDetail chargeDetail = new Ajax.Model.ChargeDetail()
                        {
                            ChargeID     = charge.ID,
                            CreateDate   = DateTime.Now,
                            ID           = Guid.NewGuid().ToString("N"),
                            ChargeItemID = item.ItemID,
                            ItemMoney    = chargeitemRule.GetPriceByItemID(item.ItemID, item.Count, c.ID) * ChargeMonth,
                            Month        = ChargeMonth,
                            Status       = status
                        };
                        allMoney += chargeDetail.ItemMoney;
                        chargeDetailList.Add(chargeDetail);
                    }
                }
                charge.Money = allMoney;
                chargeDAL.ChargeByMonth(charge, chargeDetailList.ToArray(), ChargeMonth);
                result = "缴费成功";
            }

            return(result);
        }
Exemple #8
0
        /// <summary>
        /// 递归计算客户(默认包括子客户)的应缴费用
        /// </summary>
        /// <param name="customerID"></param>
        /// <param name="containChildCustomer">是否计继续算子客户应缴费用</param>
        /// <returns></returns>
        public decimal CaculateCustomerFee(string customerID, bool containChildCustomer = true)
        {
            decimal        totalFee       = 0;
            Customer       c              = new CustomerRule().GetModel(customerID);
            int            monthCount     = GetMonthCount(Convert.ToDateTime(c.BeginChargeDate));
            ChargeItemRule chargeItemRule = new ChargeItemRule();
            Agreements     agree          = new AgreementsRule().GetAgreementByCustomerID(customerID);

            if (agree != null)
            {
                totalFee = new AgreementsRule().GetLastAgreeFee(agree.ID);
                if (agree.EndDate > DateTime.Now)
                {
                    monthCount = GetMonthCount(agree.EndDate);
                    //客户缴费项
                    List <CustomerChargeItem> chargeItems = new CustomerChargeItemRule().GetListBycustomerID(customerID);
                    foreach (CustomerChargeItem chargeItem in chargeItems)
                    {
                        if (chargeItem.AgreementMoney > 0)
                        {
                            totalFee += chargeItem.AgreementMoney;
                        }
                        else
                        {
                            decimal itemPrice = chargeItemRule.GetPriceByItemID(chargeItem.ItemID, chargeItem.Count, customerID);
                            totalFee += monthCount * chargeItem.Count * itemPrice;
                        }
                    }
                }
            }
            else            //非协议用户&协议过期
            {
                //客户缴费项
                List <CustomerChargeItem> chargeItems = new CustomerChargeItemRule().GetListBycustomerID(customerID);
                foreach (CustomerChargeItem chargeItem in chargeItems)
                {
                    if (chargeItem.AgreementMoney > 0)
                    {
                        totalFee += chargeItem.AgreementMoney * monthCount;
                    }
                    else
                    {
                        decimal itemPrice = chargeItemRule.GetPriceByItemID(chargeItem.ItemID, chargeItem.Count, customerID);
                        totalFee += monthCount * chargeItem.Count * itemPrice;
                    }
                }
                //递归所有子客户应缴金额
                if (containChildCustomer)
                {
                    List <Customer> customerChildrenList = new CustomerRule().GetChildrenCustomer(customerID);
                    if (customerChildrenList != null)
                    {
                        //子客户费用
                        foreach (Customer childC in customerChildrenList)
                        {
                            totalFee += CaculateCustomerFee(childC.ID);
                        }
                    }
                }
            }
            return(totalFee);
        }
 public JsonResult CustomerDetailOnly(string customerID)
 {
     if (!string.IsNullOrEmpty(customerID))
     {
         // 客户信息
         var customer = new CustomerRule().CustomerDetail(customerID);
         return Json(customer, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new Ajax.Model.Customer());
     }
 }
 public ActionResult GetChargeItem(string customerID, string customerTypeID)
 {
     List<dynamic> chargeItems = new CustomerRule().GetChargeItemByCustomerID(customerID);
     if (chargeItems.Count == 0)
     {
         chargeItems = new CustomerRule().GetChargeItemByCustomerTypeID(customerTypeID);
     }
     var showList = from cItems in chargeItems
                    select new
                    {
                        ID = cItems.ID,
                        Code = cItems.CODE,
                        Name = cItems.NAME,
                        UnitID1 = cItems.UNIT,
                        CategoryID = cItems.CATEGORYID,
                        IsRegular = cItems.ISREGULAR,
                        IsAgreeMent = cItems.ISAGREEMENT,
                        IsPloy = cItems.ISPLOY,
                        UnitPrice = cItems.UNITPRICE,
                        Count = cItems.COUNT,
                        AgreementMoney = cItems.AGREEMENTMONEY
                    };
     return Json(showList, JsonRequestBehavior.AllowGet);
 }
Exemple #11
0
        /// <summary>
        /// 缴费操作
        /// </summary>
        /// <param name="CustomerID">客户ID</param>
        /// <param name="ChargeMonth">缴费月数</param>
        /// <param name="ChargeMoney">缴费金额</param>
        /// <returns></returns>
        public string Charge(string CustomerID, int ChargeMonth, decimal ChargeMoney, string operatorID)
        {
            CustomerRule customerRule = new CustomerRule();
            Ajax.DAL.ChargeDAL chargeDAL = new DAL.ChargeDAL();
            Customer customer = customerRule.GetModel(CustomerID);
            SysParameterRule parameterRule = new SysParameterRule();
            dynamic result = new System.Dynamic.ExpandoObject();

            int status = 0;	// 缴费状态,0 不自动审批,1 自动审批
            decimal allMoney = 0m;

            status = Convert.ToInt32(parameterRule.GetSysParameterValue(Ajax.Common.CommonEnums.SysParameterEnums.ChargeAutoPass));

            if (customer == null)
            {
                result = "客户不存在";
                return result;
            }
            if (customer.Status != 1)
            {
                result = "客户状态非启用,不能缴费";
                return result;
            }
            Agreements agreement = new AgreementsRule().GetAgreementByCustomerID(CustomerID);

            // 定义缴费主表对象
            Ajax.Model.Charge charge = new Ajax.Model.Charge()
            {
                AgreementID = agreement == null ? null : agreement.ID,
                BeginDate = agreement == null ? customer.BeginChargeDate.Value : agreement.BeginDate,
                EndDate = agreement == null ? customer.BeginChargeDate.Value.AddMonths(ChargeMonth) : agreement.EndDate,
                CreateDate = DateTime.Now,
                CustomerID = CustomerID,
                ID = Guid.NewGuid().ToString("N"),
                IsAgreementCharge = agreement == null ? 0 : 1,
                Money = ChargeMoney,
                OperatorID = operatorID,
                Status = status
            };
            // 协议缴费,不计算缴费明细
            if (agreement != null)
            {
                string temp = chargeDAL.ChargeByAgreement(charge, agreement);
                if (!string.IsNullOrEmpty(temp))
                {
                    result = temp;
                }
                else
                {
                    result = "缴费成功";
                }
            }
            // 非协议缴费,计算缴费明细
            else
            {
                // 明细缴费
                List<Ajax.Model.ChargeDetail> chargeDetailList = new List<Ajax.Model.ChargeDetail>();		// 缴费明细
                List<CustomerChargeItem> myChargeItem = new List<CustomerChargeItem>();
                myChargeItem = new CustomerChargeItemRule().GetListBycustomerID(CustomerID);
                ChargeItemRule chargeitemRule = new ChargeItemRule();
                //	先添加本客户
                foreach (CustomerChargeItem item in myChargeItem)
                {
                    Ajax.Model.ChargeDetail chargeDetail = new Ajax.Model.ChargeDetail()
                    {
                        ChargeID = charge.ID,
                        CreateDate = DateTime.Now,
                        ID = Guid.NewGuid().ToString("N"),
                        ChargeItemID = item.ItemID,
                        ItemMoney = chargeitemRule.GetPriceByItemID(item.ItemID, item.Count, CustomerID) * ChargeMonth,
                        Month = ChargeMonth,
                        Status = status
                    };
                    allMoney += chargeDetail.ItemMoney;
                    chargeDetailList.Add(chargeDetail);
                }

                List<Customer> childCustomerList = customerRule.GetChildrenCustomer(CustomerID);
                foreach (Customer c in childCustomerList)
                {
                    myChargeItem = new CustomerChargeItemRule().GetListBycustomerID(c.ID);
                    foreach (CustomerChargeItem item in myChargeItem)
                    {
                        Ajax.Model.ChargeDetail chargeDetail = new Ajax.Model.ChargeDetail()
                        {
                            ChargeID = charge.ID,
                            CreateDate = DateTime.Now,
                            ID = Guid.NewGuid().ToString("N"),
                            ChargeItemID = item.ItemID,
                            ItemMoney = chargeitemRule.GetPriceByItemID(item.ItemID, item.Count, c.ID) * ChargeMonth,
                            Month = ChargeMonth,
                            Status = status
                        };
                        allMoney += chargeDetail.ItemMoney;
                        chargeDetailList.Add(chargeDetail);
                    }
                }
                charge.Money = allMoney;
                chargeDAL.ChargeByMonth(charge, chargeDetailList.ToArray(), ChargeMonth);
                result = "缴费成功";
            }

            return result;
        }
Exemple #12
0
 /// <summary>
 /// 递归计算客户(默认包括子客户)的应缴费用
 /// </summary>
 /// <param name="customerID"></param>
 /// <param name="containChildCustomer">是否计继续算子客户应缴费用</param>
 /// <returns></returns>
 public decimal CaculateCustomerFee(string customerID, bool containChildCustomer = true)
 {
     decimal totalFee = 0;
     Customer c = new CustomerRule().GetModel(customerID);
     int monthCount = GetMonthCount(Convert.ToDateTime(c.BeginChargeDate));
     ChargeItemRule chargeItemRule = new ChargeItemRule();
     Agreements agree = new AgreementsRule().GetAgreementByCustomerID(customerID);
     if (agree != null)
     {
         totalFee = new AgreementsRule().GetLastAgreeFee(agree.ID);
         if (agree.EndDate > DateTime.Now)
         {
             monthCount = GetMonthCount(agree.EndDate);
             //客户缴费项
             List<CustomerChargeItem> chargeItems = new CustomerChargeItemRule().GetListBycustomerID(customerID);
             foreach (CustomerChargeItem chargeItem in chargeItems)
             {
                 if (chargeItem.AgreementMoney > 0)
                 {
                     totalFee += chargeItem.AgreementMoney;
                 }
                 else
                 {
                     decimal itemPrice = chargeItemRule.GetPriceByItemID(chargeItem.ItemID, chargeItem.Count, customerID);
                     totalFee += monthCount * chargeItem.Count * itemPrice;
                 }
             }
         }
     }
     else//非协议用户&协议过期
     {
         //客户缴费项
         List<CustomerChargeItem> chargeItems = new CustomerChargeItemRule().GetListBycustomerID(customerID);
         foreach (CustomerChargeItem chargeItem in chargeItems)
         {
             if (chargeItem.AgreementMoney > 0)
             {
                 totalFee += chargeItem.AgreementMoney * monthCount;
             }
             else
             {
                 decimal itemPrice = chargeItemRule.GetPriceByItemID(chargeItem.ItemID, chargeItem.Count, customerID);
                 totalFee += monthCount * chargeItem.Count * itemPrice;
             }
         }
         //递归所有子客户应缴金额
         if (containChildCustomer)
         {
             List<Customer> customerChildrenList = new CustomerRule().GetChildrenCustomer(customerID);
             if (customerChildrenList != null)
             {
                 //子客户费用
                 foreach (Customer childC in customerChildrenList)
                 {
                     totalFee += CaculateCustomerFee(childC.ID);
                 }
             }
         }
     }
     return totalFee;
 }
        public JsonResult CustomerDetail(string customerID)
        {
            if (!string.IsNullOrEmpty(customerID))
            {
                // 客户信息
                var customer = new CustomerRule().CustomerDetail(customerID);

                // 缴费项目信息
                List<dynamic> chargeItemList = new ChargeItemRule().SearchChargeItem(customerID);

                var chargeItem = from chargeItems in chargeItemList
                                 select new
                                 {
                                     Name = chargeItems.NAME,
                                     Price = chargeItems.UNITPRICE,
                                     Count = chargeItems.COUNT,
                                     AgreeMentMoney = chargeItems.AGREEMENTMONEY,
                                     ItemCount = 0
                                 };
                // 协议信息
                var agreements = new AgreementsRule().GetAgreementObjectByCustomerID(customerID);
                // 子客户信息
                var childCustomer = new CustomerRule().GetChildrenCustomer(customerID);
                // 缴费历史
                //int itemCount = 0;
                var chargeHistory = new ChargeRule().ChargeSearch(customerID);
                // 欠费记录
                var arrearRecord = new YearEndArrearRule().GetArrearRecordByCustomerID(customerID);
                //chargeHistory,
                return Json(new { customer, chargeItem, agreements, childCustomer, arrearRecord, chargeHistory }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new Ajax.Model.Customer());
            }
        }
 public ActionResult SelectCustomer(string customerParentID)
 {
     List<Ajax.Model.Customer> customerList;
     if (string.IsNullOrEmpty(customerParentID))
     {
         customerList = new CustomerRule().GetList("and PID IS NULL ");
     }
     else
     {
         customerList = new CustomerRule().GetList(string.Format("and PID='{0}' ", customerParentID));
     }
     return PartialView(customerList);
 }
 public ActionResult Search(EasyUIGridParamModel param, Ajax.Model.Customer customer)
 {
     int itemCount = 0;
     CustomerRule cr = new CustomerRule();
     List<dynamic> list = cr.Search(param, customer, out itemCount);
     var showList = from customers in list
                    select new
                    {
                        ID = customers.ID,
                        Name = customers.NAME,
                        TypeName = customers.CUSTOMERTYPE,
                        Status = customers.STATUS.Replace("1", "正常").Replace("0", "未审核").Replace("2", "禁用").Replace("3", "已删除"),
                        CreateTime = Ajax.Common.TimeParser.FormatDateTime(customers.CREATETIME),
                        Contactor = customers.CONTACTOR,
                        FeeType = string.IsNullOrEmpty(customers.AGREEID) ? "非协议缴费" : "协议缴费",
                        Address = customers.ADDRESS
                    };
     return Json(new { total = itemCount, rows = showList }, JsonRequestBehavior.AllowGet);
 }
        public ActionResult GetCustomerListByID(string q, string IsParent)
        {
            List<Ajax.Model.Customer> customerList = new List<Ajax.Model.Customer>();

            customerList = new CustomerRule().GetCustomerListByID(q, IsParent);
            var showList = from customers in customerList
                           select new
                           {
                               id = customers.ID,
                               text = customers.Name
                           };
            return Json(showList, JsonRequestBehavior.AllowGet);
        }
 public JsonResult GetCustomerChildren(string customerID)
 {
     var childCustomer = new CustomerRule().GetChildrenCustomer(customerID);
     return Json(childCustomer, JsonRequestBehavior.AllowGet);
 }