protected void OnBtnSaveClicked(object sender, EventArgs e) { ParamProfileRepository repo = new ParamProfileRepository(); ParamProfile saveItem = new ParamProfile(); saveItem.Profile = txtProfile.Text.Trim(); saveItem.ProfileCode = txtCode.Text.Trim(); if (string.IsNullOrEmpty(Request.QueryString["ProfileID"])) { repo.Insert(saveItem); } else { saveItem.ProfileID = int.Parse(Request.QueryString["ProfileID"]); 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 Page_Load(object sender, EventArgs e) { if (SessionManager.CurrentUser == null) { Common.RedirectToLoginPage(this); return; } else if (!IsPostBack) { FillLabelLanguage(); if (Request.QueryString["ProfileID"] != null) { int profileID = int.Parse(Request.QueryString["ProfileID"]); ParamProfile profile = new ParamProfileRepository().FindOne(new ParamProfile(profileID)); txtProfile.Text = profile.Profile; txtCode.Text = profile.ProfileCode; } } }
protected void OnMyAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) { if (e.Argument.IndexOf("ddlProfileClientChanged") > -1) { JobProfileAjaxManager.AjaxSettings.AddAjaxSetting(JobProfileAjaxManager, ddlFunction); int profileID = -1; if (int.TryParse(ddlProfile.SelectedValue, out profileID)) { ParamProfile profile = new ParamProfileRepository().FindOne(new ParamProfile(Int32.Parse(ddlProfile.SelectedValue))); if (profile != null) { ddlFunction.DataSource = new ParamFunctionFamRepository().GetParamFunctionFamByGenre(profile.ProfileCode); ddlFunction.DataBind(); ddlFunction.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("select", "")); } } else { ddlFunction.DataSource = new ParamFunctionFamRepository().FindAll(); ddlFunction.DataBind(); ddlFunction.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("select", "")); } } else if (e.Argument.IndexOf("ViewEditJobProfile") > -1) { string url = Request.Url.PathAndQuery; if (hidMode.Value == "view") { if (!string.IsNullOrEmpty(Request.QueryString["mode"])) url = url.Replace(Request.QueryString["mode"], "edit"); else url += "&mode=edit"; Response.Redirect(url, true); } else { if (!string.IsNullOrEmpty(Request.QueryString["mode"])) url = url.Replace(Request.QueryString["mode"], "view"); else url += "&mode=view"; Response.Redirect(url, true); } } else if (e.Argument.IndexOf("SaveJob") > -1) { Neos.Data.Job job = SaveJobInfo(); if (job != null) { string addBackUrl = string.Empty; if (!string.IsNullOrEmpty(Request.QueryString["backurl"]) && Request.QueryString["backurl"] == "visible") { addBackUrl = "&backurl=visible"; } Response.Redirect(string.Format("~/JobProfile.aspx?JobId={0}&mode=view" + addBackUrl, job.JobID)); } } else if (e.Argument.IndexOf("PreviewJob") > -1) { string script = string.Format("openPopUp('{0}')", WebConfig.NeosJobDetailURL + Request.QueryString["JobID"]); JobProfileAjaxManager.ResponseScripts.Add(script); } }
protected void OnProfileDeleteClicked(object sender, EventArgs e) { LinkButton lnkItem = (LinkButton)sender; int profileID = int.Parse(lnkItem.CommandArgument); ParamProfile deleteItem = new ParamProfile(profileID); ParamProfileRepository repo = new ParamProfileRepository(); repo.Delete(deleteItem); BindGridData(); gridProfiles.DataBind(); }
private void BindGridData() { ParamProfileRepository repo = new ParamProfileRepository(); gridProfiles.DataSource = repo.GetAllProfiles(); }