protected void btnSaveNew_Click(Object Sender, EventArgs e) { if (Request.QueryString["new"] != null) { TextInfo oText = new CultureInfo("en-US", false).TextInfo; string strState = oText.ToTitleCase(txtState.Text.ToLower()); int intState = oLocation.GetState(strState); if (intState == 0) { oLocation.AddState(strState, "", 1); intState = oLocation.GetState(strState); } string strCity = oText.ToTitleCase(txtCity.Text.ToLower()); int intCity = oLocation.GetCity(strCity); if (intCity == 0) { oLocation.AddCity(intState, strCity, "", "", "", 1); intCity = oLocation.GetCity(strCity); } string strAddress = oText.ToTitleCase(txtAddress.Text.ToLower()); int intAddress = oLocation.GetAddress(strAddress); if (intAddress == 0) { oLocation.AddAddress(intCity, strAddress, "", 0, "", 0, 0, 0, 0, 1, "", "", 0, 0, 0, 0, 0, 1); intAddress = oLocation.GetAddress(strAddress); } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "new_saved", "<script type=\"text/javascript\">alert('Location Added Successfully');window.parent.UpdateLocation('" + intAddress.ToString() + "','" + Request.QueryString["control"] + "','" + oLocation.GetFull(intAddress) + "','" + Request.QueryString["controltext"] + "');window.parent.HidePanel();<" + "/" + "script>"); } }
protected void btnAdd_Click(Object Sender, EventArgs e) { if (Request.Form[hdnId.UniqueID] == "0") { oLocation.AddState(txtName.Text, txtCode.Text, (chkEnabled.Checked ? 1 : 0)); } else { oLocation.UpdateState(Int32.Parse(Request.Form[hdnId.UniqueID]), txtName.Text, txtCode.Text, (chkEnabled.Checked ? 1 : 0)); } if (Request.Form[hdnOrder.UniqueID] != "") { string strOrder = Request.Form[hdnOrder.UniqueID]; int intCount = 0; while (strOrder != "") { intCount++; int intId = Int32.Parse(strOrder.Substring(0, strOrder.IndexOf("&"))); strOrder = strOrder.Substring(strOrder.IndexOf("&") + 1); oLocation.UpdateStateOrder(intId, intCount); } } Response.Redirect(Request.Path); }