예제 #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Agreements model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Insert<Agreements>(model);
     }
 }
예제 #2
0
파일: Agreements.cs 프로젝트: lsyuan/ecms
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Ajax.Model.Agreements model)
 {
     if (!dal.Exists(model.ID, model.CustomerID))
     {
         dal.Add(model);
     }
     else
     {
         throw new Exception("协议编号已经存在或用户已有协议!");
     }
 }
예제 #3
0
 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);
 }
예제 #4
0
 public ActionResult SearchAgree(EasyUIGridParamModel param, Agreements agree, Ajax.Model.Customer c)
 {
     int itemCount = 0;
     List<dynamic> agreeList = new AgreementsRule().SearchAgree(param, agree, c, out itemCount);
     var showList = from a in agreeList
                    select new
                    {
                        ID = a.ID,
                        CONTRASTID = a.ID,
                        CUSTOMERID = a.CUSTOMERID,
                        CODE = a.CODE,
                        NAME = a.NAME,
                        MONEY = a.MONEY,
                        BEGINDATE = a.BEGINDATE,
                        AGREEMENTCODE = a.AGREEMENTCODE,
                        ENDDATE = TimeParser.FormatDateTime(a.ENDDATE),
                        STATUS = Convert.ToString(a.STATUS).Replace("0", "未审核").Replace("1", "已审核").Replace("2", "已删除")
                    };
     return Json(new { total = itemCount, rows = showList }, JsonRequestBehavior.AllowGet);
 }
예제 #5
0
 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);
 }
예제 #6
0
파일: Charge.cs 프로젝트: dalinhuang/myecms
        /// <summary>
        /// 按协议缴费
        /// </summary>
        /// <param name="charge">缴费主表</param>
        /// <param name="agreement">协议信息</param>
        /// <returns></returns>
        public string ChargeByAgreement(Charge charge, Agreements agreement)
        {
            using (DBHelper db = DBHelper.Create())
            {
                db.BeginTransaction();
                decimal agreementMoney = agreement.Money;
                #region 更新协议缴费状态
                string sql = "select sum(money) from charge where AgreementID = @AgreementID and (status = 1 or status = 0)";
                Dictionary<string, object> dic = new Dictionary<string, object>();
                dic.Add("AgreementID", agreement.ID);

                object o = db.ExcuteScular(sql, dic);

                decimal chargedSumMoney = 0m;

                decimal.TryParse((o ?? 0).ToString(), out chargedSumMoney);

                // 如果协议总金额大于等于协议金额,则更新协议状态为缴讫
                if (chargedSumMoney == agreement.Money)
                {
                    agreement.Status = 2;
                    db.Update<Agreements>(agreement);
                }
                else if ((chargedSumMoney + charge.Money) > agreement.Money)
                {
                    db.RollBack();
                    return "本期缴费金额加上历史缴费金额大于本协议缴费总金额,不能缴费,请调整缴费金额";
                }
                #endregion
                // 插入主表
                db.Insert<Charge>(charge);

                db.Commit();

                return "缴费成功";
            }
        }
예제 #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Agreements model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Update<Agreements>(model);
         return true;
     }
 }
예제 #8
0
        /// <summary>
        /// 获取收费协议json
        /// </summary>
        /// <param name="param"></param>
        /// <param name="agree"></param>
        /// <param name="itemCount"></param>
        /// <returns></returns>
        public List<dynamic> SearchContrast(EasyUIGridParamModel param, Agreements agree, Customer c, out int itemCount)
        {
            List<SqlParameter> paramList = new List<SqlParameter>();
            StringBuilder StrSql = new StringBuilder();
            StrSql.Append(@"select a.ID,c.ID as customerID,c.Code,c.Name,a.Money,a.Status,
                            a.begindate,a.enddate,a.createtime,a.checktime,a.Code as agreementCode
                            from  T_Agreements a
                            left join T_Customer c on c.ID=a.CustomerID
                            where 1=1 ");
            Dictionary<string, object> paramDic = new Dictionary<string, object>();
            if (!string.IsNullOrEmpty(agree.ID))
            {
                StrSql.Append("and a.ID=@ID ");
                paramDic.Add("ID", agree.ID);
            }
            if (agree.BeginDate.ToString() != "0001/1/1 0:00:00" && agree.EndDate.ToString() != "0001/1/1 0:00:00")
            {
                StrSql.Append("and a.begindate>=@beginDate and a.enddate<=@endDate ");
                paramDic.Add("beginDate", agree.BeginDate);
                paramDic.Add("endDate", agree.EndDate);
            }
            if (agree.Status != -1)
            {
                StrSql.Append("and a.status=@status ");
                paramDic.Add("status", agree.Status);
            }
            if (!string.IsNullOrEmpty(agree.CustomerID))
            {
                StrSql.Append("and c.ID=@customerID ");
                paramDic.Add("customerID", agree.CustomerID);
            }
            if (!string.IsNullOrEmpty(c.Name))
            {
                StrSql.Append("and c.Name like @name ");
                paramDic.Add("name", string.Format("%{0}%", c.Name));
            }

            int pageIndex = Convert.ToInt32(param.page) - 1;
            int pageSize = Convert.ToInt32(param.rows);
            using (DBHelper db = DBHelper.Create())
            {
                itemCount = db.GetCount(string.Format(DBHelper.StrGetCountSql, StrSql), paramDic);
                return db.GetDynaminObjectList(StrSql.ToString(), pageIndex, pageSize, null, paramDic);
            }
        }
예제 #9
0
파일: Agreements.cs 프로젝트: lsyuan/ecms
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Ajax.Model.Agreements model)
 {
     return(dal.Update(model));
 }