コード例 #1
0
        public TransferMoneyEntity GetDataIntoModel()
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData = purchaseRepository.GetOptionSettings();
            TransferMoneyEntity model = new TransferMoneyEntity();

            model.SelectedtransferFromCashAndBankAcntID = this.SelectedtransferFromCashAndBankAcntID;
            model.SelectedtransferToCashBankAcntID      = this.SelectedtransferToCashBankAcntID;
            model.CashChequeDate = DateTime.ParseExact(this.CashChequeDateStr, oData.DateFormat, null);
            model.CashChequeNo   = this.CashChequeNo;
            model.AmountStr      = AmountStr;
            model.Amount         = Convert.ToDecimal(AmountStr);
            model.TransferFromBeforeBalanceStr = this.TransferFromBeforeBalanceStr;
            model.TransferFromBeforeBalance    = Convert.ToDecimal(TransferFromBeforeBalance);
            model.TransferFromAfterBalanceStr  = this.TransferFromAfterBalanceStr;
            model.TransferFromAfterBalance     = Convert.ToDecimal(TransferFromAfterBalance);
            model.TransferToBeforeBalanceStr   = this.TransferToBeforeBalanceStr;
            model.TransferToBeforeBalance      = Convert.ToDecimal(TransferToBeforeBalance);
            model.TransferToAfterBalanceStr    = this.TransferToAfterBalanceStr;
            model.TransferToAfterBalance       = Convert.ToDecimal(TransferToAfterBalance);
            model.TaxRate  = this.TaxRate;
            model.Remarks  = this.Remarks;
            model.IsCheque = this.IsCheque;

            return(model);
        }
コード例 #2
0
        public TransferMoneyEntity GetTransferMoneyDetails(string cashChequeNo)
        {
            TransferMoneyEntity transferMoney = new TransferMoneyEntity();

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    TransferMoney cbt = entities.TransferMoneys.SingleOrDefault(e => e.Cheque_No == cashChequeNo);
                    if (cbt != null)
                    {
                        transferMoney.ID = cbt.ID;
                        transferMoney.SelectedtransferFromCashAndBankAcntID = cbt.From_Acc_Id;
                        transferMoney.SelectedtransferToCashBankAcntID      = cbt.To_Acc_Id;
                        transferMoney.IsCheque       = cbt.Cheque;
                        transferMoney.CashChequeNo   = cbt.Cheque_No;
                        transferMoney.CashChequeDate = cbt.Cheque_Date;
                        transferMoney.Remarks        = cbt.Remarks;
                        transferMoney.Amount         = cbt.Amount;
                        transferMoney.Remarks        = cbt.Remarks;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(transferMoney);
        }
コード例 #3
0
        private void GetModelData(TransferMoneyEntity rmf)
        {
            if (IsNew == false)
            {
                this.SelectedtransferFromCashAndBankAcntID = rmf.SelectedtransferFromCashAndBankAcntID;
                this.SelectedtransferToCashBankAcntID      = rmf.SelectedtransferToCashBankAcntID;

                this.CashChequeNo  = rmf.CashChequeNo;
                this.IsCheque      = rmf.IsCheque;
                this.SelectedTaxID = rmf.SelectedTaxID;
                this.AmountStr     = Convert.ToString(rmf.Amount);
                this.Remarks       = rmf.Remarks;
            }
        }
コード例 #4
0
        private void GetTransferMoneyDetails(string cashChequeNo)
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData               = purchaseRepository.GetOptionSettings();
            IsNew               = false;
            IsTextBoxReadOnly   = true;
            IsCashChequeEnabled = false;
            TransferMoneyEntity pqf       = rmRepository.GetTransferMoneyDetails(cashChequeNo);
            DateTime            Dateinstr = (DateTime)pqf.CashChequeDate;

            this.CashChequeDateStr = Dateinstr.ToString(oData.DateFormat);
            GetModelData(pqf);
        }
コード例 #5
0
        private string ValidateRefundFromSupplier()
        {
            string msg = string.Empty;
            TransferMoneyEntity rsEntity = GetDataIntoModel();
            var Response = rmRepository.CashChequeValidation(rsEntity.CashChequeNo);

            if (Response == true)
            {
                msg = "This Cheque no. is already exist";
            }
            else
            {
                msg = string.Empty;
            }
            return(msg);
        }
