//To Check Duplicate Document #region [Check Duplicate Fees Category] public int CheckDuplicateFeesCategory_DL(EWA_FeesCategory objEWA) { try { prmList = new string[6]; prmList[0] = "@Action"; prmList[1] = "CheckData"; prmList[2] = "@FeesCategoryName"; prmList[3] = objEWA.FeesCategoryName; prmList[4] = "@OrgId"; prmList[5] = objEWA.OrgId.ToString(); DataSet dsData = ObjHelper.FillControl(prmList, "SP_FeesCategory"); if (dsData.Tables[0].Rows.Count > 0) { return(1); } else { return(0); } } catch (Exception exp) { throw exp; } }
//Check Duplicate Fees category #region [Check Duplicate Fees Category] public int CheckDuplicateFeesCategory_BL(EWA_FeesCategory objEWA) { try { DL_FeesCategory objDL = new DL_FeesCategory(); int i = objDL.CheckDuplicateFeesCategory_DL(objEWA); return(i); } catch (Exception exp) { throw exp; } finally { objDL = null; } }
//Fees Category Grid Bind #region [Fees Category Grid Bind] public DataSet FeesCategoryGridBind_BL(EWA_FeesCategory objEWA) { try { DL_FeesCategory objDL = new DL_FeesCategory(); DataSet ds = objDL.BindFeesCategoryGrid_DL(objEWA); return(ds); } catch (Exception) { throw; } finally { objDL = null; } }
//Action Performed #region [ActionPerformed For FeesCategory] public int FeesCategoryAction_BL(EWA_FeesCategory objEWA) { // DL_Documents objDL = new DL_Documents(); try { DL_FeesCategory objDL = new DL_FeesCategory(); int flag = objDL.FeesCategoryAction_DL(objEWA); return(flag); } catch (Exception) { throw; } finally { objDL = null; } }
//Check Data #region [Check Data] private int CheckData() { int i = 0; try { EWA_FeesCategory objEWA = new EWA_FeesCategory(); objEWA.OrgId = Convert.ToInt32(orgId.ToString()); objEWA.FeesCategoryName = txtFeesCategoryName.Text.Trim(); i = objBL.CheckDuplicateFeesCategory_BL(objEWA); return(i); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); return(0); } }
//Perform Action #region [Perform Actions On Fees Category] public int FeesCategoryAction_DL(EWA_FeesCategory objEWA) { try { cmd = new SqlCommand("SP_FeesCategory", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", objEWA.Action); cmd.Parameters.AddWithValue("@FeesCategoryId", objEWA.FeesCategoryId); cmd.Parameters.AddWithValue("@FeesCategoryName", objEWA.FeesCategoryName); cmd.Parameters.AddWithValue("@Code", objEWA.Code); cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId); cmd.Parameters.AddWithValue("@AcademicYearId", objEWA.AcademicYearId); cmd.Parameters.AddWithValue("@UserId", objEWA.UserId); cmd.Parameters.AddWithValue("@TransDate", objEWA.TransDate); cmd.Parameters.AddWithValue("@IsActive", objEWA.IsActive); con.Open(); int flag = cmd.ExecuteNonQuery(); con.Close(); return(flag); } catch (Exception ex) { int err = ((System.Data.SqlClient.SqlException)(ex)).Number; if (err == 547 && objEWA.Action == "Delete") { throw new SystemException("Record is in use !!!"); } else { throw ex; } } finally { con.Close(); cmd.Dispose(); } }
//Bind Fees Category #region [Bind Fees Category Grid] public DataSet BindFeesCategoryGrid_DL(EWA_FeesCategory objEWA) { DataSet ds = new DataSet(); try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "SelectData"; prmList[2] = "OrgId"; prmList[3] = objEWA.OrgId.ToString(); ds = ObjHelper.FillControl(prmList, "SP_FeesCategory"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { DataTable dt = new DataTable(); dt.Columns.Add("FeesCategoryName"); dt.Columns.Add("FeesCategorytCode"); // dt.Columns.Add("DocumentType"); dt.Rows.Add(); dt.Rows.Add(); dt.Rows.Add(); //return dsCode; } return(ds); } catch (Exception exp) { throw exp; } }
//Save Data #region SaveData protected void btnSave_Click(object sender, EventArgs e) { BL_FeesCategory objBL = new BL_FeesCategory(); EWA_FeesCategory objEWA = new EWA_FeesCategory(); try { lock (this) { if (txtFeesCategoryName.Text == "") { msgBox.ShowMessage("Please Enter Fees Category Name !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { //ViewState["DocumentId"] = 0; int chk = CheckData(); if (chk > 0) { msgBox.ShowMessage("Record Allready Exist !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { Action("Save"); GrdFeesCategoryBind(); LoadForm(); } } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { orgId = Convert.ToInt32(Session["OrgId"]); if (orgId == 0) { Response.Redirect("~/CMSHome.aspx"); } else { if (!IsPostBack) { //if (Session["OrgId"] == null) //{ // Response.Redirect("/CMSHome.aspx"); //} objEWA.OrgId = Session["OrgId"].ToString(); txtBirthDate.Attributes.Add("ReadOnly", "True"); //ds = new DataSet(); //ds.ReadXml(Server.MapPath("AddressXMLFile.xml")); //ViewState["DatasetAll"] = ds; //LoadCountryDropDown(); //LoadSportDropDown(); LoadCasteCategoryDropDown(); Bind_ddlCountry(); Bind_ddlState1(); BL_FeesCategory objBL = new BL_FeesCategory(); EWA_FeesCategory objEWA1 = new EWA_FeesCategory(); objEWA1.OrgId = Convert.ToInt32(Session["OrgId"]); DataSet ds = objBL.FeesCategoryGridBind_BL(objEWA1); ddlFeesCategory.DataSource = ds; ddlFeesCategory.DataTextField = "FeesCategoryName"; ddlFeesCategory.DataValueField = "FeesCategoryId"; ddlFeesCategory.DataBind(); ddlFeesCategory.Items.Insert(0, "Select"); ShowStudentProfile(objEWA); SqlCommand cmd1 = new SqlCommand("select Photo from tblStudent where OrgId='" + Session["OrgId"].ToString() + "' and UserCode='" + Session["UserCode"].ToString() + "'", cn); SqlDataAdapter adp1 = new SqlDataAdapter(); DataSet ds1 = new DataSet(); adp1.SelectCommand = cmd1; adp1.Fill(ds1); //lblTrustName.Text = ds1.Tables[0].Rows[0]["OrgName"].ToString(); string Photo = ds1.Tables[0].Rows[0]["Photo"].ToString();// db.getDbstatus_Value("select Photo from tblStudent where OrgId='" + Session["OrgId"].ToString() + "' and UserCode='" + Session["UserCode"].ToString() + "'"); if (Photo != "0" && Photo != "") { Byte[] bytes = (Byte[])ds1.Tables[0].Rows[0]["Photo"]; string base64String = Convert.ToBase64String(bytes, 0, bytes.Length); img_StudentImage.ImageUrl = "data:image/png;base64," + base64String; ViewState["StudentPhoto"] = bytes; } } } }