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_AdminMenu : System.Web.UI.UserControl { 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(); // avatar1.InnerText = "Welcome " + Session["balance"].ToString(); Notification(); // Hidpay.Value = Session["WebFType"].ToString(); // string getlist = Session["WebFSess"] as string; // string[] getval = getlist.Split(','); // BName.InnerText = getval[4]; } else if (Session["WebFSess1"] != null) { meBranch.Visible = false; webPayNow.Visible = true; webBranch.Visible = false; avatar.InnerText = "Welcome " + Session["name"].ToString(); // avatar1.InnerText = "Welcome " + Session["balance"].ToString(); //avtusr.InnerText = Session["name"].ToString(); //Notification1(); } 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; BindMainUrl(); avatar.InnerText = Session["name"].ToString(); // avatar1.InnerText = Session["log"].ToString(); walletbalance(); } } } 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; } public void BindMainUrl() { if (con.State == System.Data.ConnectionState.Closed) con.Open(); List lst = new List(); SqlCommand cmd = new SqlCommand("spMainUrl", con); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@empID", Session["officeAdmin"]); SqlDataReader dr = cmd.ExecuteReader(); PRPSetup obj; if (dr.HasRows) { while (dr.Read()) { obj = new PRPSetup(); obj.urlId = dr["urlId"].ToString(); obj.urlName = dr["urlName"].ToString(); obj.urlPath = dr["urlPath"].ToString(); obj.urlPrntId = dr["urlprntId"].ToString(); lst.Add(obj); } } dr.Dispose(); cmd.Dispose(); con.Close(); Repcaurse.DataSource = lst; Repcaurse.DataBind(); } public List bind_SubMenu(string uid) { if (con.State == System.Data.ConnectionState.Closed) con.Open(); List lst = new List(); SqlCommand cmd = new SqlCommand("spMainUrlByPrntId", con); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@empID", Session["officeAdmin"]); cmd.Parameters.AddWithValue("@prntId", uid); SqlDataReader dr = cmd.ExecuteReader(); PRPSetup obj; if (dr.HasRows) { while (dr.Read()) { obj = new PRPSetup(); obj.urlId = dr["urlId"].ToString(); obj.urlName = dr["urlName"].ToString(); obj.urlPath = dr["urlPath"].ToString(); obj.urlPrntId = dr["urlprntId"].ToString(); lst.Add(obj); } } dr.Dispose(); cmd.Dispose(); con.Close(); return lst; } protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { //DataRowView drv = (DataRowView)e.Item.DataItem; PRPSetup drv = e.Item.DataItem as PRPSetup; string uid = drv.urlId; //drv["catid"].ToString(); //string sid = drv.id; //drv["subcatid"].ToString(); Repeater Repeater2 = (Repeater)e.Item.FindControl("Repcaurse_sub"); Repeater2.DataSource = bind_SubMenu(uid); Repeater2.DataBind(); } } 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"); } }