//Get Single Record
        public static eLoyalityPoints GetSingleRecordById()
        {
            eLoyalityPoints eobj = new eLoyalityPoints();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = db.tblLoyalityPointsMs.SingleOrDefault();
                if (dbobj != null)
                {
                    eobj = (eLoyalityPoints)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj);
                }
            }
            return(eobj);
        }
        //Update a record
        public static int UpdateLoyalityPoints(eLoyalityPoints eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblLoyalityPointsM obj = (OneFineRate.tblLoyalityPointsM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblLoyalityPointsM());
                    db.tblLoyalityPointsMs.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Example #3
0
        public string UpdateLoyalityPoints(int iLoyalityId, int EarnRupees, int EarnPoints, int RedeemPoints, int RedeemRupees, int iReferredPoints, int iReferPointsSignUp, int iSignUpPointsWithoutRef, int iExpiryDays)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eLoyalityPoints obj = new eLoyalityPoints();
                obj = BL_LoyalityAmenityMap.GetSingleRecordById();
                obj.dtActionDate            = DateTime.Now;
                obj.iEarnMoney              = EarnRupees;
                obj.iEarnPoints             = EarnPoints;
                obj.iRedeemMoney            = RedeemRupees;
                obj.iRedeemPoints           = RedeemPoints;
                obj.iReferredPoints         = iReferredPoints;
                obj.iReferPointsSignUp      = iReferPointsSignUp;
                obj.iSignUpPointsWithoutRef = iSignUpPointsWithoutRef;
                obj.iExpiryDays             = iExpiryDays;

                obj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_LoyalityAmenityMap.UpdateLoyalityPoints(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Loyality Points", 2) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Loyality Points", 0) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }