protected void Page_Load(object sender, EventArgs e) { BtnDeleteProduct.Visible = false; BtnInsertProduct.Visible = false; BtnUpdateProduct.Visible = false; LabelDelete.Visible = false; LabelBox.Visible = false; BoxID.Visible = false; BtnSubmit.Visible = false; FetchFromDB(); TokobediaEntities2 db = new TokobediaEntities2(); if (Session["LoginSession"] != null) { String Temp = Session["LoginSession"].ToString(); MsUser UserTemp2 = Repository.RepositoryMsUser.SearchUserByID(Temp); if (Repository.RepositoryMsUser.IsAdmin(Temp) == true) { BtnDeleteProduct.Visible = true; BtnInsertProduct.Visible = true; BtnUpdateProduct.Visible = true; LabelDelete.Visible = true; } } }
public static List <DatTemp1> FetchData() { TokobediaEntities2 db = new TokobediaEntities2(); return((from x in db.MsProductTypes select new DatTemp1 { ProductTypeID = x.ProductTypeID, ProductTypeName = x.ProductTypeName, ProductTypeDesc = x.ProductTypeDescription }).ToList()); }
public static List <DatTemp2> FetchUser() { TokobediaEntities2 db2 = new TokobediaEntities2(); return((from x in db2.MsUsers join y in db2.MsRoles on x.RoleID equals y.RoleID select new DatTemp2 { UserID = x.UserID, UserName = x.UserName, UserGender = x.UserGender, UserRole = y.RoleName, UserStatus = x.UserStatus }).ToList()); }
protected void Page_Load(object sender, EventArgs e) { TokobediaEntities2 db = new TokobediaEntities2(); if (Session["LoginSession"] != null) { String UserIDTemp = Session["LoginSession"].ToString(); MsUser UserTemp2 = (from a in db.MsUsers where a.UserID == UserIDTemp select a).FirstOrDefault(); BtnLogin.Visible = false; BtnLogout.Visible = true; LabelNama.Text = UserTemp2.UserName; } if (Session["LoginSession"] == null) { BtnLogout.Visible = false; } }