private void SaveVoucherDetails()
        {
            BusinessLayer.Accounts.TrnDebitNoteHeader objDebitNote = new TrnDebitNoteHeader();
            Entity.Accounts.TrnDebitNoteHeader        DebitNote    = new Entity.Accounts.TrnDebitNoteHeader();
            DebitNote.DNHeaderID          = DNHeaderID;
            DebitNote.CompanyID_FK        = Convert.ToInt32(Session["CompanyId"].ToString().Trim());
            DebitNote.FinYearID_FK        = Convert.ToInt32(Session["FinYrID"].ToString().Trim());
            DebitNote.BranchID_FK         = Convert.ToInt32(Session["BranchId"].ToString().Trim());
            DebitNote.DNVoucherDate       = Convert.ToDateTime(txtVoucherDate.Text.Trim() + " 00:00:00");
            DebitNote.SupplierLedgerID_FK = Convert.ToInt32(ddlSupplierLedger.SelectedValue.Trim());
            DebitNote.TotalAmount         = Convert.ToDecimal(txtTotalAmt.Text.Trim());
            DebitNote.DNNarration         = txtNarration.Text.Trim();
            DebitNote.OperationBy         = Convert.ToInt32(Session["UserId"].ToString().Trim());
            DebitNote.XMLDebitNoteDetails = PrepareXMLString();

            int RowsAffected = objDebitNote.Save(DebitNote);

            if (RowsAffected != -1)
            {
                PopulateHeaderGrid();
                LoadDueBills();
                txtNarration.Text = "";
                DataTable DT = objDebitNote.GetAllById(DebitNote.DNHeaderID);
                txtVchNo.Text = DT.Rows[0]["DNVoucherNo"].ToString();

                Message.IsSuccess = true;
                Message.Text      = "Your request has been processed successfully!";
                btnPrint.Attributes.Add("onclick", "javascript:openPopup('PrintDebitNote.aspx?id=" + DebitNote.DNHeaderID + "'); return false;");
            }

            Message.Show = true;
        }
        public static int Save(Entity.Accounts.TrnDebitNoteHeader DebitNote)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@DNHeaderID", SqlDbType.Int, ParameterDirection.InputOutput, DebitNote.DNHeaderID);
                oDm.Add("@CompanyID_FK", SqlDbType.Int, ParameterDirection.Input, DebitNote.CompanyID_FK);
                oDm.Add("@FinYearID_FK", SqlDbType.Int, ParameterDirection.Input, DebitNote.FinYearID_FK);
                oDm.Add("@BranchID_FK", SqlDbType.Int, ParameterDirection.Input, DebitNote.BranchID_FK);
                oDm.Add("@DNVoucherDate", SqlDbType.DateTime, ParameterDirection.Input, DebitNote.DNVoucherDate);
                oDm.Add("@SupplierLedgerID_FK", SqlDbType.Int, ParameterDirection.Input, DebitNote.SupplierLedgerID_FK);
                oDm.Add("@TotalAmount", SqlDbType.Decimal, ParameterDirection.Input, DebitNote.TotalAmount);
                oDm.Add("@DNNarration", SqlDbType.NVarChar, 4000, ParameterDirection.Input, DebitNote.DNNarration);
                oDm.Add("@OperationBy", SqlDbType.Int, ParameterDirection.Input, DebitNote.OperationBy);
                oDm.Add("@XMLDebitNoteDetails", SqlDbType.NText, ParameterDirection.Input, DebitNote.XMLDebitNoteDetails);

                oDm.CommandType = CommandType.StoredProcedure;
                int RowsAffected = oDm.ExecuteNonQuery("usp_TrnDebitNoteHeader_Save");
                DebitNote.DNHeaderID = (int)oDm["@DNHeaderID"].Value;

                return(RowsAffected);
            }
        }
Exemple #3
0
 public int Save(Entity.Accounts.TrnDebitNoteHeader DebitNote)
 {
     return(DataAccess.Accounts.TrnDebitNoteHeader.Save(DebitNote));
 }