public static DataSet StudentOpeningBalance_GetById(Entity.Accounts.StudentOpeningBal OpBal) { using (DataManager oDm = new DataManager()) { oDm.Add("@StudentId", SqlDbType.Int, OpBal.StudentId); oDm.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); return(oDm.GetDataSet("usp_StudentOpeningBalance_GetById", ref ds, "Table")); } }
protected void btnSearch_Click(object sender, EventArgs e) { LoadFeesHead(); txtTotalAmt.Text = "0.00"; BusinessLayer.Accounts.StudentOpeningBal objOpeningBal = new BusinessLayer.Accounts.StudentOpeningBal(); Entity.Accounts.StudentOpeningBal OpBal = new Entity.Accounts.StudentOpeningBal(); OpBal.StudentId = int.Parse(ddlMember.SelectedValue); DataSet ds = new DataSet(); ds = objOpeningBal.StudentOpeningBalance_GetById(OpBal); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { decimal dramt = Convert.ToDecimal(ds.Tables[0].Rows[0]["AmountDr"].ToString()); decimal cramt = Convert.ToDecimal(ds.Tables[0].Rows[0]["AmountCr"].ToString()); txtTotalAmt.Text = (dramt > cramt) ? Convert.ToString(dramt) : Convert.ToString((cramt * -1)); } if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { foreach (GridViewRow gvr in dgvFeesHead.Rows) { TextBox txtAmount = (TextBox)gvr.FindControl("txtAmount"); DropDownList ddlDrCr = (DropDownList)gvr.FindControl("ddlDrCr"); int FeesHeadId = int.Parse(dgvFeesHead.DataKeys[gvr.RowIndex].Values[0].ToString()); foreach (DataRow dr in ds.Tables[1].Rows) { if (FeesHeadId == int.Parse(dr["FeesHeadId"].ToString())) { decimal AmtDr = Convert.ToDecimal(dr["AmountDr"].ToString()); decimal AmtCr = Convert.ToDecimal(dr["AmountCr"].ToString()); txtAmount.Text = (AmtDr > AmtCr) ? Convert.ToString(AmtDr) : Convert.ToString(AmtCr); ddlDrCr.SelectedValue = (AmtDr > AmtCr) ? "DR" : "CR"; } } } ViewState["BillId"] = ds.Tables[0].Rows[0]["BillId"].ToString(); btnSave.Text = "Update"; } }
public static int SaveOpBal(Entity.Accounts.StudentOpeningBal OpBal) { using (DataManager oDm = new DataManager()) { oDm.Add("@CompanyID_FK", SqlDbType.Int, OpBal.CompanyID_FK); oDm.Add("@BranchID_FK", SqlDbType.Int, OpBal.BranchID_FK); oDm.Add("@FinYearID_FK", SqlDbType.Int, OpBal.FinYearID_FK); oDm.Add("@StudentId", SqlDbType.Int, OpBal.StudentId); oDm.Add("@SemNo", SqlDbType.Int, OpBal.SemNo); oDm.Add("@BillAmount", SqlDbType.Decimal, OpBal.BillAmount); oDm.Add("@CreatedBy", SqlDbType.Int, OpBal.CreatedBy); oDm.Add("@OpeningBalXML", SqlDbType.Xml, OpBal.OpeningBalXML); oDm.Add("@BillId", SqlDbType.Int, OpBal.BillId); oDm.CommandType = CommandType.StoredProcedure; int recCnt = oDm.ExecuteNonQuery("usp_MemberOpeningBalance"); return(recCnt); } }
protected void btnSave_Click(object sender, EventArgs e) { int count = 0; if (ddlMember.SelectedValue == "0" || ddlMember.Text == string.Empty) { Message.IsSuccess = false; Message.Text = "Please Select a Member"; Message.Show = true; } else { 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.StudentOpeningBal objOpeningBal = new BusinessLayer.Accounts.StudentOpeningBal(); Entity.Accounts.StudentOpeningBal OpBal = new Entity.Accounts.StudentOpeningBal(); OpBal.CompanyID_FK = Convert.ToInt32(Session["CompanyId"].ToString().Trim()); OpBal.BranchID_FK = Convert.ToInt32(Session["BranchId"].ToString().Trim()); OpBal.FinYearID_FK = Convert.ToInt32(Session["FinYrID"].ToString().Trim()); OpBal.StudentId = Convert.ToInt32(ddlMember.SelectedValue.Trim()); OpBal.BillAmount = Convert.ToDecimal(txtTotalAmt.Text.Trim()); OpBal.CreatedBy = Convert.ToInt32(Session["UserId"].ToString().Trim()); DataTable DT = new DataTable(); DT.Columns.Add("FeesHeadId", typeof(int)); DT.Columns.Add("AmountDr", typeof(decimal)); DT.Columns.Add("AmountCr", typeof(decimal)); DataRow DR; foreach (GridViewRow GVR in dgvFeesHead.Rows) { if (GVR.RowType == DataControlRowType.DataRow) { TextBox txtAmount = (TextBox)GVR.FindControl("txtAmount"); DropDownList ddlDrCr = (DropDownList)GVR.FindControl("ddlDrCr"); decimal Amount = (txtAmount.Text.Trim().Length > 0) ? Convert.ToDecimal(txtAmount.Text.Trim()) : 0; if (Amount > 0) { count++; DR = DT.NewRow(); DR["FeesHeadId"] = Convert.ToInt32(dgvFeesHead.DataKeys[GVR.RowIndex].Value.ToString()); DR["AmountDr"] = (ddlDrCr.SelectedValue == "DR") ? Amount : 0; DR["AmountCr"] = (ddlDrCr.SelectedValue == "CR") ? Amount : 0; DT.Rows.Add(DR); DT.AcceptChanges(); } } } using (DataSet ds = new DataSet()) { ds.Tables.Add(DT); OpBal.OpeningBalXML = ds.GetXml().Replace("Table1>", "Table>"); } if (ViewState["BillId"] != null && ViewState["BillId"].ToString().Length > 0) { OpBal.BillId = int.Parse(ViewState["BillId"].ToString()); ViewState.Remove("BillId"); } else { OpBal.BillId = 0; } if (count > 0) { int RecCount = objOpeningBal.SaveOpBal(OpBal); if (RecCount > 0) { Message.IsSuccess = true; Message.Text = "Opening Balance Created Successfully"; } else { Message.IsSuccess = false; Message.Text = "Opening Balance Allready Created"; } } else { Message.IsSuccess = false; Message.Text = "Please Enter Amount for Atleast One Head"; } //} //else //{ // Message.IsSuccess = false; // Message.Text = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString(); //} Message.Show = true; } }
public DataSet StudentOpeningBalance_GetById(Entity.Accounts.StudentOpeningBal OpBal) { return(DataAccess.Accounts.StudentOpeningBal.StudentOpeningBalance_GetById(OpBal)); }
public int SaveOpBal(Entity.Accounts.StudentOpeningBal OpBal) { return(DataAccess.Accounts.StudentOpeningBal.SaveOpBal(OpBal)); }