public int SaveReceiveMoney(ReceiveMoneyEntity receiveMoney)
        {
            int autoId = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    ReceiveMoney cbt = new ReceiveMoney();
                    cbt.LinkedAccountID   = receiveMoney.SelectedLinkedAcntID;
                    cbt.CashBankAccountID = receiveMoney.SelectedCashBankAcntID;
                    cbt.IsCheque          = receiveMoney.IsCheque;
                    cbt.CashChequeNo      = receiveMoney.CashChequeNo;
                    cbt.CashChequeDate    = receiveMoney.CashChequeDate;
                    cbt.Remarks           = receiveMoney.Remarks;
                    cbt.TaxID             = receiveMoney.SelectedTaxID;
                    cbt.TotalBeforeTax    = receiveMoney.TotalBeforeTax;
                    cbt.TotalTax          = receiveMoney.TotalTax;
                    cbt.TotalAfterTax     = receiveMoney.TotalAfterTax;
                    cbt.Remarks           = receiveMoney.Remarks;
                    cbt.CreatedBy         = 1;
                    cbt.CreatedDate       = DateTime.Now;
                    entities.ReceiveMoneys.Add(cbt);
                    entities.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(autoId);
        }
Beispiel #2
0
        public ReceiveMoneyEntity GetDataIntoModel()
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

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

            model.SelectedLinkedAcntID   = this.SelectedLinkedAcntID;
            model.SelectedCashBankAcntID = this.SelectedCashBankAcntID;
            model.CashChequeDate         = DateTime.ParseExact(this.CashChequeDateStr, oData.DateFormat, null);
            model.CashChequeNo           = this.CashChequeNo;
            model.TotalBeforeTaxStr      = TotalBeforeTaxStr;
            model.TotalBeforeTax         = Convert.ToDecimal(TotalBeforeTaxStr);
            model.TotalTaxStr            = this.TotalTaxStr;
            model.TotalTax         = Convert.ToDecimal(TotalTaxStr);
            model.TotalAfterTaxStr = this.TotalAfterTaxStr;
            model.TotalAfterTax    = Convert.ToDecimal(TotalAfterTaxStr);
            model.SelectedTaxID    = this.SelectedTaxID;
            model.TaxRate          = this.TaxRate;
            model.Remarks          = this.Remarks;
            model.IsCheque         = this.IsCheque;

            return(model);
        }
        public ReceiveMoneyEntity GetReceiveMoneyDetails(string cashChequeNo)
        {
            ReceiveMoneyEntity receiveMoney = new ReceiveMoneyEntity();

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    ReceiveMoney cbt = entities.ReceiveMoneys.SingleOrDefault(e => e.CashChequeNo == cashChequeNo);
                    if (cbt != null)
                    {
                        receiveMoney.ID = cbt.ID;
                        receiveMoney.SelectedLinkedAcntID   = cbt.LinkedAccountID;
                        receiveMoney.SelectedCashBankAcntID = cbt.CashBankAccountID;
                        receiveMoney.IsCheque       = cbt.IsCheque;
                        receiveMoney.CashChequeNo   = cbt.CashChequeNo;
                        receiveMoney.CashChequeDate = cbt.CashChequeDate;
                        receiveMoney.Remarks        = cbt.Remarks;
                        receiveMoney.SelectedTaxID  = cbt.TaxID;
                        receiveMoney.TotalBeforeTax = cbt.TotalBeforeTax;
                        receiveMoney.TotalTax       = cbt.TotalTax;
                        receiveMoney.TotalAfterTax  = cbt.TotalAfterTax;
                        receiveMoney.Remarks        = cbt.Remarks;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(receiveMoney);
        }
Beispiel #4
0
        private void GetReceiveMoneyDetails(string cashChequeNo)
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

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

            this.CashChequeDateStr = Dateinstr.ToString(oData.DateFormat);
            GetModelData(pqf);
        }
Beispiel #5
0
        private void GetModelData(ReceiveMoneyEntity rmf)
        {
            if (IsNew == false)
            {
                this.SelectedLinkedAcntID   = rmf.SelectedLinkedAcntID;
                this.SelectedCashBankAcntID = rmf.SelectedCashBankAcntID;

                this.CashChequeNo      = rmf.CashChequeNo;
                this.IsCheque          = rmf.IsCheque;
                this.SelectedTaxID     = rmf.SelectedTaxID;
                this.TotalBeforeTaxStr = Convert.ToString(rmf.TotalBeforeTax);
                this.TotalTaxStr       = Convert.ToString(rmf.TotalTax);
                this.TotalAfterTaxStr  = Convert.ToString(rmf.TotalAfterTax);
                this.Remarks           = rmf.Remarks;
            }
        }
Beispiel #6
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;
                ReceiveMoneyEntity 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.SaveReceiveMoney(rsEntity);
                        IsCashChequeEnabled = false;
                        IsTextBoxReadOnly   = true;
                        IsNew = false;
                    }
                    else
                    {
                        int i = rmRepository.UpdateReceiveMoney(rsEntity);
                        IsNew = false;
                        IsCashChequeEnabled = false;
                        IsTextBoxReadOnly   = true;
                    }

                    Mouse.OverrideCursor = null;
                }
            }
        }
        public int UpdateReceiveMoney(ReceiveMoneyEntity receiveMoney)
        {
            int autoId = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    ReceiveMoney cbt = entities.ReceiveMoneys.SingleOrDefault(e => e.CashChequeNo == receiveMoney.CashChequeNo);
                    if (cbt != null)
                    {
                        //cbt.ID = receiveMoney.ID;
                        cbt.LinkedAccountID   = receiveMoney.SelectedLinkedAcntID;
                        cbt.CashBankAccountID = receiveMoney.SelectedCashBankAcntID;
                        cbt.IsCheque          = receiveMoney.IsCheque;
                        cbt.CashChequeNo      = receiveMoney.CashChequeNo;
                        cbt.CashChequeDate    = receiveMoney.CashChequeDate;
                        cbt.Remarks           = receiveMoney.Remarks;
                        cbt.TaxID             = receiveMoney.SelectedTaxID;
                        cbt.TotalBeforeTax    = receiveMoney.TotalBeforeTax;
                        cbt.TotalTax          = receiveMoney.TotalTax;
                        cbt.TotalAfterTax     = receiveMoney.TotalAfterTax;
                        cbt.Remarks           = receiveMoney.Remarks;
                        cbt.UpdatedBy         = 1;
                        cbt.UpdatedDate       = DateTime.Now;

                        entities.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(autoId);
        }
Beispiel #8
0
        public int UpdateReceiveMoney(ReceiveMoneyEntity receiveMoney)
        {
            IReceiveMoneyBL rmDAL = new ReceiveMoneyBL();

            return(rmDAL.UpdateReceiveMoney(receiveMoney));
        }
Beispiel #9
0
        public int SaveReceiveMoney(ReceiveMoneyEntity receiveMoney)
        {
            IReceiveMoneyDAL rmDAL = new ReceiveMoneyDAL();

            return(rmDAL.SaveReceiveMoney(receiveMoney));
        }