Exemple #1
0
        public string UpdateRatePlan(int id, string name)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eRatePlan obj = new eRatePlan();
                obj = BL_RatePlan.GetSingleRecordById(id);
                obj.dtActionDate = DateTime.Now;
                obj.sRatePlan    = name;
                obj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_RatePlan.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("RatePlan", 2) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("RatePlan", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("RatePlan", 0) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Exemple #2
0
        public string AddRatePlan(string name)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eRatePlan eObj = new eRatePlan();
                eObj.sRatePlan    = name;
                eObj.dtActionDate = DateTime.Now;
                eObj.cStatus      = "A";
                eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_RatePlan.AddRecord(eObj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("RatePlan", 1) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("RatePlan", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("RatePlan", 3) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Exemple #3
0
        //Add new record
        public static int AddRecord(eRatePlan eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    int dbobj = (from s in db.tblRatePlanMs.Where(u => u.sRatePlan == eobj.sRatePlan.Trim())
                                 select new
                    {
                        s.iRatePlanId,
                    }).Count();
                    if (dbobj > 0)
                    {
                        return(retval = 2);
                    }

                    OneFineRate.tblRatePlanM dbuser = (OneFineRate.tblRatePlanM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblRatePlanM());
                    db.tblRatePlanMs.Add(dbuser);
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Exemple #4
0
        //Update a record
        public static int UpdateRecord(eRatePlan eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    int dbobj = (from s in db.tblRatePlanMs.Where(u => u.sRatePlan == eobj.sRatePlan.Trim() && u.iRatePlanId != eobj.iRatePlanId)
                                 select new
                    {
                        s.iRatePlanId,
                    }).Count();
                    if (dbobj > 0)
                    {
                        return(retval = 2);
                    }

                    OneFineRate.tblRatePlanM obj = (OneFineRate.tblRatePlanM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblRatePlanM());
                    db.tblRatePlanMs.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Exemple #5
0
        //Get Single Record
        public static eRatePlan GetSingleRecordById(int id)
        {
            eRatePlan eobj = new eRatePlan();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = db.tblRatePlanMs.SingleOrDefault(u => u.iRatePlanId == id);
                if (dbobj != null)
                {
                    eobj = (eRatePlan)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj);
                }
            }
            return(eobj);
        }