Exemple #1
0
        public string PostDelete([FromBody] InfoBaseModel <List <long> > phids)
        {
            var deletedresult = new DeletedResult();

            if (phids.infoData.Count > 0)
            {
                List <long> usePhids = BankAccountService.judgeIfUse(phids.infoData);
                if (usePhids.Count > 0)
                {
                    string Msg = "银行账户名称为";
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <List <long> > .In("PhId", usePhids));
                    IList <BankAccountModel> bankAccounts = BankAccountService.Find(dic).Data;
                    foreach (BankAccountModel bankAccount in bankAccounts)
                    {
                        Msg = Msg + bankAccount.FBankname + ",";
                    }
                    Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能删除";
                    deletedresult.Status = ResponseStatus.Error;
                    deletedresult.Msg    = Msg;
                }
                else
                {
                    for (var i = 0; i < phids.infoData.Count; i++)
                    {
                        deletedresult = BankAccountService.Delete <System.Int64>(phids.infoData[i]);
                        //BankAccountService.Find(t => phids.infoData.Contains(t.PhId));
                    }
                }
            }

            return(DataConverterHelper.SerializeObject(deletedresult));
        }
Exemple #2
0
        public async Task <string> PostRefreshPaymentsState([FromBody] InfoBaseModel <long[]> parameters)
        {
            if (parameters.infoData == null || parameters.infoData.Length < 0)
            {
                return(DCHelper.ErrorMessage("单据主键Phid为空!"));
            }

            /*
             * ICBCNCService icbcService = new ICBCNCService();
             * bool httpsState, signState;
             * string msg = icbcService.CheckNetSafeClient(out httpsState, out signState);
             * if (httpsState == false || signState == false)
             * {
             *  return DCHelper.ErrorMessage(msg + "  请联系系统管理员排查问题");
             * }
             */

            string errMsg = string.Empty;

            foreach (long id in parameters.infoData)
            {
                GKPaymentMstService.RefreshPaymentState(id, out errMsg);
            }

            return(DCHelper.SuccessMessage("批量刷新支付状态提交成功,后台处理中!"));
        }
