public JsonResult fillstate(int id)
        {
            DLAddresses model = new DLAddresses();

            model.States = BLOrder.PopulateDropDown("StoredProcStates", id);
            return(Json(model.States));
        }
        public JsonResult AjaxMethod(string type, int value)
        {
            DLAddresses model = new DLAddresses();

            switch (type)
            {
            case "CountryId":
                model.States = BLOrder.PopulateDropDown("StoredProcStates", value);
                break;

            case "StateId":
                model.Cities = BLOrder.PopulateDropDown("StoredProcCities", value);
                break;
            }
            return(Json(model));
        }
Esempio n. 3
0
        public bool Address(DLAddresses ad, string action)
        {
            int result;

            try
            {
                SqlCommand cmd = new SqlCommand("StoredProcAddress", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@customerId", ad.CustomerId);
                cmd.Parameters.AddWithValue("@fullname", ad.FullName);
                cmd.Parameters.AddWithValue("@mobile", ad.Mobile);
                cmd.Parameters.AddWithValue("@pincode", ad.PinCode);
                cmd.Parameters.AddWithValue("@address", ad.Address);
                cmd.Parameters.AddWithValue("@cityId", ad.CityId);
                cmd.Parameters.AddWithValue("@stateId", ad.StateId);
                cmd.Parameters.AddWithValue("@countryId", ad.CountryId);
                cmd.Parameters.AddWithValue("@type", ad.AddressType);
                cmd.Parameters.AddWithValue("@Action", action);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                result = cmd.ExecuteNonQuery();
                cmd.Dispose();
                if (result > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
        public ActionResult Address(DLAddresses ad, string Save)
        {
            try
            {
                string Action;
                if (!String.IsNullOrEmpty(Save))
                {
                    Action = "Insert";
                }
                else
                {
                    Action = "Update";
                }
                ad.CustomerId = Convert.ToInt32(Session["CustomerId"]);
                balOrder.Address(ad, Action);

                return(Redirect("/Order/Orders"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }