Exemplo n.º 1
0
        /// <summary>
        /// 确认按钮
        /// </summary>
        public override void OKExecute()
        {
            if (Models == null && CurrentObj.AM_JgAccount != null)
            {
                if (Check() && VMHelp.AskMessage("确认要进行开户?"))
                {
                    ObservableCollection <FundsRegulatoryClient.JG_InterestRateSrv.JG_InterestRateInfo> rate = InterestRateClient.Selects();
                    if (rate.Count > 0)
                    {
                        CurrentObj.AM_ID         = Guid.NewGuid().ToString();
                        CurrentObj.AM_BankCode   = "07";//银行代码
                        CurrentObj.AM_CreateDate = DateTime.Parse(VMHelp.NowTime);
                        //bool result = client.Add(CurrentObj);
                        //对象赋值转换
                        FundsRegulatoryClient.SqlTransSvr.JG_AccountManageInfo tempacc = new FundsRegulatoryClient.SqlTransSvr.JG_AccountManageInfo();
                        tempacc.AM_ID          = CurrentObj.AM_ID;
                        tempacc.AM_BankCode    = VMHelp.BankCode;//银行代码
                        tempacc.AM_CreateDate  = DateTime.Parse(VMHelp.NowTime);
                        tempacc.AM_CorpName    = CurrentObj.AM_CorpName;
                        tempacc.AM_ItemName    = CurrentObj.AM_ItemName;
                        tempacc.AM_JgAccount   = CurrentObj.AM_JgAccount;
                        tempacc.AM_ProjectCode = CurrentObj.AM_ProjectCode;
                        tempacc.AM_UseFlag     = CurrentObj.AM_UseFlag;
                        tempacc.AM_zhmc        = CurrentObj.AM_zhmc;
                        tempacc.AM_Person      = CurrentObj.AM_Person;;
                        FundsRegulatoryClient.SqlTransSvr.DayBalance db = new FundsRegulatoryClient.SqlTransSvr.DayBalance();
                        //每天余额表添加一条
                        db.DB_ID           = CurrentObj.AM_ID;
                        db.DB_AccountNum   = CurrentObj.AM_JgAccount;
                        db.DB_Balance      = 0;
                        db.DB_InterestRate = rate[0].InterestRate;     //利率;
                        db.DB_Time         = DateTime.Parse(DateTime.Now.ToShortDateString());
                        db.ID = Guid.NewGuid().ToString();
                        //  bool result2 = InterestClient.AddJG_DayBalanceInfo(db);
                        //季度结息表增加一条
                        FundsRegulatoryClient.SqlTransSvr.SeasonInterest si = new FundsRegulatoryClient.SqlTransSvr.SeasonInterest();
                        DateTime?dt = FinancialRegulation.Tools.HelpClass.Current.SYSCONFIG.PayAccuralDate;
                        if (dt == null || dt.Value.AddMonths(3) < DateTime.Parse(DateTime.Now.ToShortDateString()))
                        {
                            VMHelp.ShowMessage("请先设置结息日期", false);
                            return;
                        }
                        if (dt.Value < DateTime.Parse(DateTime.Now.ToShortDateString()))
                        {
                            si.SI_Time = dt.Value.AddMonths(3);
                        }
                        else
                        {
                            si.SI_Time = dt.Value;
                        }
                        //si.SI_Time = db.DB_Time.Value.AddMonths(3);
                        si.SI_ID         = CurrentObj.AM_ID;
                        si.SI_AccountNum = db.DB_AccountNum;
                        si.ID            = Guid.NewGuid().ToString();
                        // bool result3 = InterestClient.AddJG_SeasonInterestInfo(si);

                        if (tranClient.CreateAccountSIDB(tempacc, si, db, 1))
                        {
                            VMHelp.ShowMessage("开户成功!", true);
                            windowClose();
                        }
                        else
                        {
                            VMHelp.ShowMessage("开户信息保存失败", false);
                        }
                    }
                    else
                    {
                        VMHelp.ShowMessage("请先设置利率", false);
                    }
                }
            }
            else if (Check() && VMHelp.AskMessage("确认要进行修改?"))
            {
                bool result = client.Update(CurrentObj);
                if (result)
                {
                    int index = this.Models.IndexOf(para);
                    if (index > -1)
                    {
                        this.Models[index] = CurrentObj;
                    }
                    VMHelp.ShowMessage("账户修改成功!", true);
                    windowClose();
                }
                else
                {
                    VMHelp.ShowMessage("账户修改信息保存失败", false);
                }
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="obj"></param>
        public override void ModifyExecute()
        {
            //if (CurModel.AM_ID!=null)
            //{
            //    //FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo jj = (FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo)obj;
            //    ObservableCollection<JG_AccountManageInfo> temp = new ObservableCollection<JG_AccountManageInfo>();
            //    int index = this.Models.IndexOf(CurModel);
            //    OpenAccountAddToEdit page = new OpenAccountAddToEdit(CurModel, Models);
            //    page.ShowDialog();
            //    this.dg.SelectedIndex = index;
            //  //  this.Models[index] = CurModel;
            //    //foreach (JG_AccountManageInfo item in this.Models)
            //    //{
            //    //    temp.Add(item);
            //    //}
            //    //this.Models.Clear();
            //    //this.Models = temp;
            //  //  FlushExecute();
            //}
            if (CurModel.AM_ID != null)
            {
                // FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo jj = (FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo)obj;
                int index = Models.IndexOf(CurModel);//检索列表中是否存在该项
                if (index > -1)
                {
                    if (CurModel.AM_UseFlag == "正常")
                    {
                        VMHelp.ShowMessage("账户已经启用", false); return;
                    }
                    CurModel.AM_UseFlag = "正常";

                    ObservableCollection <FundsRegulatoryClient.JG_InterestRateSrv.JG_InterestRateInfo> rate = InterestRateClient.Selects();
                    int i = 0;
                    for (; i < rate.Count; i++)
                    {
                        if (rate[i].Flag == "1")
                        {
                            break;
                        }
                    }
                    if (rate.Count < 1 || i == rate.Count)
                    {
                        VMHelp.ShowMessage("未启用最新利率或设置利率", false); return;
                    }
                    FundsRegulatoryClient.InterestService.DayBalance db = new FundsRegulatoryClient.InterestService.DayBalance();
                    db.DB_ID = CurModel.AM_ID;
                    //  db.DB_Time = DateTime.Parse(DateTime.Now.ToShortDateString());
                    ObservableCollection <FundsRegulatoryClient.InterestService.DayBalance> dblist = InterestClient.SelectJG_DayBalanceInfo(db);
                    FundsRegulatoryClient.SqlTransSvr.JG_AccountManageInfo tempacc = new FundsRegulatoryClient.SqlTransSvr.JG_AccountManageInfo();

                    tempacc.AM_ID          = CurModel.AM_ID;
                    tempacc.AM_BankCode    = VMHelp.BankCode;//银行代码
                    tempacc.AM_CreateDate  = DateTime.Parse(VMHelp.NowTime);
                    tempacc.AM_CorpName    = CurModel.AM_CorpName;
                    tempacc.AM_ItemName    = CurModel.AM_ItemName;
                    tempacc.AM_JgAccount   = CurModel.AM_JgAccount;
                    tempacc.AM_ProjectCode = CurModel.AM_ProjectCode;
                    tempacc.AM_UseFlag     = CurModel.AM_UseFlag;
                    tempacc.AM_zhmc        = CurModel.AM_zhmc;
                    tempacc.AM_Person      = CurModel.AM_Person;


                    FundsRegulatoryClient.SqlTransSvr.DayBalance tempdb = new FundsRegulatoryClient.SqlTransSvr.DayBalance();
                    //每天余额表添加一条
                    tempdb.DB_ID           = CurModel.AM_ID;
                    tempdb.DB_AccountNum   = CurModel.AM_JgAccount;
                    tempdb.DB_InterestRate = rate[0].InterestRate;     //利率;
                    tempdb.DB_Time         = DateTime.Parse(DateTime.Now.ToShortDateString());
                    if (dblist.Count > 0)
                    {
                        tempdb.DB_Balance = dblist[dblist.Count - 1].DB_Balance;
                    }
                    else
                    {
                        tempdb.DB_Balance = null;
                    }
                    tempdb.ID = Guid.NewGuid().ToString();
                    //季度结息表更新
                    FundsRegulatoryClient.SqlTransSvr.SeasonInterest     si     = new FundsRegulatoryClient.SqlTransSvr.SeasonInterest();
                    FundsRegulatoryClient.InterestService.SeasonInterest tempsi = new FundsRegulatoryClient.InterestService.SeasonInterest();

                    tempsi.SI_ID = si.SI_ID = tempdb.DB_ID;
                    ObservableCollection <FundsRegulatoryClient.InterestService.SeasonInterest> silist = InterestClient.SelectJG_SeasonInterestInfo(tempsi);
                    si.SI_Time       = tempdb.DB_Time.Value.AddMonths(3);
                    si.SI_AccountNum = tempdb.DB_AccountNum;

                    if (dblist[dblist.Count - 1].DB_Time == DateTime.Parse(DateTime.Now.ToShortDateString()))
                    {
                        if (tranClient.CreateAccountSIDB(tempacc, null, null, 2))
                        {
                            VMHelp.ShowMessage("启用成功!", true);
                        }
                        else
                        {
                            VMHelp.ShowMessage("启用失败", false);
                        }
                    }
                    else if (silist[silist.Count - 1].SI_Time <= DateTime.Parse(DateTime.Now.ToShortDateString()))
                    {
                        si.ID = silist[silist.Count - 1].ID;
                        if (tranClient.CreateAccountSIDB(tempacc, si, tempdb, 2))
                        {
                            VMHelp.ShowMessage("启用成功!", true);
                            // windowClose();
                        }
                        else
                        {
                            VMHelp.ShowMessage("启用失败", false);
                        }
                    }
                    FlushExecute();
                }
            }
        }
Exemplo n.º 3
0
        //TODO:在此处添加命令

        #endregion 命令定义

        #region 命令方法
        /// <summary>
        /// 利息结算
        /// </summary>
        public void InterestCommandExecute()
        {
            bool ISinterest = false;

            //if (!Check()) { return; }
            if (!VMHelp.AskMessage("是否进行结息?"))
            {
                return;
            }
            if (DayBalanceList.Count < 1)
            {
                VMHelp.ShowMessage("当前余额表为空,无法结息", false);
                return;
            }
            SeasonInterest si = new SeasonInterest();

            si.SI_AccountNum = SelectedSeanson.SI_AccountNum;
            si.SI_ID         = SelectedSeanson.SI_ID;

            DateTime?dt = FinancialRegulation.Tools.HelpClass.Current.SYSCONFIG.PayAccuralDate;

            if (dt == null)
            {
                //if (dt < DateTime.Parse(DateTime.Now.ToShortDateString()))
                //{
                VMHelp.ShowMessage("请先设置结息日期", false);
                return;
                //}
            }
            else if (dt > DateTime.Parse(DateTime.Now.ToShortDateString()) || SelectedSeanson.SI_Time != dt.Value)
            {
                VMHelp.AskMessage("结息日期为" + VMHelp.SYSCONFIG.PayAccuralDate.Value.ToShortDateString() + ",不能进行结息");
                return;
            }
            else
            {
                FundsRegulatoryClient.SysConfigClient client = FundsRegulatoryClient.SysConfigClient.Instance;
                VMHelp.SYSCONFIG.PayAccuralDate = VMHelp.SYSCONFIG.PayAccuralDate.Value.AddMonths(3);
                client.Update(VMHelp.SYSCONFIG);
            }
            ObservableCollection <DayBalance> temp = new ObservableCollection <DayBalance>();
            ObservableCollection <FundsRegulatoryClient.SqlTransSvr.DayBalance> Tran_temp = new ObservableCollection <FundsRegulatoryClient.SqlTransSvr.DayBalance>();

            decimal?money = 0;

            foreach (DayBalance db in DayBalanceList)
            {
                db.DB_Interest = db.DB_InterestRate * db.DB_Balance / 365;
                money         += db.DB_Interest;
                money          = decimal.Parse(money.Value.ToString("f2"));
                temp.Add(db);
                FundsRegulatoryClient.SqlTransSvr.DayBalance Tran_db = new FundsRegulatoryClient.SqlTransSvr.DayBalance();
                Tran_db.ID              = db.ID;
                Tran_db.DB_Interest     = db.DB_Interest;
                Tran_db.DB_InterestRate = db.DB_InterestRate;

                Tran_temp.Add(Tran_db);
            }
            money = decimal.Parse(money.Value.ToString("f2"));
            //结息时,将利息加到之后的余额上。
            if (Tran_temp == null || Tran_temp.Count == 0)
            {
                return;
            }
            foreach (var item in  MoreInterestList)
            {
                item.DB_Balance += money;
                Tran_temp.Add(item);
            }

            DayBalanceList.Clear();
            DayBalanceList         = temp;
            InterestAmount         = money;
            si.SI_Money            = money;
            si.SI_Time             = SelectedSeanson.SI_Time;
            si.SI_Memo             = Memo;
            si.SI_BankSerialNumber = VMHelp.ServiceNo;
            si.SI_BankTellerID     = VMHelp.UserCode;
            si.SI_CertificateNum   = VMHelp.BankCode + DateTime.Now.ToString("yyyyMMdd");
            si.ID = SelectedSeanson.ID;
            //利息消息
            //Request07 request = new Request07();
            //request.DepositNum = SelectedSeanson.SI_CertificateNum;
            //request.BankCode = VMHelp.BankCode;
            //request.BusinessCode = Tools.PublicData.InterestRecord;
            //request.InterestAmount = money;
            //request.ProjectCode = SelectedAccount.AccountInfo.AM_ProjectCode;
            //request.RecordInstr = Memo;

            ////消息发送
            //response = new Response07();
            //try
            //{
            //    response = SendMessage<Response07>(request, VMHelp.PointCode, VMHelp.UserCode);//发送Messageresponse.ReturnCode =="03"
            //}
            //catch (Exception ex)
            //{
            //    SendExcetpion(ex);
            //    return;
            //}
            //if (response.ReturnCode != Tools.PublicData.ResponseSuccess)// && response.ReturnCode == Tools.PublicData.)
            //{ VMHelp.ShowMessage(Tools.HelpClass.Current.MsgDIC[response.ReturnCode], false); return; }
            //if (response.ReturnCode == Tools.PublicData.DepositSuccess && !VMHelp.AskMessage("缴款书已完成缴费,是否存数据库?"))
            //{
            //    return;
            //}
            FundsRegulatoryClient.SqlTransSvr.SeasonInterest SI_temp = new FundsRegulatoryClient.SqlTransSvr.SeasonInterest();
            SI_temp.SI_Money = si.SI_Money;
            //SI_temp.SI_Time = si.SI_Time;
            SI_temp.SI_Memo             = si.SI_Memo;
            SI_temp.SI_BankSerialNumber = si.SI_BankSerialNumber;//本系统产生的流水号
            SI_temp.SI_BankTellerID     = si.SI_BankTellerID;
            SI_temp.SI_CertificateNum   = si.SI_CertificateNum;
            SI_temp.ID = SelectedSeanson.ID;
            if (SelectedSeanson.SI_Time < DateTime.Parse(DateTime.Now.ToShortDateString()))
            {
                SI_temp.SI_Time = SelectedSeanson.SI_Time;
                si.SI_Time      = SelectedSeanson.SI_Time;
            }

            if (!TranClient.Update_DbAndSI(Tran_temp.ToList <FundsRegulatoryClient.SqlTransSvr.DayBalance>(), SI_temp, 2))
            {
                VMHelp.ShowMessage("结息失败", false);
                return;
            }
            //foreach (DayBalance db in DayBalanceList)
            //{
            //    InterestClient.UpdateJG_DayBalanceInfo(db);
            //}
            //InterestClient.UpdateJG_SeasonInterestInfo(si);
            //季度结息新插入一条

            int index = dg.SelectedIndex;

            if (index > -1)
            {
                SeansonList[index] = si;
                dg.SelectedIndex   = index;
            }
            //插入一条季度结息
            SeasonInterest Insert = new SeasonInterest();

            Insert.ID = VMHelp.GUID;

            Insert.SI_Time = DateTime.Parse(DateTime.Now.ToShortDateString()).AddMonths(3);
            if (SelectedSeanson.SI_Time < DateTime.Parse(DateTime.Now.ToShortDateString()))
            {
                Insert.SI_Time = SelectedSeanson.SI_Time.Value.AddMonths(3);
                FundsRegulatoryClient.SysConfigClient client = FundsRegulatoryClient.SysConfigClient.Instance;
                VMHelp.SYSCONFIG.PayAccuralDate = Insert.SI_Time;
                client.Update(VMHelp.SYSCONFIG);
            }
            Insert.SI_AccountNum = si.SI_AccountNum;
            Insert.SI_ID         = si.SI_ID;
            this.SeansonList.Add(Insert);
            InterestClient.AddJG_SeasonInterestInfo(Insert);
            //if (ISinterest)
            //{
            //if (!VMHelp.AskMessage("是否将 " + VMHelp.SYSCONFIG.PayAccuralDate.Value.ToShortDateString() + " 设置为新的结息日期"))
            //{
            //    return;
            //}
            // }
            VMHelp.ShowMessage(true);
            FlushExecute();
        }