Ejemplo n.º 1
0
        public JsonResult GetAllSysParameter()
        {
            Ajax.BLL.SysParameterRule      paramters = new Ajax.BLL.SysParameterRule();
            List <Ajax.Model.SysParameter> list      = new List <Ajax.Model.SysParameter>();

            list = paramters.GetModelList("");
            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public JsonResult GetAllSysParameter()
 {
     Ajax.BLL.SysParameterRule paramters = new Ajax.BLL.SysParameterRule();
     List<Ajax.Model.SysParameter> list = new List<Ajax.Model.SysParameter>();
     list = paramters.GetModelList("");
     return Json(list, JsonRequestBehavior.AllowGet);
 }