Пример #1
0
        protected void btnAdd_Click(Object Sender, EventArgs e)
        {
            int intParent = Int32.Parse(Request.Form[hdnParent.UniqueID]);

            if (Request.Form[hdnId.UniqueID] == "0")
            {
                oLocation.AddCity(intParent, txtName.Text, txtCode.Text, txtZip.Text, txtEnclosureName.Text, (chkEnabled.Checked ? 1 : 0));
            }
            else
            {
                oLocation.UpdateCity(Int32.Parse(Request.Form[hdnId.UniqueID]), intParent, txtName.Text, txtCode.Text, txtZip.Text, txtEnclosureName.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.UpdateCityOrder(intId, intCount);
                }
            }
            Response.Redirect(Request.Path);
        }
Пример #2
0
 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>");
     }
 }