コード例 #6
0
        public int SaveTransferMoney(TransferMoneyEntity transferMoney)
        {
            int autoId = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    TransferMoney cbt = new TransferMoney();
                    cbt.From_Acc_Id = transferMoney.SelectedtransferFromCashAndBankAcntID;
                    cbt.To_Acc_Id   = transferMoney.SelectedtransferToCashBankAcntID;
                    cbt.Cheque      = transferMoney.IsCheque;
                    cbt.Cheque_No   = transferMoney.CashChequeNo;
                    cbt.Cheque_Date = transferMoney.CashChequeDate;
                    cbt.Remarks     = transferMoney.Remarks;
                    cbt.Amount      = transferMoney.Amount;
                    cbt.Remarks     = transferMoney.Remarks;
                    cbt.CreatedBy   = 1;
                    cbt.CreatedDate = DateTime.Now;
                    entities.TransferMoneys.Add(cbt);
                    entities.SaveChanges();

                    Account acntFrom = entities.Accounts.SingleOrDefault(e => e.ID == transferMoney.SelectedtransferFromCashAndBankAcntID);
                    if (acntFrom != null)
                    {
                        acntFrom.Acc_Cur_Bal = (acntFrom.Acc_Cur_Bal == null?0:acntFrom.Acc_Cur_Bal) - transferMoney.Amount;
                        entities.SaveChanges();
                    }

                    Account acntTo = entities.Accounts.SingleOrDefault(e => e.ID == transferMoney.SelectedtransferToCashBankAcntID);
                    if (acntTo != null)
                    {
                        acntTo.Acc_Cur_Bal = (acntTo.Acc_Cur_Bal == null?0:acntTo.Acc_Cur_Bal) + transferMoney.Amount;
                        entities.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(autoId);
        }
コード例 #7
0
        void OnSavePS(object param)
        {
            MessageBoxResult result = System.Windows.MessageBox.Show("Do you want to save changes?", "Save Confirmation", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                Mouse.OverrideCursor = Cursors.Wait;
                TransferMoneyEntity rsEntity = GetDataIntoModel();
                string msg = ValidateRefundFromSupplier();


                if (msg != string.Empty)
                {
                    PSErrors             = msg;
                    Mouse.OverrideCursor = null;
                    return;
                }

                PSErrors = string.Empty;

                if (rsEntity != null)
                {
                    if (IsNew == true)
                    {
                        int i = rmRepository.SaveTransferMoney(rsEntity);
                        IsCashChequeEnabled = false;
                        IsTextBoxReadOnly   = true;
                        IsNew = false;
                    }
                    else
                    {
                        int i = rmRepository.UpdateTransferMoney(rsEntity);
                        IsNew = false;
                        IsCashChequeEnabled = false;
                        IsTextBoxReadOnly   = true;
                    }

                    Mouse.OverrideCursor = null;
                }
            }
        }
コード例 #8
0
        public int UpdateTransferMoney(TransferMoneyEntity transferMoney)
        {
            ITransferMoneyBL rmDAL = new TransferMoneyBL();

            return(rmDAL.UpdateTransferMoney(transferMoney));
        }
コード例 #9
0
        public int SaveTransferMoney(TransferMoneyEntity transferMoney)
        {
            ITransferMoneyDAL rmDAL = new TransferMoneyDAL();

            return(rmDAL.SaveTransferMoney(transferMoney));
        }
コード例 #10
0
        public int UpdateTransferMoney(TransferMoneyEntity transferMoney)
        {
            int autoId = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    TransferMoney cbt = entities.TransferMoneys.SingleOrDefault(e => e.Cheque_No == transferMoney.CashChequeNo);
                    if (cbt != null)
                    {
                        //delete last updated data
                        Account acnt1 = entities.Accounts.SingleOrDefault(e => e.ID == cbt.From_Acc_Id);
                        if (acnt1 != null)
                        {
                            acnt1.Acc_Cur_Bal = (acnt1.Acc_Cur_Bal == null?0:acnt1.Acc_Cur_Bal) + cbt.Amount;
                            entities.SaveChanges();
                        }

                        Account acnt2 = entities.Accounts.SingleOrDefault(e => e.ID == cbt.To_Acc_Id);
                        if (acnt2 != null)
                        {
                            acnt2.Acc_Cur_Bal = (acnt2.Acc_Cur_Bal == null?0:acnt2.Acc_Cur_Bal) - cbt.Amount;
                            entities.SaveChanges();
                        }

                        //Update values
                        cbt.From_Acc_Id = transferMoney.SelectedtransferFromCashAndBankAcntID;
                        cbt.To_Acc_Id   = transferMoney.SelectedtransferToCashBankAcntID;
                        cbt.Cheque      = transferMoney.IsCheque;
                        cbt.Cheque_No   = transferMoney.CashChequeNo;
                        cbt.Cheque_Date = Convert.ToDateTime(transferMoney.CashChequeDateStr);
                        cbt.Remarks     = transferMoney.Remarks;
                        cbt.Amount      = transferMoney.Amount;
                        cbt.Remarks     = transferMoney.Remarks;
                        cbt.CreatedBy   = 1;
                        cbt.CreatedDate = DateTime.Now;

                        entities.SaveChanges();

                        Account acntFrom = entities.Accounts.SingleOrDefault(e => e.ID == transferMoney.SelectedtransferFromCashAndBankAcntID);
                        if (acntFrom != null)
                        {
                            acntFrom.Acc_Cur_Bal = (acntFrom.Acc_Cur_Bal == null?0:acntFrom.Acc_Cur_Bal) - transferMoney.Amount;
                            entities.SaveChanges();
                        }

                        Account acntTo = entities.Accounts.SingleOrDefault(e => e.ID == transferMoney.SelectedtransferToCashBankAcntID);
                        if (acntTo != null)
                        {
                            acntTo.Acc_Cur_Bal = (acntTo.Acc_Cur_Bal == null?0: acntTo.Acc_Cur_Bal) + transferMoney.Amount;
                            entities.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(autoId);
        }