Beispiel #1
0
 public ActionResult Edit(StayBazar.Areas.Admin.Models.CountryModel data)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CLayer.Country pt = new CLayer.Country()
             {
                 CountryId   = data.CountryId,
                 Name        = data.Name,
                 IsDefault   = data.IsDefault,
                 ForProperty = data.ForProperty,
                 Status      = data.Status,
                 Code        = data.Code
             };
             BLayer.Country.Save(pt);
             ViewBag.Saved = true;
         }
         else
         {
             ViewBag.Saved = false;
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
         return(Redirect("~/Admin/ErrorPage"));
     }
 }
Beispiel #2
0
        public ActionResult Edit(int id)
        {
            try
            {
                ViewBag.Saved = false;
                StayBazar.Areas.Admin.Models.CountryModel mbt = new CountryModel()
                {
                    CountryId = 0
                };

                CLayer.Country pt = BLayer.Country.Get(id);

                if (pt != null)
                {
                    mbt = new CountryModel()
                    {
                        CountryId   = pt.CountryId,
                        Name        = pt.Name,
                        IsDefault   = pt.IsDefault,
                        ForProperty = pt.ForProperty,
                        Status      = pt.Status,
                        Code        = pt.Code
                    }
                }
                ;

                return(PartialView("_Edit", mbt));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(Redirect("~/Admin/ErrorPage"));
            }
        }
Beispiel #3
0
        public string  UpdateGDSCountry(string CountryName)
        {
            string pKeyword           = CountryName;
            string CountryFromKeyWord = GetCountryWithKeyWords(CountryName);

            CountryName = string.IsNullOrEmpty(CountryFromKeyWord) ? CountryName : CountryFromKeyWord;

            string sql = "SELECT COUNT(*) FROM country WHERE NAME='" + CountryName + "'";
            object obj = Connection.ExecuteSQLQueryScalar(sql);

            if (Connection.ToInteger(obj) < 1)
            {
                CLayer.Country country = new CLayer.Country();
                country.Name        = CountryName;
                country.ForProperty = true;
                country.Status      = 1;
                //   country.KeyWords = CountryName;
                Save(country);
            }
            else
            {
                string         sqlc    = "SELECT CountryID FROM country WHERE NAME='" + CountryName + "'";
                object         objc    = Connection.ExecuteSQLQueryScalar(sqlc);
                CLayer.Country country = new CLayer.Country();
                country.CountryId   = Connection.ToLong(objc);
                country.Name        = CountryName;
                country.ForProperty = true;
                country.Status      = 1;
                //   country.KeyWords = pKeyword;
                Save(country);
            }
            return(CountryName);
        }
Beispiel #4
0
        public int GDSSave(CLayer.Country country)
        {
            string pKeyWords = country.KeyWords;
            string sql       = "select keywords from country where countryid=" + country.CountryId + "";
            string result    = Convert.ToString(Connection.ExecuteSQLQueryScalar(sql));

            if (!string.IsNullOrEmpty(result))
            {
                string[] resultList = result.Split(',');
                for (int i = 0; i < resultList.Length; i++)
                {
                    if (resultList[i] != pKeyWords)
                    {
                        country.KeyWords = result + "," + pKeyWords;
                    }
                }
            }

            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pCountryId", DataPlug.DataType._BigInt, country.CountryId));
            param.Add(Connection.GetParameter("pName", DataPlug.DataType._Varchar, country.Name));
            param.Add(Connection.GetParameter("pCode", DataPlug.DataType._Varchar, country.Code));
            param.Add(Connection.GetParameter("pIsDefault", DataPlug.DataType._Bool, country.IsDefault));
            param.Add(Connection.GetParameter("pStatus", DataPlug.DataType._Int, country.Status));
            param.Add(Connection.GetParameter("pForProperty", DataPlug.DataType._Bool, country.ForProperty));
            param.Add(Connection.GetParameter("pKeyWords", DataPlug.DataType._Varchar, country.KeyWords));
            object objresult = Connection.ExecuteQueryScalar("GDScountry_Save", param);

            return(Connection.ToInteger(objresult));
        }
Beispiel #5
0
        public int GDSKeywordSave(CLayer.Country country)
        {
            string pKeyWords = country.KeyWords;
            string sql       = "select keywords from country where countryid=" + country.CountryId + "";
            string result    = Convert.ToString(Connection.ExecuteSQLQueryScalar(sql));

            if (!string.IsNullOrEmpty(result))
            {
                string[] resultList = result.Split(',');
                for (int i = 0; i < resultList.Length; i++)
                {
                    if (resultList[i] != pKeyWords)
                    {
                        if (!result.Contains(pKeyWords))
                        {
                            country.KeyWords = result + "," + pKeyWords;
                        }
                        else
                        {
                            country.KeyWords = result;
                        }
                    }
                }
            }
            sql = "Update country set keywords='" + country.KeyWords + "' where countryid=" + country.CountryId + "";
            object obj = Connection.ExecuteSQLQueryScalar(sql);

            return(Connection.ToInteger(obj));
        }
Beispiel #6
0
        public int Save(CLayer.Country country)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pCountryId", DataPlug.DataType._BigInt, country.CountryId));
            param.Add(Connection.GetParameter("pName", DataPlug.DataType._Varchar, country.Name));
            param.Add(Connection.GetParameter("pCode", DataPlug.DataType._Varchar, country.Code));
            param.Add(Connection.GetParameter("pIsDefault", DataPlug.DataType._Bool, country.IsDefault));
            param.Add(Connection.GetParameter("pStatus", DataPlug.DataType._Int, country.Status));
            param.Add(Connection.GetParameter("pForProperty", DataPlug.DataType._Bool, country.ForProperty));
            object result = Connection.ExecuteQueryScalar("country_Save", param);

            return(Connection.ToInteger(result));
        }
Beispiel #7
0
        //
        // TODO Delete Country
        //
        public CLayer.Country Get(int CountryId)
        {
            CLayer.Country            country = null;
            List <DataPlug.Parameter> param   = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pCountryId", DataPlug.DataType._BigInt, CountryId));
            DataTable dt = Connection.GetTable("country_Get", param);

            if (dt.Rows.Count > 0)
            {
                country             = new CLayer.Country();
                country.CountryId   = Connection.ToLong(dt.Rows[0]["CountryId"]);
                country.Name        = Connection.ToString(dt.Rows[0]["Name"]);
                country.IsDefault   = Connection.ToBoolean(dt.Rows[0]["IsDefault"]);
                country.Status      = Connection.ToInteger(dt.Rows[0]["Status"]);
                country.ForProperty = Connection.ToBoolean(dt.Rows[0]["ForProperty"]);
                country.Code        = Connection.ToString(dt.Rows[0]["Code"]);
            }
            return(country);
        }
Beispiel #8
0
 public static int GDSKeywordSave(CLayer.Country pcountry)
 {
     DataLayer.Country country = new DataLayer.Country();
     return(country.GDSKeywordSave(pcountry));
 }
Beispiel #9
0
 public static int Save(CLayer.Country countrydata)
 {
     DataLayer.Country country = new DataLayer.Country();
     countrydata.Validate();
     return(country.Save(countrydata));
 }