protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { cgApp.GetCateGroyListByUserID(UserInfo.ID) .BindDropdown <CateGoryEntity>(ddlCategories, "Title", "GID", DefaulSelectText, "", QS("category")); if (ddlCategories.Items.Count > 1 && string.IsNullOrEmpty(ddlCategories.SelectedValue)) { ddlCategories.SelectedIndex = 1; } CurrentModel = GetEntity(); if (CurrentModel != null) { InitControl(); } else { phlDelete.Visible = false; phlEmpty.Visible = false; CurrentModel = new CateGoryEntity(); } } else { CurrentModel = GetEntity(); } }
protected void Page_Load(object sender, EventArgs e) { ((Normal)this.Master).CurrentModule = Codes.SelectedSunnetMenu.Ticket; if (!IsPostBack) { //CateGory CateGoryApplication cgApp = new CateGoryApplication(); List <CateGoryEntity> listCC = cgApp.GetCateGroyListByUserID(((BasePage)this.Page).UserInfo.ID); rptCategory.DataSource = listCC; rptCategory.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(Request.Params["date"])) { this.SelectedDate = Convert.ToDateTime(Request.QueryString["date"]); if (!TimeSheetTicket.CanEdit(this.SelectedDate)) { Redirect("Index.aspx"); } if (SelectedDate.Date > DateTime.Now) { btnSubmit.Visible = false; } } else { this.SelectedDate = DateTime.Now; } } catch { this.SelectedDate = DateTime.Now; } if (!IsPostBack) { Title = "Write timesheet - " + SelectedDate.ToString("MM/dd/yyyy"); List <CateGoryEntity> list = cgApp.GetCateGroyListByUserID(UserInfo.ID); if (list == null) { list = new List <CateGoryEntity>(); } var category = list.Select(x => new { category = x.Title, id = x.ID }).ToList(); category.Insert(0, new { category = DefaulSelectText, id = 0 }); this.CategoryJson = JsonConvert.SerializeObject(category, DoBase.DateConverter); List <ProjectDetailDTO> listProj = projApp.GetUserProjects(UserInfo); if (listProj != null && listProj.Count > 0) { listProj.RemoveAll(r => r.Status == ProjectStatus.Cancelled || r.Status == ProjectStatus.Completed); } var project = listProj.Select(x => new { title = x.Title, id = x.ProjectID, tickets = new List <int>() }).ToList(); project.Insert(0, new { title = DefaulSelectText, id = 0, tickets = new List <int>() }); this.ProjectJson = JsonConvert.SerializeObject(project, DoBase.DateConverter); } totalQWeeklyHours = tsApp.TotalWeeklyHours(this.SelectedDate, UserInfo.ID); }
protected void Page_Load(object sender, EventArgs e) { TopMenu1.ParentID = 1; UserApplication userApp = new UserApplication(); string keyPath = "/sunnet/"; string url = Request.Url.AbsolutePath.ToLower(); string topModule = url.Replace(keyPath, ""); topModule = topModule.Substring(0, topModule.IndexOf("/") + 1); topModule = keyPath + topModule; ModulesEntity moduleTop = userApp.GetModule(topModule); if (moduleTop != null) { if (UserInfo.Role == RolesEnum.CLIENT && moduleTop.ModuleTitle.Trim().ToLower() == "clients") { moduleTop.ModuleTitle = "Tickets"; } this.TopSelectedIndex = moduleTop.ID; ltlCurrentModule.Text = moduleTop.ModuleTitle; } //url += Request.Url.Query; ModulesEntity moduleCurrent = userApp.GetModule(url); if (moduleCurrent != null) { this.LeftSelectedIndex = moduleCurrent.ParentID; this.LeftSecondSelectedIndex = moduleCurrent.ID; } //CateGory CateGoryApplication cgApp = new CateGoryApplication(); List <CateGoryEntity> listCC = cgApp.GetCateGroyListByUserID(UserInfo.ID); rptCategory.DataSource = listCC; rptCategory.DataBind(); rptCateGory2.DataSource = listCC; rptCateGory2.DataBind(); // Client Or Sunnet topMenu_category.Visible = UserInfo.Role != RolesEnum.CLIENT; InitCompanyInfo(); }
private void InitControls() { CateGoryApplication cgApp = new CateGoryApplication(); List <CateGoryEntity> list = cgApp.GetCateGroyListByUserID(UserInfo.ID); list.BindDropdown(ddlCategorys, "Title", "ID", "Please Select", "0"); if (list != null && list.Count == 1) { ddlCategorys.AddEmptyItem(0, "Please Select", "0", true); } List <ProjectDetailDTO> listProj = projApp.GetUserProjects(UserInfo); if (listProj != null && listProj.Count > 0) { listProj.BindDropdown <ProjectDetailDTO>(ddlProject, "Title", "ID", "Please Select", "0"); } if (listProj != null && listProj.Count == 1) { ddlProject.AddEmptyItem(0, "Please Select", "0", true); } }
public void ProcessRequest(HttpContext context) { CateGoryApplication ccApp = new CateGoryApplication(); HttpRequest request = context.Request; context.Response.ContentType = "text/plain"; if (IdentityContext.UserID <= 0) { context.Response.Write("[]"); return; } if (string.IsNullOrEmpty(request["type"])) { List <CateGoryEntity> listcategories = ccApp.GetCateGroyListByUserID(UserID); if (listcategories == null || listcategories.Count == 0) { context.Response.Write("[]"); } else { string jsonCategories = UtilFactory.Helpers.JSONHelper.GetJson <List <CateGoryEntity> >(listcategories); context.Response.Write(jsonCategories); } } else { int ticketid = 0; int categoryid = 0; bool checkinput = ( (!string.IsNullOrEmpty(request["ticketid"])) && (!string.IsNullOrEmpty(request["cagetoryid"])) && int.TryParse(request["ticketid"], out ticketid) && int.TryParse(request["cagetoryid"], out categoryid) && ticketid >= 0 && categoryid > 0); if (checkinput) { CateGoryTicketEntity model = CateGoryFactory.CreateCateGoryTicketEntity(UserID, ObjectFactory.GetInstance <ISystemDateTime>()); model.TicketID = ticketid; model.CategoryID = categoryid; switch (request["type"]) { case "addtocategory": int id = ccApp.AssignTicketToCateGory(model); if (id > 0) { context.Response.Write("true"); } else { context.Response.Write("false"); } break; case "removefromcategory": bool result = ccApp.RemoveTicketFromCateGory(ticketid, categoryid); context.Response.Write(result.ToString().ToLower()); break; case "deletecategory": bool result2 = ccApp.DeleteCateGroy(categoryid); context.Response.Write(result2.ToString().ToLower()); break; default: context.Response.Write("null"); break; } } else { context.Response.Write("false"); } } }