protected void Page_Load(object sender, EventArgs e) { userId = ConvertUtility.ToInt32(Request.QueryString["uid"]); if (!CurrentUser.IsAdmin) { pnlAdmin.Visible = false; } if (!CurrentUser.IsSuperAdmin) { pnlSuperadmin.Visible = false; } else if (CurrentUser.IsSuperAdmin) { pnlSuperadmin.Visible = true; pnlAdmin.Visible = true; } if (!Page.IsPostBack) { PortalController.LoadPortals(lstPortal.Items); UserInfo user = UserController.GetUser(userId); if (user == null) { this.btnUpdate.Visible = false; this.btnManagePassword.Visible = false; return; } lblUsername.Text = user.Username; txtAddress1.Text = user.Address1; txtAddress2.Text = user.Address2; MiscUtility.SelectItemFromList(dropCity, user.City.ToString()); MiscUtility.SelectItemFromList(dropCountry, user.Country.ToString()); txtDisplayName.Text = user.DisplayName; txtEmail.Text = user.Email; txtFirstName.Text = user.FirstName; chkIsSuperAdmin.Checked = user.IsSuperAdmin; chkIsAdmin.Checked = user.IsAdmin; txtLastName.Text = user.LastName; txtMobile.Text = user.Mobile; txtTel.Text = user.Tel; txtZipCode.Text = user.ZipCode; DataTable dtUserPortals = PortalController.GetPortals(user.UserID, AppEnv.GetLanguage()); foreach (DataRow row in dtUserPortals.Rows) { if (lstPortal.Items.FindByValue(row["PortalID"].ToString()) != null) { lstPortal.Items.FindByValue(row["PortalID"].ToString()).Selected = true; } } //dropPartner.DataSource = PartnerController.GetPartners(); //dropPartner.DataBind(); //if (user.PartnerID != 0) //{ // dropPartner.SelectedValue = user.PartnerID.ToString(); //} } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rdoLanguage.DataSource = LanguageDistributor.GetAll(); rdoLanguage.DataTextField = "Language_Name"; rdoLanguage.DataValueField = "Language_Culture"; rdoLanguage.DataBind(); rdoLanguage.SelectedIndex = -1; MiscUtility.SetSelected(rdoLanguage.Items, AppEnv.GetLanguage().ToString()); } }
protected void Page_Load(object sender, EventArgs e) { lang = AppEnv.GetLanguage(); lblStatusUpdate.Text = ""; if (!IsPostBack) { LoadZones(); btnDelete.Attributes.Add("onclick", "return ConfirmDelete('" + AppEnv.GetConfirm(lang) + "');"); } }
public static void LoadPortalsForRadComboByUserID(ListItemCollection lstItems, int userId) { DataTable dtPortals = GetPortals(userId, AppEnv.GetLanguage()); foreach (DataRow row in dtPortals.Rows) { ListItem item = new ListItem(row["Portal_Name"].ToString(), row["PortalID"].ToString()); item.Attributes.Add("Level", "0"); lstItems.Add(item); LoadForCurItemForRadCombo(lstItems, item, userId); } }
public static void LoadPortalsForRadComboByUserIDGenLi(Literal ltrItems, HttpRequest hpcontext, int userId) { StringBuilder _sb = new StringBuilder(); DataTable dtPortals = GetPortals(userId, AppEnv.GetLanguage()); string fmItem = "<li><a href=\"{0}\">{1}</a></li>"; foreach (DataRow row in dtPortals.Rows) { string _lnk = MiscUtility.UpdateQueryStringItem(hpcontext, "portalid", row["PortalID"].ToString()); _sb.Append(string.Format(fmItem, _lnk, row["Portal_Name"].ToString())); } ltrItems.Text = _sb.ToString(); }
protected void cmdUpdate_Click(object sender, EventArgs e) { if (lblUserEmail.Text == string.Empty) { return; } UserInfo info = UserDB.GetInfoByEmail(lblUserEmail.Text); try { foreach (ListItem item in chkRoles.Items) { if (item.Selected) { RoleDB.AddUserRole(info.User_ID, Convert.ToInt32(item.Value)); } else { RoleDB.RemoverUserRole(info.User_ID, Convert.ToInt32(item.Value)); } } string cmsRoles = string.Empty; foreach (ListItem item in lstCMSRoles.Items) { if (item.Selected) { cmsRoles += item.Value + "|"; } } if (cmsRoles.Length > 0) { cmsRoles = "|" + cmsRoles; } if (cmsRoles != string.Empty) { RoleDB.SetUserCMSRoles(info.User_ID, AppEnv.GetLanguage(), cmsRoles); } lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS; } catch { lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; } }
protected void cmdUpdate_Click(object sender, EventArgs e) { AdvertiseInfo info = AdvertiseDB.GetInfo(ConvertUtility.ToInt32(txtID.Text)); if (info == null) { cmdEmpty_Click(null, null); return; } info.Advertise_Name = txtName.Text; info.Advertise_Enable = chkEnable.Checked; info.Advertise_Height = ConvertUtility.ToInt32(txtHeight.Text); info.Advertise_Width = ConvertUtility.ToInt32(txtWidth.Text); info.Advertise_StartDate = SelectDate1.GetDate(); info.Advertise_EndDate = SelectDate2.GetDate(); info.Advertise_Path = txtPath.Text; info.Advertise_PositionID = ConvertUtility.ToInt32(lstPositions.SelectedValue); info.Advertise_Type = dropType.SelectedValue; info.Advertise_RedirectURL = txtUrl.Text; info.Advertise_Lang = AppEnv.GetLanguage(); string location = string.Empty; foreach (ListItem item in lstZones.Items) { if (item.Selected) { location += item.Value + "|"; } } info.Advertise_Params = location; info.Advertise_Embed = txtEmbed.Text.Trim(); try { AdvertiseDB.Update(info); lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS; } catch { lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR; } }
public static DataTable GetStandAloneBox() { DataTable retVal = null; SqlConnection dbConn = new SqlConnection(AppEnv.ConnectionString); SqlCommand dbCmd = new SqlCommand("CMS_Zones_GetStandAloneBox", dbConn); dbCmd.Parameters.AddWithValue("@Lang", AppEnv.GetLanguage()); dbCmd.CommandType = CommandType.StoredProcedure; try { retVal = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(dbCmd); da.Fill(retVal); } finally { dbConn.Close(); } return(retVal); }
protected void dtgUsers_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "roles") { lblUserEmail.Text = e.Item.Cells[1].Text; UserInfo info = UserDB.GetInfoByEmail(lblUserEmail.Text); string roles = "|"; DataTable dtRoles = RoleDB.GetByUserID(info.User_ID); foreach (DataRow row in dtRoles.Rows) { roles += row["User_Role"] + "|"; } foreach (ListItem item in chkRoles.Items) { if (roles.IndexOf("|" + item.Value + "|") >= 0) { item.Selected = true; } else { item.Selected = false; } } string cmsRoles = "|" + RoleDB.GetUserCMSRoles(info.User_ID, AppEnv.GetLanguage()); foreach (ListItem item in lstCMSRoles.Items) { if (cmsRoles.IndexOf("|" + item.Value + "|") >= 0) { item.Selected = true; } else { item.Selected = false; } } } }
protected void cmdUpdate_Click(object sender, EventArgs e) { try { SettingDB.SetValue(AppEnv.CMS_ZoneHome + AppEnv.GetLanguage(), dropZoneHome.SelectedValue); SettingDB.SetValue(AppEnv.CMS_ZoneClassRegister + AppEnv.GetLanguage(), dropClassRegister.SelectedValue); SettingDB.SetValue(AppEnv.CMS_ZoneKhoaHoc + AppEnv.GetLanguage(), dropKhoaHoc.SelectedValue); //string zoneFocus = string.Empty; //foreach (ListItem item in lstZoneFocus.Items) zoneFocus += item.Value + "|"; //SettingDB.SetValue(Constants.CMS_ZoneHomeFocus + AppEnv.GetLanguage(), zoneFocus); //string zoneSmallFocus = string.Empty; //foreach (ListItem itemS in lstZonesSmallFocus.Items) zoneSmallFocus += itemS.Value + "|"; //SettingDB.SetValue(Constants.CMS_ZoneSmallFocus + AppEnv.GetLanguage(), zoneSmallFocus); lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS; } catch { lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadSidebar(); lblCurrentUser.Text = CurrentUser.Username.Replace("@vmgmedia.vn", ""); if (AppEnv.GetLanguage() == "vi-VN") { hplChangePass.Text = "<i class=\"icon-user\"></i> Hồ sơ cá nhân"; btnLogout.Text = "<i class=\"icon-key\"></i> Đăng xuất"; trigger_fullscreen.Text = "<i class=\"icon-move\"></i> Toàn màn hình</a>"; btnEng.Text = "<i class=\"icon-female\"></i> Tiếng Anh</a>"; btnViet.Text = "<i class=\"icon-male\"></i> Tiếng Việt</a>"; } else { hplChangePass.Text = "<i class=\"icon-user\"></i> Edit profile"; btnLogout.Text = "<i class=\"icon-key\"></i> Log Out"; trigger_fullscreen.Text = "<i class=\"icon-move\"></i> Full Screen</a>"; btnEng.Text = "<i class=\"icon-female\"></i> English</a>"; btnViet.Text = "<i class=\"icon-male\"></i> Vietnamese</a>"; } HttpRequest htp = HttpContext.Current.Request; if (!CurrentUser.IsSuperAdmin) { PortalController.LoadPortalsForRadComboByUserIDGenLi(ltrPortal, htp, CurrentUser.UserID); } else { PortalController.LoadPortalsForRadComboLi(ltrPortal, htp); } hplChangePass.NavigateUrl = "/Default.aspx?portalid=" + AppEnv.PortalId() + "&cmd=createuser&uid=" + CurrentUser.UserID + "&lang=" + AppEnv.GetLanguage(); } }
public static DataTable GetByParentIDOrderByName(int parentID) { DataTable retVal = null; SqlConnection dbConn = new SqlConnection(AppEnv.ConnectionString); SqlCommand dbCmd = new SqlCommand("CMS_Zones_GetByParentIDOrderByName", dbConn); dbCmd.Parameters.AddWithValue("@ParentID", parentID); dbCmd.Parameters.AddWithValue("@Lang", AppEnv.GetLanguage()); dbCmd.CommandType = CommandType.StoredProcedure; try { //HttpContext.Current.Response.Write(sql); retVal = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(dbCmd); da.Fill(retVal); } finally { dbConn.Close(); } return(retVal); }
protected override void OnRowCreated(GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.Pager) { return; } foreach (Control pager in e.Row.Cells[0].Controls) { foreach (Control row in pager.Controls) { foreach (Control cell in row.Controls) { foreach (Control c in cell.Controls) { if (c.GetType().ToString() == "System.Web.UI.WebControls.DataControlPagerLinkButton") { LinkButton lnk = (LinkButton)c; lnk.Text = "| " + lnk.Text + " |"; } if (c.GetType().ToString() == "System.Web.UI.WebControls.Label") { Label lbl = (Label)c; if (AppEnv.GetLanguage() == "vi-VN") { lbl.Text = "<b>Trang " + lbl.Text + "</b>"; } else { lbl.Text = "Page " + lbl.Text; } } } } } } }
protected void rptCart_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView curData = (DataRowView)e.Item.DataItem; Literal litName = (Literal)e.Item.FindControl("litName"); //Literal litIndex = (Literal)e.Item.FindControl("litIndex"); Literal litRetailPrice = (Literal)e.Item.FindControl("litRetailPrice"); Literal litPrice = (Literal)e.Item.FindControl("litPrice"); //Literal litQuantity = (Literal)e.Item.FindControl("litQuantity"); TextBox txtQuantity = (TextBox)e.Item.FindControl("txtQuantity"); LinkButton lnkUpdate = (LinkButton)e.Item.FindControl("lnkUpdate"); LinkButton lnkRemove = (LinkButton)e.Item.FindControl("lnkRemove"); double price = ConvertUtility.ToDouble(curData["Price"]); int quantity = ConvertUtility.ToInt32(curData["Quantity"]); double pricesum = ConvertUtility.ToDouble(price * quantity); //litIndex.Text = ConvertUtility.ToString(e.Item.ItemIndex + 1); litName.Text = curData["Name"].ToString(); txtQuantity.Text = quantity.ToString(); txtQuantity.Attributes.Add("style", "text-align: center;"); litRetailPrice.Text = string.Format("{0:0,0}", price) + " VND"; litPrice.Text = string.Format("{0:0,0}", pricesum) + " VND"; if (AppEnv.GetLanguage() == "en-US") { lnkRemove.Text = "Delete"; lnkUpdate.Text = "Update"; } } }
protected void btnExport_Click(object sender, EventArgs e) { XmlDocument xmlDoc = new XmlDocument(); // Write down the XML declaration XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null); // Create the root element XmlElement rootNode = xmlDoc.CreateElement("ReportDataSet"); xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement); xmlDoc.AppendChild(rootNode); DataTable dt = BoPhanController.BoPhan_GetAllActive(); foreach (DataRow item in dt.Rows) { string desc = item["MoTa"].ToString(); string ten = item["Ten"].ToString(); XmlElement Node = xmlDoc.CreateElement("Table" + desc); rootNode.AppendChild(Node); DataTable dtNhanVien = TongHopDanhGiaCaNhanThangController.GetAllNhanVien(ten, ConvertUtility.ToInt32(dropNam.SelectedValue)); int stt = 1; foreach (DataRow itemNhanVien in dtNhanVien.Rows) { DataTable dtDataOfNhanVien = TongHopDanhGiaCaNhanThangController.GetAll(ten, ConvertUtility.ToInt32(dropNam.SelectedValue), itemNhanVien["HoTen"].ToString()); xmlDoc = BuildXmlDocument(dtDataOfNhanVien, xmlDoc, Node, stt, itemNhanVien["HoTen"].ToString()); stt++; } } if (!Directory.Exists(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/"))) { Directory.CreateDirectory(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/")); } //ds.Dispose(); string datetime = DateTime.Now.ToString("yyyyMMddHHmmss"); FileStream downloadFile = File.Create(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/") + "TongHopBaoCaoXepLoaiNhanVien_" + datetime + ".xls"); // transform XslTransform xsl = new XslTransform(); xsl.Load(Server.MapPath("/Template/" + "ReportTongHopXepLoaiNhanVien.xsl")); xsl.Transform(xmlDoc, null, downloadFile, null); downloadFile.Flush(); downloadFile.Close(); if (AppEnv.GetLanguage() == "vi-VN") { hplDownload.Text = "Hãy click vào liên kết này để Tải file về"; } else { hplDownload.Text = "Please, click here to download file"; } hplDownload.NavigateUrl = "/UpLoad/Temp/" + CurrentUser.UserID + "/TongHopBaoCaoXepLoaiNhanVien_" + datetime + ".xls"; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); DataList1.DataSource = PortalController.GetPortals(CurrentUser.UserID, AppEnv.GetLanguage()); DataList1.ItemDataBound += new DataListItemEventHandler(DataList1_ItemDataBound); DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { _contentid = ConvertUtility.ToInt32(Request.QueryString["contentid"]); //mydealInfo = MydealItemDB.GetInfo(_contentid); if (!IsPostBack) { ZoneUtility.LoadZonesByParentID(dropLopHoc.Items, ConvertUtility.ToInt32(SettingDB.GetValue(AppEnv.CMS_ZoneKhoaHoc + AppEnv.GetLanguage()))); dropLopHoc.Items.Insert(0, new ListItem("Lựa chọn lớp học", "0")); chklMonHoc.DataSource = MonhocDB.GetAll(); chklMonHoc.DataTextField = "Monhoc_Name"; chklMonHoc.DataValueField = "Monhoc_ID"; chklMonHoc.DataBind(); chklCoso.DataSource = CosoDB.GetAll(); chklCoso.DataTextField = "Coso_Name"; chklCoso.DataValueField = "Coso_ID"; chklCoso.DataBind(); chkVisible.Checked = true; } lblStatusUpdate.Text = string.Empty; }
public static DataTable GetPortalsByParentId(int userId, int portal_ParentId) { string param = "GetPortalsByParentId?userid=" + userId + "&portalId=" + portal_ParentId.ToString() + "&" + AppEnv.GetLanguage(); DataCaching data = new DataCaching(); DataTable dt = (DataTable)data.GetHashCache(key, param); if (dt != null) { return(dt); } dt = DataAccessProvider.Instance().GetPortalsByParentId(userId, portal_ParentId); data.SetHashCache(key, param, AppEnv.GetTimeCacheExpire(), dt); return(dt); }
public static DataTable GetByPositionID(int _positionID, bool _isEnable, string _paramCollections) { string enable = _isEnable ? "1" : "0"; string strSelectByOnlyID = " SELECT * FROM Adv_Advertises WHERE Advertise_Lang = '" + AppEnv.GetLanguage() + "' AND Advertise_PositionID = " + _positionID + " AND Advertise_Enable = " + enable + " AND PATINDEX('%|' + CAST({0} as varchar) + '|%','|' + Advertise_Params ) >0 "; string[] arrParams = _paramCollections.Split(new char[] { '|' }); string strCommand = string.Empty; foreach (string attachID in arrParams) { int id = ConvertUtility.ToInt32(attachID, -1); if (id != -1) { strCommand += string.Format(strSelectByOnlyID, id) + " UNION"; } } if (strCommand.Length > 0) { strCommand = strCommand.Substring(0, strCommand.Length - 6) + " ORDER BY Advertise_Priority ASC"; } DataTable retVal = null; SqlConnection dbConn = new SqlConnection(AppEnv.ConnectionString); SqlCommand dbCmd = new SqlCommand(strCommand, dbConn); dbCmd.CommandType = CommandType.Text; try { retVal = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(dbCmd); da.Fill(retVal); } finally { dbConn.Close(); } return(retVal); }
protected void Page_Load(object sender, EventArgs e) { zoneCurrent = ZoneUtility.GetZoneCurrent(); zoneHome = ConvertUtility.ToInt32(SettingDB.GetValue(AppEnv.CMS_ZoneHome + AppEnv.GetLanguage())); rptData.DataSource = ZoneDB.GetZoneVisbleInFooterNav(); rptData.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { _dotuoi = ConvertUtility.ToString(Request.QueryString["dt"]); _monhoc = ConvertUtility.ToString(Request.QueryString["mh"]); _coso = ConvertUtility.ToString(Request.QueryString["cs"]); _lophoc = ConvertUtility.ToString(Request.QueryString["lh"]); _khoahocid = ConvertUtility.ToInt32(Request.QueryString["khoahocid"]); if (!IsPostBack) { MiscUtility.FillIndex(dropDay, 1, 31, DateTime.Now.Day); MiscUtility.FillIndex(dropMonth, 1, 12, DateTime.Now.Month); MiscUtility.FillIndex(dropYear, 1950, DateTime.Now.Year, DateTime.Now.Year); dropFilterMonHoc.DataSource = MonhocDB.GetAll(); dropFilterMonHoc.DataTextField = "Monhoc_Name"; dropFilterMonHoc.DataValueField = "Monhoc_ID"; dropFilterMonHoc.DataBind(); dropFilterMonHoc.Items.Insert(0, new ListItem("Chọn môn học", "")); dropFilterCoso.DataSource = CosoDB.GetAll(); dropFilterCoso.DataTextField = "Coso_Name"; dropFilterCoso.DataValueField = "Coso_ID"; dropFilterCoso.DataBind(); dropFilterCoso.Items.Insert(0, new ListItem("Chọn cơ sở", "")); ZoneUtility.LoadZonesByParentID(dropFilterLopHoc.Items, ConvertUtility.ToInt32(SettingDB.GetValue(AppEnv.CMS_ZoneKhoaHoc + AppEnv.GetLanguage()))); dropFilterLopHoc.Items.Insert(0, new ListItem("Chọn lớp học", "")); MiscUtility.SetSelected(dropFilterDoTuoi.Items, _dotuoi); MiscUtility.SetSelected(dropFilterMonHoc.Items, _monhoc); MiscUtility.SetSelected(dropFilterLopHoc.Items, _lophoc); MiscUtility.SetSelected(dropFilterCoso.Items, _coso); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ZoneUtility.LoadZones(dropZoneHome.Items); foreach (ListItem item in dropZoneHome.Items) { //lstZones.Items.Add(new ListItem(item.Text,item.Value)); //lstZonesSmall.Items.Add(new ListItem(item.Text, item.Value)); dropClassRegister.Items.Add(new ListItem(item.Text, item.Value)); dropKhoaHoc.Items.Add(new ListItem(item.Text, item.Value)); } } dropZoneHome.SelectedIndex = -1; MiscUtility.SetSelected(dropZoneHome.Items, SettingDB.GetValue(AppEnv.CMS_ZoneHome + AppEnv.GetLanguage())); dropClassRegister.SelectedIndex = -1; MiscUtility.SetSelected(dropClassRegister.Items, SettingDB.GetValue(AppEnv.CMS_ZoneClassRegister + AppEnv.GetLanguage())); dropKhoaHoc.SelectedIndex = -1; MiscUtility.SetSelected(dropKhoaHoc.Items, SettingDB.GetValue(AppEnv.CMS_ZoneKhoaHoc + AppEnv.GetLanguage())); //if (!IsPostBack) //{ // string zoneFocus = "|" + SettingDB.GetValue(Constants.CMS_ZoneHomeFocus + AppEnv.GetLanguage()); // lstZoneFocus.Items.Clear(); // foreach (ListItem item in lstZones.Items) if (zoneFocus.IndexOf("|" + item.Value + "|") >= 0) lstZoneFocus.Items.Add(new ListItem(item.Text, item.Value)); // string zoneSmallFocus = "|" + SettingDB.GetValue(Constants.CMS_ZoneSmallFocus + AppEnv.GetLanguage()); // lstZonesSmallFocus.Items.Clear(); // foreach (ListItem itemS in lstZonesSmall.Items) if (zoneSmallFocus.IndexOf("|" + itemS.Value + "|") >= 0) lstZonesSmallFocus.Items.Add(new ListItem(itemS.Text, itemS.Value)); //} }
protected void Page_Load(object sender, EventArgs e) { lblLanguage.Text = AppEnv.GetLanguage(); }