Esempio n. 1
0
        public string EditColletion(string BillList, string username, string bankname, string code, string number)
        {
            string error = string.Empty;
            string msg   = string.Empty;

            if (string.IsNullOrEmpty(BillList) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(bankname) || string.IsNullOrEmpty(code) || string.IsNullOrEmpty(number))
            {
                error = "1";
                msg   = "信息缺失";
                return(Public.JsonSerializeHelper.SerializeToJson(new { error = error, msg = msg }));
            }

            BillList = BillList.ToUpper().Replace(",", "").Replace(" ", "").Replace("/", "").Replace("F", ",F").Replace("J", ",J").Replace("H", ",H");
            var list = BillList.Split(',').ToList();

            var FB = new FeeBill();
            var JS = new BorrowBill();
            var RB = new RefundBill();


            Dictionary <string, CollectionInfo> dic = new Dictionary <string, CollectionInfo>();
            CollectionInfo coll = new CollectionInfo();

            coll.Name              = username;
            coll.SubbranchBank     = bankname;
            coll.SubbranchBankCode = number;
            coll.CardCode          = code;
            dic.Add("CollectionInfo", coll);


            foreach (var item in list)
            {
                if (item.Contains("FB"))
                {
                    var model = FB.GetBillModel(item);
                    if (model != null)
                    {
                        //审批通过了
                        if (model.ApprovalStatus == 2)
                        {
                            //不予许通过
                            msg += "单号" + item + "未做处理;";
                        }
                        else
                        {
                            //进行修改
                            FB.PublicEditMethod <CollectionInfo>(item, dic);
                        }
                    }
                    else
                    {
                        var model2 = RB.GetBillModel(item);
                        if (model2.ApprovalStatus == 2)
                        {
                            msg += "单号" + item + "未做处理;";
                        }
                        else
                        {
                            RB.PublicEditMethod <CollectionInfo>(item, dic);
                        }
                    }
                }
                else if (item.Contains("JS"))
                {
                    var Model3 = JS.GetBillModel(item);
                    if (Model3.ApprovalStatus == 2)
                    {
                        msg += "单号" + item + "未做处理;";
                    }
                    else
                    {
                        JS.PublicEditMethod <CollectionInfo>(item, dic);
                    }
                }
            }

            error = "0";
            if (string.IsNullOrEmpty(msg))
            {
                msg = "修改成功";
            }

            return(Public.JsonSerializeHelper.SerializeToJson(new { error = error, msg = msg }));
        }
Esempio n. 2
0
        public string UpdatePayCode(string BillNo, string code)
        {
            string error = string.Empty;
            string msg   = string.Empty;

            if (string.IsNullOrEmpty(BillNo))
            {
                error = "1";
                msg   = "单号为空";
                return(Public.JsonSerializeHelper.SerializeToJson(new { error = error, msg = msg }));
            }

            BillNo = BillNo.ToUpper().Replace(",", "").Replace(" ", "").Replace("/", "").Replace("F", ",F").Replace("J", ",J").Replace("H", ",H");
            var list = BillNo.Split(',').ToList();

            list.Remove("");

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("PaymentCompanyCode", code);

            var FB = new FeeBill();
            var FT = new NoticeBill();
            var JS = new BorrowBill();
            var RB = new RefundBill();

            try
            {
                foreach (var item in list)
                {
                    if (item.Contains("FB"))
                    {
                        var isFee = FB.GetBillModel(item);
                        if (isFee != null)
                        {
                            FB.PublicEditMethod(item, dic);

                            string sql = string.Format(" Update FEE_FEEBILL set PAYCOMPANYCODE='{0}' where BIllno='{1}' ", code, item);
                            DbContext.Database.ExecuteSqlCommand(sql);

                            DbContext.SaveChanges();
                        }
                        else
                        {
                            RB.PublicEditMethod(item, dic);

                            string sql = string.Format(" Update FEE_FEEREFUNDBILL set PAYCOMPANYCODE='{0}' where BIllno='{1}' ", code, item);
                            DbContext.Database.ExecuteSqlCommand(sql);

                            DbContext.SaveChanges();
                        }
                    }
                    else if (item.Contains("FT"))
                    {
                        FT.PublicEditMethod(item, dic);

                        string sql = string.Format(" Update FEE_NOTICEBILL set PAYCOMPANYCODE='{0}' where BIllno='{1}' ", code, item);
                        DbContext.Database.ExecuteSqlCommand(sql);

                        DbContext.SaveChanges();
                    }
                    else if (item.Contains("JS"))
                    {
                        JS.PublicEditMethod(item, dic);

                        string sql = string.Format(" Update FEE_BORROWBILL set PAYCOMPANYCODE='{0}' where BIllno='{1}' ", code, item);
                        DbContext.Database.ExecuteSqlCommand(sql);

                        DbContext.SaveChanges();
                    }
                    else
                    {
                        RB.PublicEditMethod(item, dic);

                        string sql = string.Format(" Update FEE_FEEREFUNDBILL set PAYCOMPANYCODE='{0}' where BIllno='{1}' ", code, item);
                        DbContext.Database.ExecuteSqlCommand(sql);

                        DbContext.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                error = "1";
                msg   = "系统错误";
                return(Public.JsonSerializeHelper.SerializeToJson(new { error = error, msg = msg }));
            }
            error = "0";
            msg   = "更新成功";
            return(Public.JsonSerializeHelper.SerializeToJson(new { error = error, msg = msg }));
        }