Ejemplo n.º 1
0
        public ActionResult Ledger(GeneralVoucherPostingViewModel model)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                FlashMessage.Danger(ModelState.Values.ToString());
                return(RedirectToAction("Ledger", "Accounting"));
            }
            if (model == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                GeneralVoucherPosting Obj = new GeneralVoucherPosting();
                Obj.Amount       = model.Amount;
                Obj.Notes        = model.Notes;
                Obj.LedgerHeadId = model.GeneralLedgerHeadId;
                Obj.UserID       = User.Identity.GetUserId();
                Obj.LedgerDate   = model.LedgerDate;
                status           = new AccountingDA().InsertGeneralVoucherPosting(Obj);
                if (status)
                {
                    FlashMessage.Confirmation("New Ledger Posted");
                }
                else
                {
                    FlashMessage.Danger("Some error occured!!");
                }
                return(RedirectToAction("Ledger", "Accounting"));
            }
        }
Ejemplo n.º 2
0
        public bool InsertGeneralVoucherPosting(GeneralVoucherPosting model)
        {
            try
            {
                int status = 0;
                using (SqlConnection connection = DataAccess.CreateConnection())
                {
                    SqlCommand command = DataAccess.CreateCommand(connection);

                    DataAccess.CreateStoredprocedure(command, "InsertGeneralVoucherPosting_SP");
                    DataAccess.AddInParameter(command, "@LedgerHeadId", SqlDbType.Int, model.LedgerHeadId);
                    DataAccess.AddInParameter(command, "@Amount", SqlDbType.Float, model.Amount);
                    DataAccess.AddInParameter(command, "@Notes", SqlDbType.VarChar, model.Notes);
                    DataAccess.AddInParameter(command, "@UserId", SqlDbType.VarChar, model.UserID);
                    DataAccess.AddInParameter(command, "@LedgerDate", SqlDbType.VarChar, model.LedgerDate);
                    status = DataAccess.ExecuteNonQuery(command);
                    return(status < 0 ? false : true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }