Beispiel #1
0
        public bool InsertNewOtherInvoice(OtherInvoice model)
        {
            try
            {
                int status = 0;
                using (SqlConnection connection = DataAccess.CreateConnection())
                {
                    SqlCommand command = DataAccess.CreateCommand(connection);

                    DataAccess.CreateStoredprocedure(command, "InsertNewOtherInvoice_SP");
                    DataAccess.AddInParameter(command, "AgentId", SqlDbType.Int, model.AgentId);
                    DataAccess.AddInParameter(command, "@VendorId", SqlDbType.Int, model.VendorId);
                    DataAccess.AddInParameter(command, "@OtherInvoiceTypeId", SqlDbType.Int, model.OtherInvoiceTypeId);
                    DataAccess.AddInParameter(command, "@Reference", SqlDbType.VarChar, model.Reference);
                    DataAccess.AddInParameter(command, "@ExpectedPayDate", SqlDbType.VarChar, model.ExpectedPayDate);
                    DataAccess.AddInParameter(command, "@VendorInvNo", SqlDbType.VarChar, model.VendorInvNo);
                    DataAccess.AddInParameter(command, "@Details", SqlDbType.VarChar, model.Details);
                    DataAccess.AddInParameter(command, "@CustomerAgentAmount", SqlDbType.Float, model.CustomerAgentAmount);
                    DataAccess.AddInParameter(command, "@VendorAmount", SqlDbType.Float, model.VendorAmount);
                    DataAccess.AddInParameter(command, "@UserId", SqlDbType.VarChar, model.ApplicationUserId);
                    status = DataAccess.ExecuteNonQuery(command);
                    return(status < 0 ? false : true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #2
0
        public ActionResult CreateInvoice(CreateOtherInvoice model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("CreateInvoice", "OtherInvoice"));
            }
            OtherInvoice Obj = new OtherInvoice();

            Obj.AgentId             = model.AgentId;
            Obj.ApplicationUserId   = User.Identity.GetUserId();
            Obj.CreatedOn           = DateTime.Now;
            Obj.CustomerAgentAmount = model.CustomerAgentAmount;
            Obj.CustomerAgentPaid   = false;
            Obj.Details             = model.Details;
            Obj.ExpectedPayDate     = model.ExpectedPayDate;
            Obj.OtherInvoiceTypeId  = model.OtherInvoiceTypeId;
            Obj.Reference           = model.Reference;
            Obj.Status       = InvoiceStatus.Raised;
            Obj.VendorAmount = model.VendorAmount;
            Obj.VendorId     = model.VendorId;
            Obj.VendorInvNo  = model.VendorInvNo;
            Obj.VendorPaid   = false;
            bool ret = new OtherInvoiceDA().InsertNewOtherInvoice(Obj);

            return(RedirectToAction("CreateInvoice", "OtherInvoice"));
        }