public static void SaveRefundableFees(Entity.Accounts.StudentFeesCollection Fees) { using (DataManager oDm = new DataManager()) { oDm.Add("@PaymentId", SqlDbType.Int, ParameterDirection.InputOutput, Fees.PaymentId); oDm.Add("@StudentId", SqlDbType.Int, ParameterDirection.Input, Fees.StudentId); oDm.Add("@SemNo", SqlDbType.Int, ParameterDirection.Input, Fees.SemNo); oDm.Add("@Amount", SqlDbType.Decimal, ParameterDirection.Input, Fees.Amount); oDm.Add("@PaymentDate", SqlDbType.DateTime, ParameterDirection.Input, Fees.PaymentDate); oDm.Add("@CashBankLedgerID", SqlDbType.Int, ParameterDirection.Input, Fees.CashBankLedgerID); oDm.Add("@TransactionType", SqlDbType.VarChar, 40, ParameterDirection.Input, Fees.TransactionType); oDm.Add("@ModeOfPayment", SqlDbType.VarChar, 15, ParameterDirection.Input, Fees.ModeOfPayment); oDm.Add("@ChequeNo", SqlDbType.VarChar, 30, ParameterDirection.Input, Fees.ChequeNo); if (Fees.ChequeDate == null) { oDm.Add("@ChequeDate", SqlDbType.DateTime, ParameterDirection.Input, DBNull.Value); } else { oDm.Add("@ChequeDate", SqlDbType.DateTime, ParameterDirection.Input, Fees.ChequeDate); } oDm.Add("@DrawnOn", SqlDbType.VarChar, 50, ParameterDirection.Input, Fees.DrawnOn); oDm.Add("@CreatedBy", SqlDbType.Int, ParameterDirection.Input, Fees.CreatedBy); oDm.Add("@PaymentDetails", SqlDbType.Xml, ParameterDirection.Input, Fees.PaymentDetailsXML); oDm.Add("@XMLCashBankVoucherDetails", SqlDbType.Xml, ParameterDirection.Input, Fees.XMLCashBankVoucherDetails); oDm.Add("@CompanyId", SqlDbType.Int, ParameterDirection.Input, Fees.CompanyId); oDm.Add("@BranchId", SqlDbType.Int, ParameterDirection.Input, Fees.BranchId); oDm.Add("@FinYrId", SqlDbType.Int, ParameterDirection.Input, Fees.FinYrId); oDm.Add("@FeesBookNumber", SqlDbType.VarChar, 50, ParameterDirection.Input, Fees.FeesBookNumber); oDm.Add("@Narration", SqlDbType.NVarChar, 2000, ParameterDirection.Input, Fees.Narration); oDm.Add("@IsRefund", SqlDbType.Bit, Fees.IsRefund); oDm.CommandType = CommandType.StoredProcedure; oDm.ExecuteNonQuery("usp_RefundableFeesMaster_save"); Fees.PaymentId = (int)oDm["@PaymentId"].Value; } }
public static Entity.Accounts.StudentFeesCollection Refund_GetAllById(int PaymentId) { using (DataManager oDm = new DataManager()) { oDm.CommandType = CommandType.StoredProcedure; oDm.Add("@PaymentId", SqlDbType.Int, ParameterDirection.Input, PaymentId); SqlDataReader dr = oDm.ExecuteReader("usp_RefundFeesMaster_GetAllById"); Entity.Accounts.StudentFeesCollection Fees = new Entity.Accounts.StudentFeesCollection(); if (dr.HasRows) { while (dr.Read()) { Fees.PaymentId = PaymentId; Fees.MoneyReceiptNo = (dr[1] == DBNull.Value) ? "" : dr[1].ToString(); Fees.StudentId = (dr[2] == DBNull.Value) ? 0 : int.Parse(dr[2].ToString()); Fees.Amount = (dr[3] == DBNull.Value) ? 0 : decimal.Parse(dr[3].ToString()); Fees.PaymentDate = (dr[4] == DBNull.Value) ? DateTime.MinValue : DateTime.Parse(dr[4].ToString()); Fees.ModeOfPayment = (dr[5] == DBNull.Value) ? "" : dr[5].ToString(); Fees.ChequeNo = (dr[6] == DBNull.Value) ? "" : dr[6].ToString(); if (dr[7] == DBNull.Value) { Fees.ChequeDate = null; } else { Fees.ChequeDate = DateTime.Parse(dr[7].ToString()); } Fees.DrawnOn = (dr[8] == DBNull.Value) ? "" : dr[8].ToString(); Fees.CBVHeaderId = (dr[9] == DBNull.Value) ? 0 : Convert.ToInt32(dr[9].ToString()); } } return(Fees); } }
protected void btnSave_Click(object sender, EventArgs e) { if (Validate()) { string strValues = DateTime.Now.ToString("dd MMM yyyy"); strValues += chr.ToString() + ""; DataSet ds_fn = gf.ExecuteSelectSP("spSelect_GetFnYear", strValues); //if (ds_fn.Tables[0].Rows[0]["FinYearID"].ToString() == Session["FinYrID"].ToString().Trim()) //{ BusinessLayer.Accounts.StudentFeesCollection ObjFees = new BusinessLayer.Accounts.StudentFeesCollection(); Entity.Accounts.StudentFeesCollection Fees = new Entity.Accounts.StudentFeesCollection(); Fees.PaymentId = 0; //Always Save Fees.StudentId = Convert.ToInt32(ddlMember.SelectedValue.Trim()); //Fees.SemNo = Convert.ToInt32(ddlSemester.SelectedValue.Trim()); Fees.Amount = Convert.ToDecimal(txtTotalAmt.Text.Trim()); Fees.PaymentDate = Convert.ToDateTime(txtVoucherDate.Text.Trim() + " 00:00:00"); Fees.CashBankLedgerID = Convert.ToInt32(ddlCashBankLedger.SelectedValue.Trim()); Fees.TransactionType = "RECEIVE"; Fees.ModeOfPayment = ddlReceiptMode.SelectedValue.Trim(); Fees.ChequeNo = txtChequeNo.Text.Trim(); if (txtChequeDate.Text.Trim().Length == 0) { Fees.ChequeDate = null; } else { Fees.ChequeDate = Convert.ToDateTime(txtChequeDate.Text.Trim()); } Fees.DrawnOn = txtDrawnOn.Text.Trim(); Fees.CreatedBy = int.Parse(HttpContext.Current.User.Identity.Name); Fees.CompanyId = int.Parse(Session["CompanyId"].ToString()); Fees.BranchId = int.Parse(Session["BranchId"].ToString()); Fees.FinYrId = int.Parse(Session["FinYrID"].ToString()); Fees.FeesBookNumber = txtFeesBookNo.Text.Trim(); Fees.Narration = txtNarration.Text.Trim(); DataTable DT = new DataTable(); DT.Columns.Add("FeesHeadId", typeof(int)); DT.Columns.Add("Amount", typeof(decimal)); DataRow DR; foreach (GridViewRow DGV in dgvFeesHead.Rows) { if (DGV.RowType == DataControlRowType.DataRow) { TextBox txtAmount = (TextBox)DGV.FindControl("txtAmount"); decimal Amount = (txtAmount.Text.Trim().Length > 0) ? Convert.ToDecimal(txtAmount.Text.Trim()) : 0; if (Amount > 0) { DR = DT.NewRow(); DR["FeesHeadId"] = Convert.ToInt32(dgvFeesHead.DataKeys[DGV.RowIndex].Values["id"].ToString()); DR["Amount"] = Amount; DT.Rows.Add(DR); DT.AcceptChanges(); } } } using (DataSet ds = new DataSet()) { ds.Tables.Add(DT); Fees.PaymentDetailsXML = ds.GetXml().Replace("Table1>", "Table>"); } Fees.XMLCashBankVoucherDetails = PrepareXMLString(); Fees.IsRefund = false; ObjFees.Save(Fees); Fees = ObjFees.GetAllById(Fees.PaymentId); btnSearch_Click(sender, e); GetLedgerBalance(); txtVoucherDate.Text = DateTime.Now.ToString("dd MMM yyyy"); txtTotalAmt.Text = "0.00"; Message.IsSuccess = true; Message.Text = "Money Receipt No " + Fees.MoneyReceiptNo + " is generated. You can take print out now"; txtReceiptNo.Text = Fees.MoneyReceiptNo; //-----------------------------------------------------------Add On 08-08-2013 btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceipt.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;"); //if (txtReceiptNo.Text.ToString().Substring(4, 4) == "ENGG") //{ // btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceipt.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;"); //} //else if (txtReceiptNo.Text.Substring(4, 4) == "DEPL") //{ // btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceiptDiploma.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;"); //} //else //{ // btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceiptMgmnt.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;"); //} //------------------------------------------------------------ //-------------------------CLEAR PAGE---------------------Add on 14-08-2013 txtReceiptNo.Text = "Auto Generated"; txtVoucherDate.Text = DateTime.Now.ToString("dd MMM yyyy"); txtChequeNo.Text = ""; txtDrawnOn.Text = ""; txtChequeDate.Text = ""; ltrLedgerBalance.Text = ""; txtNarration.Text = ""; ddlReceiptMode.SelectedIndex = 0; txtChequeNo.Enabled = false; txtDrawnOn.Enabled = false; txtChequeDate.Enabled = false; dgvFeesHead.DataSource = null; dgvFeesHead.DataBind(); Session["State"] = 0; //PopulateDropDownLists(); LoadCashBankLedger(); txtTotalAmt.Text = "0.00"; txtFeesBookNo.Text = string.Empty; //-------------------------------------------------------- //} //else //{ // Message.IsSuccess = false; // Message.Text = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString() + ""; //} } Message.Show = true; }
public void SaveRefundableFees(Entity.Accounts.StudentFeesCollection Fees) { DataAccess.Accounts.StudentFeesCollection.SaveRefundableFees(Fees); }
public void Save(Entity.Accounts.StudentFeesCollection Fees) { DataAccess.Accounts.StudentFeesCollection.Save(Fees); }