Ejemplo n.º 1
0
        /// <summary>
        /// 删除
        /// znt 2015-04-24
        /// </summary>
        public override BaseResult Delete(Hashtable param)
        {
            BaseResult br = new BaseResult();
            long       id = Convert.ToInt64(param["id"]);

            param.Clear();
            param.Add("id", id);
            Tb_Gys_Account model = DAL.GetItem <Tb_Gys_Account>(typeof(Tb_Gys_Account), param);

            if (model == null)
            {
                br.Success = false;
                br.Message.Add(string.Format("删除银行账号失败,该账号不存在或资料已缺失!"));
                br.Level = ErrorLevel.Warning;
                return(br);
            }

            if (model.flag_default == 1)
            {
                br.Success = false;
                br.Message.Add(string.Format("{0}【{1}】账号为默认账号,不可删除!", model.name_bank, model.account_bank));
                br.Level = ErrorLevel.Warning;
                return(br);
            }

            param.Clear();
            param.Add("id", id);
            DAL.Delete(typeof(Tb_Gys_Account), param);
            br.Success = true;
            return(br);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取供应商默认付款账号
        /// znt 2015-04-27
        /// </summary>
        public BaseResult GetDefault(Hashtable param)
        {
            BaseResult br     = new BaseResult();
            long       id_gys = Convert.ToInt64(param["id_gys"]);

            param.Clear();
            param.Add("id_gys", id_gys);
            param.Add("flag_default", 1);
            Tb_Gys_Account model = DAL.GetItem <Tb_Gys_Account>(typeof(Tb_Gys_Account), param);

            if (model == null)
            {
                param.Clear();
                param.Add("id_gys", id_gys);
                model = DAL.QueryList <Tb_Gys_Account>(typeof(Tb_Gys_Account), param).FirstOrDefault();
                if (model == null)
                {
                    model = new Tb_Gys_Account();
                }
            }

            br.Data    = model;
            br.Success = true;
            return(br);
        }
Ejemplo n.º 3
0
        public ActionResult Pay()
        {
            BaseResult        br    = new BaseResult();
            Td_sale_pay_Query model = new Td_sale_pay_Query();

            try
            {
                Hashtable   param = GetParameters();
                ParamVessel p     = new ParamVessel();
                p.Add("dh", String.Empty, HandleType.ReturnMsg);
                param = param.Trim(p);

                string dh = param["dh"].ToString();
                ViewData["je_pay"]   = (long)0; // 订单金额
                ViewData["je_payed"] = (long)0; // 已付金额
                ViewData["id_gys"]   = (long)0; // 供应商id 选择银行账号标识

                param.Clear();
                param.Add("dh", dh);
                br = BusinessFactory.Order.Get(param);
                if (br.Data != null)
                {
                    Td_Sale_Order_Head head = (Td_Sale_Order_Head)br.Data;
                    model.dh_order       = head.dh;
                    ViewData["je_pay"]   = head.je_pay;
                    ViewData["je_payed"] = head.je_payed;
                    ViewData["id_gys"]   = head.id_gys;
                    model.je             = (head.je_pay - head.je_payed) < 0 ? (long)0 : (head.je_pay - head.je_payed); // 尚未付款

                    // 收款账号
                    param.Clear();
                    param.Add("id_gys", head.id_gys);
                    Tb_Gys_Account Bank = BusinessFactory.BankAccount.GetDefault(param).Data as Tb_Gys_Account;
                    if (Bank != null)
                    {
                        model.khr          = Bank.khr;
                        model.name_bank    = Bank.name_bank;
                        model.account_bank = Bank.account_bank;
                    }
                }
            }
            catch (CySoftException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult Add(Tb_Gys_Account model)
        {
            BaseResult br = new BaseResult();

            if (model.account_bank.IsEmpty())
            {
                br.Success = false;
                br.Message.Add("银行账号不能为空");
                br.Level = ErrorLevel.Warning;
                br.Data  = "account_bank";
                return(Json(br));
            }
            if (model.khr.IsEmpty())
            {
                br.Success = false;
                br.Message.Add("开户人不能为空");
                br.Level = ErrorLevel.Warning;
                br.Data  = "khr";
                return(Json(br));
            }
            if (model.name_bank.IsEmpty())
            {
                br.Success = false;
                br.Message.Add("开户银行不能为空");
                br.Level = ErrorLevel.Warning;
                br.Data  = "name_bank";
                return(Json(br));
            }

            try
            {
                model.id        = BusinessFactory.Utilety.GetNextKey(typeof(Tb_Gys_Account));
                model.id_gys    = GetLoginInfo <long>("id_supplier");
                model.id_create = GetLoginInfo <long>("id_user");
                model.id_edit   = GetLoginInfo <long>("id_user");
                br = BusinessFactory.BankAccount.Save(model);
            }
            catch (CySoftException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(br));
        }
Ejemplo n.º 5
0
        public BaseResult SetDefault(Hashtable param)
        {
            BaseResult br     = new BaseResult();
            long       id     = Convert.ToInt64(param["id"]);
            long       id_gys = Convert.ToInt64(param["id_gys"]);

            param.Clear();
            param.Add("id", id);
            if (DAL.GetCount(typeof(Tb_Gys_Account), param) <= 0)
            {
                br.Success = false;
                br.Message.Add(string.Format("停用银行账号失败,该账号不存在或资料已缺失!"));
                br.Level = ErrorLevel.Warning;
                return(br);
            }

            param.Clear();
            param.Add("id_gys", id_gys);
            param.Add("flag_default", 1);
            Tb_Gys_Account OldDefaultMOdel = DAL.QueryList <Tb_Gys_Account>(typeof(Tb_Gys_Account), param).FirstOrDefault();

            if (OldDefaultMOdel != null)
            {
                param.Clear();
                param.Add("id", OldDefaultMOdel.id);
                param.Add("new_flag_default", 0);
                DAL.UpdatePart(typeof(Tb_Gys_Account), param);
            }

            param.Clear();
            param.Add("id", id);
            param.Add("new_flag_default", 1);
            param.Add("new_flag_stop", 0);
            int result = DAL.UpdatePart(typeof(Tb_Gys_Account), param);

            if (result > 0)
            {
                br.Success = false;
                br.Message.Add(String.Format("设置默认银行账号失败。信息:账号流水号:{0}", id));
                br.Level = ErrorLevel.Error;
                return(br);
            }

            br.Success = true;
            br.Message.Add(String.Format("设置默认银行账号成功。"));
            return(br);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 停用账号
        /// znt 2015-04-24
        /// </summary>
        public override BaseResult Stop(Hashtable param)
        {
            BaseResult br      = new BaseResult();
            long       id      = Convert.ToInt64(param["id"]);
            long       id_edit = Convert.ToInt64(param["id_edit"]);

            param.Clear();
            param.Add("id", id);
            Tb_Gys_Account model = DAL.GetItem <Tb_Gys_Account>(typeof(Tb_Gys_Account), param);

            if (model == null)
            {
                br.Success = false;
                br.Message.Add(string.Format("停用银行账号失败,该账号不存在或资料已缺失!"));
                br.Level = ErrorLevel.Warning;
                return(br);
            }

            if (model.flag_default == 1)
            {
                br.Success = false;
                br.Message.Add(string.Format("{0}【{1}】账号为默认账号,不可禁用!", model.name_bank, model.account_bank));
                br.Level = ErrorLevel.Warning;
                return(br);
            }

            param.Clear();
            param.Add("id", id);
            param.Add("new_flag_stop", 1);
            param.Add("new_id_edit", id_edit);
            param.Add("new_rq_edit", DateTime.Now);
            int result = DAL.UpdatePart(typeof(Tb_Gys_Account), param);

            if (result > 0)
            {
                br.Success = false;
                br.Message.Add(String.Format("停用银行账号失败。信息:账号流水号:{0}", model.id));
                br.Level = ErrorLevel.Error;
                return(br);
            }

            br.Success = true;
            br.Message.Add(String.Format("停用银行账号成功。信息:账号流水号:{0}", model.id));
            return(br);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 单个
        /// znt 2015-04-24
        /// </summary>
        public override BaseResult Get(Hashtable param)
        {
            BaseResult br = new BaseResult();
            long       id = Convert.ToInt64(param["id"]);

            param.Clear();
            param.Add("id", id);
            Tb_Gys_Account model = DAL.GetItem <Tb_Gys_Account>(typeof(Tb_Gys_Account), param);

            if (model == null)
            {
                br.Success = false;
                br.Message.Add(string.Format("停用银行账号失败,该账号不存在或资料已缺失!"));
                br.Level = ErrorLevel.Warning;
                return(br);
            }

            br.Data    = model;
            br.Success = true;
            return(br);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 保存账号信息
        /// znt 2015-04-24
        /// </summary>
        public override BaseResult Save(dynamic entity)
        {
            BaseResult     br    = new BaseResult();
            Tb_Gys_Account model = (Tb_Gys_Account)entity;
            Hashtable      param = new Hashtable();

            param.Add("id", model.id);
            if (DAL.GetCount(typeof(Tb_Gys_Account), param) > 0)
            {
                param.Clear();
                param.Add("id", model.id);
                param.Add("new_name_bank", model.name_bank);
                param.Add("new_account_bank", model.account_bank);
                param.Add("new_khr", model.khr);
                param.Add("new_id_edit", model.id_edit);
                param.Add("new_rq_edit", model.rq_edit);
                DAL.UpdatePart(typeof(Tb_Gys_Account), param);
                br.Success = true;
                return(br);
            }
            else
            {
                param.Clear();
                param.Add("id_gys", model.id_gys);
                if (DAL.GetCount(typeof(Tb_Gys_Account), param) > 0)
                {
                    model.flag_default = 0;
                    DAL.Add(model);
                }
                else
                {
                    model.flag_default = 1;
                    DAL.Add(model);
                }
            }

            br.Success = true;
            return(br);
        }