public ActionResult ShopDataNew()
        {

            CommonData dummy = new CommonData
            {
                Name = "-Select-",
                Id = 0
            };

            IList<CommonData> CountryList = lookup.GetDropDownData("Country");
            SelectList Coutries = new SelectList(CountryList, "Id", "Name");
            ViewBag.Coutries = Coutries;

            IList<CommonData> StateList = lookup.GetDropDownData("State");
            SelectList States = new SelectList(StateList, "Id", "Name");
            ViewBag.States = States;

            IList<CommonData> DistrictList = lookup.GetDropDownData("District");
            DistrictList.Insert(0, dummy);
            SelectList Districts = new SelectList(DistrictList, "Id", "Name");
            ViewBag.Districts = Districts;

            IList<CommonData> TalukList = lookup.GetDropDownData("Taluk");
            TalukList.Insert(0, dummy);
            SelectList Taluks = new SelectList(TalukList, "Id", "Name");
            ViewBag.Taluks = Taluks;

            return View();
        }
Esempio n. 2
0
        public bool InsertCommonData(CommonData cd)
        {
            int res = 0;
            try
            {
                var sql = "[dbo].[InsertCommonData]";
                DynamicParameters param = new DynamicParameters();
                param.Add("type", cd.Type);
                param.Add("name", cd.Name);
                param.Add("value", cd.Value);
                param.Add("descrption", cd.Descrption);

                cn.Open();
                res = cn.Execute(sql, param, commandType: CommandType.StoredProcedure);
                cn.Close();

            }
            catch (Exception ex)
            {
            }
            finally
            {
                cn.Close();
            }
            return Convert.ToBoolean(res);
        }
        private void Registerlookup()
        {
            CommonData dummy = new CommonData
           {
               Name = "-Select-",
               Id = 0
           };
            #region GenderTypeList
            List<CommonData> GenderTypeList = new List<CommonData>();
            GenderTypeList.Add(new CommonData { Name = "Male", Value = "Male" });
            GenderTypeList.Add(new CommonData { Name = "Female", Value = "Female" });
            GenderTypeList.Add(new CommonData { Name = "Other", Value = "Other" });
            #endregion


            ViewBag.GenderTypes = GenderTypeList;

            IList<CommonData> CityTypeList = lookup.GetDropDownData("City Type");
            CityTypeList.Insert(0, dummy);
            SelectList CityTypes = new SelectList(CityTypeList, "Id", "Name");
            ViewBag.CityTypes = CityTypes;

            IList<CommonData> CountryList = lookup.GetDropDownData("Country");
            //CountryList.Insert(0, dummy);
            SelectList Coutries = new SelectList(CountryList, "Id", "Name");
            ViewBag.Coutries = Coutries;

            IList<CommonData> StateList = lookup.GetDropDownData("State");
            //StateList.Insert(0, dummy);
            SelectList States = new SelectList(StateList, "Id", "Name");
            ViewBag.States = States;

            IList<CommonData> DistrictList = lookup.GetDropDownData("District");
            DistrictList.Insert(0, dummy);
            SelectList Districts = new SelectList(DistrictList, "Id", "Name");
            ViewBag.Districts = Districts;

            IList<CommonData> TalukList = lookup.GetDropDownData("Taluk");
            TalukList.Insert(0, dummy);
            SelectList Taluks = new SelectList(TalukList, "Id", "Name");
            ViewBag.Taluks = Taluks;

            IList<CommonData> CardTypeList = lookup.GetDropDownData("Card Type");
            //CardList.Insert(0, dummy);
            SelectList CardTypes = new SelectList(CardTypeList, "Id", "Name");
            ViewBag.CardTypes = CardTypes;
        }
 public string AddCommonData()
 {
     CommonData cd = new CommonData();
     bool res = false;
     string mes = "";
     if (Request.Form["drpcommontypedialog"] != null && Request.Form["drpcommontypedialog"] != "")
         cd.Type = Request.Form["drpcommontypedialog"];
     else
         cd.Type = "";
     if (Request.Form["txtnamedialog"] != null && Request.Form["txtnamedialog"] != "")
         cd.Name = Request.Form["txtnamedialog"];
     else
         cd.Name = "";
     if (Request.Form["txtvaluedialog"] != null && Request.Form["txtvaluedialog"] != "")
         cd.Value = Request.Form["txtvaluedialog"];
     else
         cd.Value = "";
     if (Request.Form["txtdescrptiondialog"] != null && Request.Form["txtdescrptiondialog"] != "")
         cd.Descrption = Request.Form["txtdescrptiondialog"];
     else
         cd.Descrption = "";
     res = commondatadao.InsertCommonData(cd);
     if (res == true)
     {
         mes = "Common data saved successfuy.";
     }
     return mes;
 }