Esempio n. 1
0
        public string UpdateCountry(int id, string name)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eCountries obj = new eCountries();
                obj          = BL_Country.GetSingleRecordById(id);
                obj.sCountry = name;
                int i = BL_Country.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = "Updated successfully." };
                }
                else
                {
                    result = new { st = 0, msg = "Kindly try after some time." };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = "Kindly try after some time." };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Esempio n. 2
0
        public string AddCountry(string name, string countryname)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eCountries eObj = new eCountries();
                eObj.sCountry     = name;
                eObj.dtActionDate = DateTime.Now;
                eObj.cStatus      = "A";
                eObj.iActionBy    = 1;
                int i = BL_Country.AddRecord(eObj);
                if (i == 1)
                {
                    result = new { st = 1, msg = "Added successfully." };
                }
                else
                {
                    result = new { st = 0, msg = "Kindly try after some time." };
                }
            }
            catch (Exception ex)
            {
                result = new { st = 0, msg = "Kindly try after some time." };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Esempio n. 3
0
        //Get Single Record
        public static eCountries GetSingleRecordById(int id)
        {
            eCountries eobj = new eCountries();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = db.tblCountryMs.SingleOrDefault(u => u.iCountryId == id);
                if (dbobj != null)
                {
                    eobj = (eCountries)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj);
                }
            }
            return(eobj);
        }
Esempio n. 4
0
        //Add new record
        public static int AddRecord(eCountries eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblCountryM dbuser = (OneFineRate.tblCountryM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCountryM());
                    db.tblCountryMs.Add(dbuser);
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Esempio n. 5
0
        //Update a record
        public static int UpdateRecord(eCountries eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblCountryM obj = (OneFineRate.tblCountryM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCountryM());
                    db.tblCountryMs.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }