protected void Page_Load(object sender, EventArgs e) { string linkID = string.IsNullOrEmpty(Request.QueryString["FunctionId"]) ? "0" : Request.QueryString["FunctionId"]; // Load language contents if (!IsPostBack) { functionId = int.Parse(linkID); t_Function functionList = functionBL.FindSingle(x => x.FunctionId == functionId); // Vietnamese language zone if (functionList != null) { txtFormName.Text = functionList.FunctionName; txtURL.Text = functionList.URL; txtStatus.SelectedValue = (functionList.IsOnMenu == true) ? "1" : "0"; } } // Required messgage warning RequiredFieldValidator1.ErrorMessage = "** Required value"; }
private void LoadData(string role) { CheckList(role); // Load language contents - vietnamse List <t_RoleFunction> contentList = roleFunctionBL.FindAll(s => s.Role == role).OrderBy(s => s.Role).ToList(); List <t_RoleFunction_DTO> listDTO = new List <t_RoleFunction_DTO>(); int index = 0; foreach (var item in contentList) { t_Function singleF_vi = functionBL.FindSingle(x => x.FunctionId == item.FunctionId); if (string.IsNullOrEmpty(singleF_vi.URL)) { continue; } t_Function singleF_en = functionBL.FindSingle(x => x.URL == singleF_vi.URL && x.Language == "en"); t_Function singleF_other = functionBL.FindSingle(x => x.URL == singleF_vi.URL && x.Language == "other"); string functionname = ""; switch (language) { case "vi": functionname = singleF_vi.FunctionName; break; case "en": functionname = singleF_en.FunctionName; break; case "other": functionname = singleF_other.FunctionName; break; default: functionname = singleF_vi.FunctionName; break; } switch (singleF_vi.Note) { case "Parent": break; case "Children": functionname = "-- " + functionname; break; default: break; } listDTO.Add(new t_RoleFunction_DTO { Id_display = (index + 1).ToString("0000"), FunctionName_vi = functionname, //FunctionName_en = singleF_en.FunctionName, //FunctionName_other = singleF_other.FunctionName, Active = (bool)item.Active, Role = item.Role, FunctionId = item.FunctionId, }); index++; } DataTable dt = new DataTable(); GridView1.DataSource = ToDataTable(listDTO); GridView1.DataBind(); }