protected void Page_Load(object sender, EventArgs e) { if (SessionManager.CurrentUser == null) { Common.RedirectToLoginPage(this); return; } else if (!IsPostBack) { FillLabelLanguage(); if (Request.QueryString["TypeID"] != null) { string typeID = Request.QueryString["TypeID"]; ParamType unit = new ParamTypeRepository().FindOne(new ParamType(typeID)); txtTypeID.Text = unit.TypeID; txtLabel.Text = unit.Label; } } }
protected void OnBtnSaveClicked(object sender, EventArgs e) { ParamTypeRepository repo = new ParamTypeRepository(); ParamType saveItem = new ParamType(); saveItem.TypeID = txtTypeID.Text; saveItem.Label = txtLabel.Text; if (Request.QueryString["TypeID"] == null) { ParamType oldItem = repo.FindOne(new ParamType(txtTypeID.Text)); if (oldItem == null) repo.InserNewUnit(saveItem); else { string message = ResourceManager.GetString("itemAlreadyExist"); string script1 = "<script type=\"text/javascript\">"; script1 += " alert(\"" + message + "\");"; script1 += " </script>"; if (!ClientScript.IsClientScriptBlockRegistered("redirectUser")) ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script1); } } else { repo.Update(saveItem); } string script = "<script type=\"text/javascript\">"; script += " OnBtnSaveClientClicked();"; script += " </script>"; if (!ClientScript.IsClientScriptBlockRegistered("redirectUser")) ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script); }
protected void OnUnitDeleteClicked(object sender, EventArgs e) { LinkButton lnkItem = (LinkButton)sender; string unit = lnkItem.CommandArgument; ParamType deleteItem = new ParamType(); deleteItem.TypeID = unit; ParamTypeRepository repo = new ParamTypeRepository(); repo.Delete(deleteItem); BindGridData(); gridUnits.DataBind(); }
private void BindGridData() { ParamTypeRepository repo = new ParamTypeRepository(); gridUnits.DataSource = repo.FindAll(); }
private void InitControls() { //Load header drop down data ParamTypeRepository paramTypeRepo = new ParamTypeRepository(); ddlUnit.DataValueField = "TypeID"; ddlUnit.DataTextField = "Label"; ddlUnit.DataSource = paramTypeRepo.FindAll(); ddlUnit.DataBind(); ParamUserRepository paramUserRepo = new ParamUserRepository(); ddlInterviewer.DataValueField = "UserID"; ddlInterviewer.DataTextField = "LastName"; ddlInterviewer.DataSource = paramUserRepo.GetAllUser(true); ddlInterviewer.DataBind(); if (!string.IsNullOrEmpty(Request.QueryString["CandidateID"])) lnkCanContactAdd.OnClientClick = string.Format("return OncandidateContactAddClientClicked('{0}')",Request.QueryString["CandidateID"]); else lnkCanContactAdd.OnClientClick = string.Format("return OncandidateContactAddClientClicked('')"); //if (!string.IsNullOrEmpty(Request.QueryString["CandidateId"])) //{ // radTabStripCandidateProfile.OnClientLoad = "javascript:onLoadCandidateProfile();"; //} if (!string.IsNullOrEmpty(Request.QueryString["CandidateID"])) lnkAddNewDocument.Attributes.Add("onclick", string.Format("OnDocumentEditClientClicked({0},\"\")", Request.QueryString["CandidateID"])); //tab study HttpCookie studyGridPageSizeCookie = Request.Cookies.Get("cand_studygrdps"); if (studyGridPageSizeCookie != null) { if (!string.IsNullOrEmpty(studyGridPageSizeCookie.Value)) gridStudies.PageSize = Convert.ToInt32(studyGridPageSizeCookie.Value) > 0 ? Convert.ToInt32(studyGridPageSizeCookie.Value) : gridStudies.PageSize; } HttpCookie experienceGridPageSizeCookie = Request.Cookies.Get("cand_expgrdps"); if (experienceGridPageSizeCookie != null) { if (!string.IsNullOrEmpty(experienceGridPageSizeCookie.Value)) gridExperience.PageSize = Convert.ToInt32(experienceGridPageSizeCookie.Value) > 0 ? Convert.ToInt32(experienceGridPageSizeCookie.Value) : gridExperience.PageSize; } //tab actions HttpCookie actionGridPageSizeCookie = Request.Cookies.Get("cand_actgrdps"); if (actionGridPageSizeCookie != null) { if (!string.IsNullOrEmpty(actionGridPageSizeCookie.Value)) gridActions.PageSize = Convert.ToInt32(actionGridPageSizeCookie.Value) > 0 ? Convert.ToInt32(actionGridPageSizeCookie.Value) : gridActions.PageSize; } //tab Document HttpCookie docGridPageSizeCookie = Request.Cookies.Get("cand_docgrdps"); if (docGridPageSizeCookie != null) { if (!string.IsNullOrEmpty(docGridPageSizeCookie.Value)) grdDocuments.PageSize = Convert.ToInt32(docGridPageSizeCookie.Value) > 0 ? Convert.ToInt32(docGridPageSizeCookie.Value) : grdDocuments.PageSize; } }