protected void BackUpMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Database Backup Not Done');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void DuplicateVchMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Voucher Already Exist');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void btnAdd_Click(object sender, EventArgs e) { string csName = "CreateScript"; Type csType = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(csType, csName)) { StringBuilder csText = new StringBuilder(); csText.Append("<script> $(document).ready(function(){$('#create').modal({ backdrop: 'static', keyboard: false, show: true });});</script>"); cs.RegisterStartupScript(csType, csName, csText.ToString()); } }
/*====================================================*/ public void CorePage_RegisterStartupScript(String aSrcFile, String aKey) { String aScriptStr; aScriptStr = "<script language='JavaScript1.2' src='" + aSrcFile + "'>" + "</script>"; ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(aKey)) { cs.RegisterStartupScript(this.GetType(), aKey, aScriptStr); } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); ClientScriptManager scripts = Page.ClientScript; if (!scripts.IsClientScriptIncludeRegistered("jquery")) { scripts.RegisterClientScriptInclude("jquery", Page.ResolveClientUrl(ScriptPath + "js/jquery.js")); } if (!scripts.IsClientScriptIncludeRegistered("colorpicker")) { scripts.RegisterClientScriptInclude("colorpicker", Page.ResolveClientUrl(ScriptPath + "js/colorpicker.js")); } if (!scripts.IsClientScriptIncludeRegistered("eye")) { scripts.RegisterClientScriptInclude("eye", Page.ResolveClientUrl(ScriptPath + "js/eye.js")); } if (!scripts.IsClientScriptIncludeRegistered("utils")) { scripts.RegisterClientScriptInclude("utils", Page.ResolveClientUrl(ScriptPath + "js/utils.js")); } StringBuilder script = new StringBuilder(); script.AppendLine("<script type=\"text/javascript\">(function($){"); script.AppendLine("var initLayout = function() {"); script.AppendLine(string.Format("$('#colorSelector{0}').ColorPicker(", PickerID)); script.AppendLine("{onShow: function (colpkr) {"); script.AppendLine("$(colpkr).fadeIn(500);"); script.AppendLine("return false;"); script.AppendLine("},"); script.AppendLine("onBeforeShow: function(){"); script.AppendLine("$(this).ColorPickerSetColor(this.childNodes[0].style.backgroundColor);"); script.AppendLine("},"); script.AppendLine("onHide: function (colpkr) {"); script.AppendLine("$(colpkr).fadeOut(500);"); script.AppendLine("return false;"); script.AppendLine("},"); script.AppendLine("onChange: function (hsb, hex, rgb) {"); script.AppendLine( string.Format("$('#colorSelector{0} div').css('backgroundColor', '#' + hex);", PickerID)); script.AppendLine( string.Format("$('#colorSelectorInner{0} div').css('backgroundColor', '#' + hex);", PickerID)); script.AppendLine(string.Format("$('#{0}').val('#'+hex);", ID)); script.AppendLine("}});}; EYE.register(initLayout, 'init');})(jQuery)</script>"); if (!scripts.IsStartupScriptRegistered(typeof(ColorPicker), "register" + PickerID)) { scripts.RegisterStartupScript(typeof(ColorPicker), "register" + PickerID, script.ToString()); } }
protected void CreateUser_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; string sql = "INSERT INTO users (user_name, user_contact, user_email, user_password, role_id) VALUES (@name,@contact,@email,@password,@roleID);"; SqlCommand sqlcmd = new SqlCommand(sql, conn); sqlcmd.Parameters.Add("@name", SqlDbType.VarChar); sqlcmd.Parameters["@name"].Value = CompanyName.Text; sqlcmd.Parameters.Add("@contact", SqlDbType.VarChar); sqlcmd.Parameters["@contact"].Value = Contact.Text; sqlcmd.Parameters.Add("@email", SqlDbType.VarChar); sqlcmd.Parameters["@email"].Value = Email.Text; sqlcmd.Parameters.Add("@password", SqlDbType.VarChar); sqlcmd.Parameters["@password"].Value = Password.Text; sqlcmd.Parameters.Add("@roleID", SqlDbType.VarChar); sqlcmd.Parameters["@roleID"].Value = "CUS"; conn.Open(); int success = sqlcmd.ExecuteNonQuery(); conn.Close(); //fail if (success == 0) { //Error message Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, "PopupScript")) { String cstext = "alert('Something went wrong. Please contact Administrator for assistance');window.open('/Account/Login.aspx','_self');"; cs.RegisterStartupScript(cstype, "PopupScript", cstext, true); } } //success else { //Successful message Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, "PopupScript")) { String cstext = "alert('Successfully Registered.');window.open('/Account/Login.aspx','_self');"; cs.RegisterStartupScript(cstype, "PopupScript", cstext, true); } } }
protected void Sucessfull() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Booth Data Download Successfully done');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void InvalidGLAmtMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Please Input Voucher Amount');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { ibnext.Visible = false; string strInsert; SqlCommand cmdInsert; SqlConnection conCust; string connStr = ConfigurationManager.ConnectionStrings["BusConn"].ConnectionString; conCust = new SqlConnection(connStr); strInsert = "Insert Into Reservation (ReservationID, ReservationDate, ReservationTime, ReservationFrom, ReservationTo, ReservationSeatNumber,ReservationTotalSeat, ReservationTotalFare, ReservationBusNumber, ReservationName, ReservationPhoneNo, ReservationIC) Values (@ID, @Date, @Time, @From, @To, @SeatNumber, @TotalSeats, @TotalFare, @BusNo, @Name, @PhoneNo, @IC)"; cmdInsert = new SqlCommand(strInsert, conCust); cmdInsert.Parameters.AddWithValue("@ID", txtNumber.Text); cmdInsert.Parameters.AddWithValue("@Date", departon.SelectedValue); cmdInsert.Parameters.AddWithValue("@Time", DepartureTime.SelectedValue); cmdInsert.Parameters.AddWithValue("@From", fromdrop.SelectedValue); cmdInsert.Parameters.AddWithValue("@To", Destination.SelectedValue); cmdInsert.Parameters.AddWithValue("@SeatNumber", txtseat.Text); cmdInsert.Parameters.AddWithValue("@TotalSeats", txtTotalSeat.Text); cmdInsert.Parameters.AddWithValue("@TotalFare", txtTotalRent.Text); cmdInsert.Parameters.AddWithValue("@BusNo", txtBus.Text); cmdInsert.Parameters.AddWithValue("@Name", txtName.Text); cmdInsert.Parameters.AddWithValue("@PhoneNo", txtPhone.Text); cmdInsert.Parameters.AddWithValue("@IC", txtIc.Text); conCust.Open(); cmdInsert.ExecuteNonQuery(); Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the startup script is already registered. if (!cs.IsStartupScriptRegistered(cstype, "PopupScript")) { String cstext = "alert('Bus seat(s) suscessfully reserved.');"; cs.RegisterStartupScript(cstype, "PopupScript", cstext, true); } conCust.Close(); generateXML(); Response.Redirect("print.aspx"); }
protected void MSG2() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('New Password did not match.');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void MSG1() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { DisplayMsg.Text = "Old Password did not match."; DisplayMassage(); } return; }
protected void IDMSG5() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('ID Using in Off Booth Module');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void LicenseMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('You Don't Have Permission');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered("listSprints")) { cs.RegisterStartupScript(this.GetType(), "listSprints", "<script type=\"text/javascript\" src=\"" + ResolveClientUrl("~/Scripts/Modules/Sprint/list.js") + "\" ></script>", false); } BindData(); } }
protected void UpdateMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Reset Passward with XXXXXXXX');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void ProcessDoneMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Current Date Process Done');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
/// <summary> /// Registers the collapse expand client script. /// </summary> private void RegisterCollapseExpandClientScript() { StringBuilder script = new StringBuilder(File.ReadAllText(Path.Combine(ApplicationAdapter.GetDataFilesMapPath(), "CollapseExpandScript.template"))); script.Replace("[RootCookieName]", ApplicationAdapter.GetSiteName()); ClientScriptManager scriptManager = this.ClientScript; Type typeToUse = this.GetType(); if (!scriptManager.IsStartupScriptRegistered("CollapseExpandScript")) { // register scriptManager.RegisterStartupScript(typeToUse, "CollapseExpandScript", script.ToString(), true); } }
protected void MSG4() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { DisplayMsg.Text = "Empty New Password Inputted"; DisplayMassage(); } return; }
protected void AbnormalMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('User Id is using by other client or Abnormal Logout');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void UsedMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Id Already Use');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void NotUpdateMSG() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Sorry!!Data has not been Saved');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
protected void MSG3() { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('Data Saved Successfully.');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } return; }
public void RegisterAlertScript(String sText) { String csname1 = "PopupScript" + DateTime.Now; Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { StringBuilder cstext1 = new StringBuilder(); cstext1.Append("<script type=text/javascript> alert('" + sText + "') </"); cstext1.Append("script>"); cs.RegisterStartupScript(cstype, csname1, cstext1.ToString()); } }
/// <summary> /// Populates the search controls with the values from the search criteria. /// </summary> /// <param name="criteria">The populated search criteria.</param> public void PopulatePage(JobSearchCriteria criteria) { string scriptName = "PopulateCriteria"; Type thisType = this.GetType(); ClientScriptManager mgr = Page.ClientScript; if (!mgr.IsStartupScriptRegistered(thisType, scriptName)) { StringBuilder scriptText = new StringBuilder(); scriptText.Append("<script type=text/javascript>" + Environment.NewLine); if (criteria.StartDate != DateTime.MinValue) { scriptText.Append(Utilities.GetJavascriptSetValueSnippet("StartDate", criteria.StartDate.ToString("dd/MM/yyyy"))); } if (criteria.EndDate != DateTime.MinValue) { scriptText.Append(Utilities.GetJavascriptSetValueSnippet("EndDate", criteria.EndDate.ToString("dd/MM/yyyy"))); } scriptText.Append(Utilities.GetJavascriptSetValueSnippet("RecordsPerPage", criteria.RecordsPerPage.ToString())); // only set dropdowns if the user selected a value if (!string.IsNullOrEmpty(criteria.SortBy)) { scriptText.Append(Utilities.GetJavascriptSetValueSnippet("SortBy", criteria.SortBy)); } if (criteria.InProgressJobs) { scriptText.Append(Utilities.GetJavascriptSetCheckboxValueSnippet("JobStatus_InProgress", "Y")); } if (criteria.CompletedJobs) { scriptText.Append(Utilities.GetJavascriptSetCheckboxValueSnippet("JobStatus_Complete", "Y")); } if (criteria.FailedJobs) { scriptText.Append(Utilities.GetJavascriptSetCheckboxValueSnippet("JobStatus_Failed", "Y")); } // end scriptText.Append("</script>"); mgr.RegisterStartupScript(thisType, scriptName, scriptText.ToString()); } }
protected int CheckUserId() { // For Return Value of CheckUserId() //--------------------------------- // 0 = Id is Available // 1 = ID not in Table // 2 = Please Change Password - New Id was created // 3 = Id was not Initialize - Abnormal Logout //--------------------------------- // End of For Return Value of CheckUserId() try { A2ZSYSIDSDTO idsDto = A2ZSYSIDSDTO.GetUserInformation(Converter.GetInteger(txtIdNo.Text), "A2ZHKOMS"); if (idsDto.IdsNo == 0) { String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('ID Not Found .');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); txtIdNo.Text = string.Empty; } return(0); } OrgPass.Value = idsDto.IdsPass; if (idsDto.IdsPass == "XXXXXXXX") { return(2); } //if (idsDto.IdsLogInFlag == 1) //{ // return 3; //} return(0); } catch (Exception ex) { throw ex; } }
protected void btnOpenForMultyUser_Click(object sender, EventArgs e) { int intModule = Converter.GetSmallInteger(ddlModule.SelectedValue); string sqlQuery = string.Empty; string msg = ""; switch (intModule) { case 1: sqlQuery = "UPDATE A2ZHKPARAMETER SET SingleUserFlag = 0"; Converter.GetInteger(DataAccessLayer.BLL.CommonManager.Instance.ExecuteNonQuery(sqlQuery, "A2ZACOMS")); msg = "Successfully Done for - Customer Service Module"; break; case 2: sqlQuery = "UPDATE A2ZINVPARAMETER SET SingleUserFlag = 0"; Converter.GetInteger(DataAccessLayer.BLL.CommonManager.Instance.ExecuteNonQuery(sqlQuery, "A2ZGLCUBS")); msg = "Successfully Done for - General Ledger Module"; break; case 3: sqlQuery = "UPDATE A2ZHRPARAMETER SET SingleUserFlag = 0"; Converter.GetInteger(DataAccessLayer.BLL.CommonManager.Instance.ExecuteNonQuery(sqlQuery, "A2ZHKCUBS")); msg = "Successfully Done for - House Keeping Module"; break; case 4: sqlQuery = "UPDATE A2ZGLPARAMETER SET SingleUserFlag = 0"; Converter.GetInteger(DataAccessLayer.BLL.CommonManager.Instance.ExecuteNonQuery(sqlQuery, "A2ZHRCUBS")); msg = "Successfully Done for - Human Resource Module"; break; case 5: sqlQuery = "UPDATE A2ZGLPARAMETER SET SingleUserFlag = 0"; Converter.GetInteger(DataAccessLayer.BLL.CommonManager.Instance.ExecuteNonQuery(sqlQuery, "A2ZINVCUBS")); msg = "Successfully Done for - Inventory Module"; break; } String csname1 = "PopupScript"; Type cstype = GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = "alert('" + msg + "');"; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } }
/// <summary> /// 显示 浏览器的Alert。 /// </summary> /// <param name="text">消息文本。</param> public void MessageBox(string text) { text = text == null ? "" : text; ClientScriptManager csm = this.ClientScript; Type csType = this.GetType(); if (!csm.IsStartupScriptRegistered(csType, this.UniqueID + "alert")) { text = text.Replace("\r", "\\r"); text = text.Replace("\n", "\\n"); text = text.Replace("\"", "\\'"); string js = "window.alert(\"" + text + "\");"; csm.RegisterStartupScript(csType, this.UniqueID + "alert", js, true); } }
/// <summary> /// 重定向页面 /// </summary> /// <param name="page">Asp.Net窗体对象</param> public static void Redirect(Page page, string strUrl) { StringBuilder script = new StringBuilder("<script language='javascript'>"); script.Append("top.location.href='" + strUrl + "';"); script.Append("</script>"); //ScriptManager.RegisterStartupScript(page, page.GetType(), "Redirect", script.ToString(), false); ClientScriptManager csm = page.ClientScript; if (!csm.IsStartupScriptRegistered(page.GetType(), "Redirect")) { csm.RegisterStartupScript(page.GetType(), "Redirect", script.ToString()); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs e) { string csname = "testscript"; Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsStartupScriptRegistered(cstype, csname)) { { string cstext = "NewProject.Show() ;"; cs.RegisterStartupScript(cstype, csname, cstext, true); } } }
protected void CreateUser_CreateUserError(object sender, CreateUserErrorEventArgs e) { // Define the name and type of the client scripts on the page. String csErrorRowName = "errorRowScript"; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the startup script is already registered. if (!cs.IsStartupScriptRegistered(cstype, csErrorRowName)) { cs.RegisterStartupScript(cstype, csErrorRowName, "document.getElementById(\"errorRow\").style.display=\"block\";", true); } }