Esempio n. 1
0
        public string UpdateMacroArea(int id, int countryid, int stateid, int cityid, string macroareaname)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eMacroAreaM obj = new eMacroAreaM();
                obj            = BL_tblMacroAreaM.GetSingleRecordById(id);
                obj.iCountryId = countryid;
                obj.iStateId   = stateid;
                obj.iCityId    = cityid;
                obj.sArea      = macroareaname;
                int i = BL_tblMacroAreaM.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("MacroArea", 2) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 3) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Esempio n. 2
0
        public string DeleteMacroArea(int id, string status)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eMacroAreaM obj = new eMacroAreaM();
                obj           = BL_tblMacroAreaM.GetSingleRecordById(id);
                obj.cStatus   = status;
                obj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_tblMacroAreaM.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("MacroArea", 4, status) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 0) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Esempio n. 3
0
        //Add new record
        public static int AddRecord(eMacroAreaM eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    int dbobj = (from s in db.tblMacroAreaMs.Where(u => u.iCountryId == eobj.iCountryId && u.iStateId == eobj.iStateId && u.iCityId == eobj.iCityId && u.sArea == eobj.sArea.Trim())
                                 select new
                    {
                        s.iAreaId,
                    }).Count();
                    if (dbobj > 0)
                    {
                        return(retval = 2);
                    }


                    OneFineRate.tblMacroAreaM dbstate = (OneFineRate.tblMacroAreaM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblMacroAreaM());
                    db.tblMacroAreaMs.Add(dbstate);
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
        // GET: MacroAreaAjax
        public ActionResult Index()
        {
            eMacroAreaM obj = new eMacroAreaM();

            obj.StateList = BL_tblMacroAreaM.StateList(obj.iStateId, obj.iCountryId);
            obj.CityList  = BL_tblMacroAreaM.CityList(obj.iCityId, obj.iStateId, obj.iCountryId);
            return(View(obj));
        }
        public ActionResult Edit(int id)
        {
            eMacroAreaM obj = new eMacroAreaM();

            obj                   = BL_tblMacroAreaM.GetSingleRecordById(id);
            obj.StateList         = BL_tblMacroAreaM.StateList(obj.iStateId, obj.iCountryId);
            obj.CityList          = BL_tblMacroAreaM.CityList(obj.iCityId, obj.iStateId, obj.iCountryId);
            ViewBag.OpenEditModel = "Y";
            return(PartialView("Index", obj));
        }
Esempio n. 6
0
        //Get Single Record
        public static eMacroAreaM GetSingleRecordById(int id)
        {
            eMacroAreaM eobj = new eMacroAreaM();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = db.tblMacroAreaMs.SingleOrDefault(u => u.iAreaId == id);
                if (dbobj != null)
                {
                    eobj = (eMacroAreaM)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj);
                }
            }
            return(eobj);
        }
        public ActionResult AddMacroArea(eMacroAreaM eObj)
        {
            string strReturn = string.Empty;

            try
            {
                if (eObj.iAreaId == 0)
                {
                    eObj.dtActionDate = DateTime.Now;
                    eObj.cStatus      = "A";
                    eObj.iActionBy    = 1;
                    int i = BL_tblMacroAreaM.AddRecord(eObj);
                    if (i == 1)
                    {
                        strReturn = "Added successfully.";
                    }
                    else
                    {
                        strReturn = "Kindly try after some time.";
                    }
                }
                else
                {
                    eObj.dtActionDate = DateTime.Now;
                    int i = BL_tblMacroAreaM.UpdateRecord(eObj);
                    if (i == 1)
                    {
                        strReturn = "Updated successfully.";
                    }
                    else
                    {
                        strReturn = "Kindly try after some time.";
                    }
                }
            }
            catch (Exception)
            {
                strReturn = "Kindly try after some time.";
            }
            TempData["result"] = strReturn;
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
        public string AddMacroArea(int countryid, int stateid, int cityid, string macroareaname)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eMacroAreaM eObj = new eMacroAreaM();
                eObj.iCountryId   = countryid;
                eObj.iStateId     = stateid;
                eObj.iCityId      = cityid;
                eObj.sArea        = macroareaname;
                eObj.dtActionDate = DateTime.Now;
                eObj.cStatus      = "A";
                eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_tblMacroAreaM.AddRecord(eObj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("MacroArea", 1) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("MacroArea", 3) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }