using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; using nmsSetup; public partial class Admin_Fee_Trainer : System.Web.UI.MasterPage { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack == true) { if (Session["WebFSess"] != null) { meBranch.Visible = false; webPayNow.Visible = false; webBranch.Visible = true; avatar.InnerText = "Welcome " + Session["name"].ToString(); } else if (Session["WebFSess1"] != null) { meBranch.Visible = false; webPayNow.Visible = true; webBranch.Visible = false; avatar.InnerText = "Welcome " + Session["name"].ToString(); } else if (Session["homeURL"] == null) { Response.Redirect("../../Login/newadmin.aspx"); } else { meBranch.Visible = true; homeAdm.Attributes["href"] = Session["homeURL"].ToString(); webPayNow.Visible = false; webBranch.Visible = false; avatar.InnerText = Session["name"].ToString(); } } } public void walletbalance() { if (con.State == System.Data.ConnectionState.Closed) con.Open(); SqlCommand cmd = new SqlCommand("walletbalance", con); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@branchid", Session["officeAdmin"]); SqlDataReader dr = cmd.ExecuteReader(); // avatar1.InnerText = "0"; if (dr.HasRows) { while (dr.Read()) { //avatar1.InnerText = dr["rechargeBalance"].ToString(); } } dr.Dispose(); cmd.Dispose(); con.Close(); } public void Notification() { DataTable dt = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter("viewFranchiseReportDetail", con); adp.SelectCommand.CommandType = CommandType.StoredProcedure; adp.SelectCommand.Parameters.AddWithValue("@branchid", Session["WebFSess"].ToString()); adp.SelectCommand.Parameters.AddWithValue("@sts", 2); adp.Fill(dt); if (dt.Rows.Count > 0) { push.Visible = true; get_detail.InnerHtml = dt.Rows[0]["frsdetail"].ToString(); } else { push.Visible = false; } //Service b = new Service(); //System.Web.Script.Serialization.JavaScriptSerializer srl = new System.Web.Script.Serialization.JavaScriptSerializer(); //List lst = new List(); //string id = Session["WebFSess1"].ToString(); //string data = b.viewFranchiseReportDetail(id); //lst = srl.Deserialize>(data); //string str = ""; //foreach (clsEdit p in lst) //{ // str += "" + p.editdetail + ""; //} //get_detail.InnerHtml = str; } //-----------Notificaton for Branch Payment-------// public void Notification1() { DataTable dt = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter("viewFranchiseReportDetail", con); adp.SelectCommand.CommandType = CommandType.StoredProcedure; adp.SelectCommand.Parameters.AddWithValue("@branchid", Session["WebFSess1"].ToString()); adp.SelectCommand.Parameters.AddWithValue("@sts", 0); adp.Fill(dt); if (dt.Rows.Count > 0) { push.Visible = true; get_detail.InnerHtml = dt.Rows[0]["frsdetail"].ToString(); } else { push.Visible = false; } //Service b = new Service(); //System.Web.Script.Serialization.JavaScriptSerializer srl = new System.Web.Script.Serialization.JavaScriptSerializer(); //List lst = new List(); //string id = Session["WebFSess1"].ToString(); //string data = b.viewFranchiseReportDetail(id); //lst = srl.Deserialize>(data); //string str = ""; //foreach (clsEdit p in lst) //{ // str += "" + p.editdetail + ""; //} //get_detail.InnerHtml = str; } protected void lnklogout_Click(object sender, EventArgs e) { Session["officeAdmin"] = null; Session["webFSess"] = null; Session["webFSess1"] = null; Session.Abandon(); Session.Clear(); Request.Cookies.Clear(); HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate"); HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); HttpContext.Current.Response.AddHeader("Expires", "0"); Response.Redirect("../../Default.aspx"); Session.Abandon(); Session.Clear(); Request.Cookies.Clear(); HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate"); HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); HttpContext.Current.Response.AddHeader("Expires", "0"); Response.Redirect("../../Default.aspx"); } }