Exemple #3
0
        public string PostAdd([FromBody] InfoBaseModel <GKPaymentModel> parameters)
        {
            try
            {
                //增加后台数据检查:比如年度、会计期、凭证日期、组织id、组织号等


                if (string.IsNullOrWhiteSpace(parameters.infoData.Mst.OrgCode))
                {
                    return(DCHelper.ErrorMessage("缺少组织号!"));
                }

                if (parameters.infoData.Mst.OrgPhid <= 0)
                {
                    return(DCHelper.ErrorMessage("组织Id有误!"));
                }

                if (string.IsNullOrWhiteSpace(parameters.infoData.Mst.FBilltype))
                {
                    return(DCHelper.ErrorMessage("缺少单据类型!"));
                }


                SavedResult <Int64> savedResult = this.GKPaymentMstService.SaveGKPayment(parameters.infoData);

                return(DataConverterHelper.SerializeObject(savedResult));
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
Exemple #4
0
        public IActionResult EditarInfo(InfoBaseModel info)
        {
            _vh = new InfoBaseModelViewHelper
            {
                ViewModel = info
            };

            Cliente clienteRequest = (Cliente)_vh.Entidades[typeof(Cliente).Name];

            Cliente clienteDb = _facade.Query <Cliente>(c => c.Codigo == clienteRequest.Codigo,
                                                        c => c,
                                                        c => c.Usuario).FirstOrDefault();

            clienteDb.Cpf           = clienteRequest.Cpf;
            clienteDb.DtNascimento  = clienteRequest.DtNascimento;
            clienteDb.Genero        = clienteRequest.Genero;
            clienteDb.Nome          = clienteRequest.Nome;
            clienteDb.Usuario.Email = clienteRequest.Usuario.Email;

            string msg = _facade.Editar(clienteDb);

            if (msg == "")
            {
                return(RedirectToAction(nameof(Detalhes)));
            }
            TempData["Alert"] = msg;
            return(RedirectToAction("Registro"));
        }
Exemple #5
0
        public string PostSave([FromBody] InfoBaseModel <List <BankAccountModel> > bankAccount)
        {
            /*UnChanged = 0,
             * Added = 1,
             * Modified = 2,
             * Deleted = 3*/
            SavedResult <Int64> savedresult = new SavedResult <Int64>();
            List <long>         modifyPhids = new List <long>();

            foreach (BankAccountModel data in bankAccount.infoData)
            {
                if (data.PersistentState == PersistentState.Modified || data.PersistentState == PersistentState.Deleted)
                {
                    modifyPhids.Add(data.PhId);
                }
            }
            if (modifyPhids.Count > 0)
            {
                List <long> usePhids = BankAccountService.judgeIfUse(modifyPhids);
                if (usePhids.Count > 0)
                {
                    string Msg = "银行账户名称为";
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <List <long> > .In("PhId", usePhids));
                    IList <BankAccountModel> bankAccounts = BankAccountService.Find(dic).Data;
                    foreach (BankAccountModel a in bankAccounts)
                    {
                        Msg = Msg + a.FBankname + ",";
                    }
                    var data2 = bankAccount.infoData.Find(x => x.PhId == usePhids[0]);//因为只能删除或修改所以单据的状态只能是一个
                    if (data2.PersistentState == PersistentState.Deleted)
                    {
                        Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能删除";
                    }
                    else
                    {
                        Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能修改";
                    }
                    savedresult.Status = ResponseStatus.Error;
                    savedresult.Msg    = Msg;
                    return(DataConverterHelper.SerializeObject(savedresult));
                }
            }

            try
            {
                savedresult = BankAccountService.Save <Int64>(bankAccount.infoData, "");
            }
            catch (Exception ex)
            {
                savedresult.Status = ResponseStatus.Error;
                savedresult.Msg    = ex.Message.ToString();
            }

            return(DataConverterHelper.SerializeObject(savedresult));
        }
Exemple #6
0
        public async Task <string> PostUpdatePaymentsState([FromBody] InfoBaseModel <long[]> parameters)
        {
            if (parameters.infoData == null || parameters.infoData.Length < 0)
            {
                return(DCHelper.ErrorMessage("单据主键Phid为空!"));
            }

            if (string.IsNullOrEmpty(parameters.value))
            {
                return(DCHelper.ErrorMessage("单据状态为空!"));
            }

            if (int.Parse(parameters.value) != (int)EnumPaymentState.Paid)
            {
                return(DCHelper.ErrorMessage("单据状态仅能更新为支付成功!"));
            }

            if (string.IsNullOrEmpty(parameters.uid))
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }

            string errMsg   = string.Empty;
            byte   payState = byte.Parse(parameters.value);
            long   uid      = long.Parse(parameters.uid);

            //判断支付方式为网银的需要更新

            /*
             * Dictionary<string, object> PayMethoddic = new Dictionary<string, object>();
             * new CreateCriteria(PayMethoddic)
             *  .Add(ORMRestrictions<string>.Eq("DicType", "PayMethod"))
             *  .Add(ORMRestrictions<Byte>.Eq("Issystem", 1))
             *  .Add(ORMRestrictions<String>.Eq("TypeName", "网银"));
             * IList<QTSysSetModel> PayMethods = QTSysSetService.Find(PayMethoddic).Data;
             * if (PayMethods.Count > 0)
             * {
             *  foreach (long id in parameters.infoData)
             *  {
             *      GKPaymentMstModel gKPaymentMst = GKPaymentMstService.Find(id).Data;
             *      if (gKPaymentMst.FPaymethod == PayMethods[0].PhId)
             *      {
             *          this.GKPaymentMstService.UpdatePaymentState(id, payState, uid);
             *      }
             *  }
             * }
             */
            //直接更新状态
            foreach (long id in parameters.infoData)
            {
                this.GKPaymentMstService.UpdatePaymentState(id, payState, uid);
            }

            return(DCHelper.SuccessMessage("批量更新支付状态提交成功,后台处理中!"));
        }
        public InfoBaseModel ToInfoBaseModel(Cliente input)
        {
            InfoBaseModel baseModel = new InfoBaseModel();

            baseModel.Nome         = input.Nome;
            baseModel.Email        = input.Usuario.Email;
            baseModel.Cpf          = input.Cpf;
            baseModel.DtNascimento = input.DtNascimento;
            baseModel.Genero       = input.Genero;
            baseModel.Codigo       = input.Codigo;

            return(baseModel);
        }
        protected override void ToEntidade()
        {
            InfoBaseModel vm      = (InfoBaseModel)ViewModel;
            Cliente       cliente = new Cliente
            {
                Cpf          = vm.Cpf,
                Codigo       = vm.Codigo,
                DtNascimento = vm.DtNascimento,
                Genero       = vm.Genero,
                Nome         = vm.Nome
            };

            cliente.Usuario.Email = vm.Email;

            Entidades[typeof(Cliente).Name] = cliente;
        }
        protected override void ToViewModel()
        {
            Cliente cliente = (Cliente)Entidades[typeof(Cliente).Name];

            InfoBaseModel vm = new InfoBaseModel
            {
                Nome         = cliente.Nome,
                Email        = cliente.Usuario.Email,
                Cpf          = cliente.Cpf,
                DtNascimento = cliente.DtNascimento,
                Genero       = cliente.Genero,
                Codigo       = cliente.Codigo
            };

            vm.Email = cliente.Usuario.Email;

            _viewModel = vm;
        }
Exemple #10
0
        public string PostUpdate([FromBody] InfoBaseModel <GKPaymentModel> parameters)
        {
            try
            {
                if (parameters == null || string.IsNullOrEmpty(parameters.uid))
                {
                    return(DCHelper.ErrorMessage("用户id为空!"));
                }

                if (string.IsNullOrWhiteSpace(parameters.infoData.Mst.OrgCode))
                {
                    return(DCHelper.ErrorMessage("缺少组织号!"));
                }

                if (parameters.infoData.Mst.OrgPhid <= 0)
                {
                    return(DCHelper.ErrorMessage("组织Id有误!"));
                }

                if (string.IsNullOrWhiteSpace(parameters.infoData.Mst.FBilltype))
                {
                    return(DCHelper.ErrorMessage("缺少单据类型!"));
                }
                var flam2 = parameters.infoData.Mst.FDelete;
                if (flam2 == (byte)EnumYesNo.Yes)
                {
                    return(DCHelper.ErrorMessage("作废的单据不允许进行修改!"));
                }

                SavedResult <Int64> savedResult = this.GKPaymentMstService.SaveGKPayment(parameters.infoData);

                return(DataConverterHelper.SerializeObject(savedResult));
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
Exemple #11
0
        public string PostAddProc([FromBody] InfoBaseModel <List <GAppvalProcModel> > infoBase)
        {
            if (infoBase == null || infoBase.infoData == null || infoBase.infoData.Count == 0)
            {
                return(DCHelper.ErrorMessage("审批流程对象为空!"));
            }

            try
            {
                SavedResult <Int64> savedResult = GAppvalProcService.PostAddProcs(infoBase.infoData);
                if (savedResult != null && savedResult.SaveRows > 0)
                {
                    return(DCHelper.SuccessMessage("新增审批流程成功!"));
                }
                else
                {
                    return(DCHelper.ErrorMessage("新增审批流程失败!"));
                }
            }
            catch (Exception e) {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }