Ejemplo n.º 1
0
        //Get Single Record
        public static eLoyalityPointsCustomerData GetRecordById(int iId)
        {
            eLoyalityPointsCustomerData eobj = new eLoyalityPointsCustomerData();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = (from t in db.tblCustomerPointsMaps
                             select new eLoyalityPointsCustomerData
                {
                    iId = t.iId,
                    iCustomerId = t.iCustomerId,
                    iTotalPoints = t.iTotalPoints,
                    iUsedPoints = t.iUsedPoints,
                    iRemPoints = t.iRemPoints,
                    dtCreatedOn = t.dtCreatedOn,
                    dtExpiryOriginal = t.dtExpiryOriginal,
                    dtExpiry = t.dtExpiry,
                    cType = t.cType,
                    cStatus = t.cStatus,
                }).Where(u => u.iId == iId).ToList();

                if (dbobj != null)
                {
                    eobj = (eLoyalityPointsCustomerData)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj[0], eobj);
                }
            }
            return(eobj);
        }
Ejemplo n.º 2
0
        //Update a record
        public static int UpdateLoyalityPointsExpiryDate(eLoyalityPointsCustomerData eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblCustomerPointsMap obj = (OneFineRate.tblCustomerPointsMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblCustomerPointsMap());
                    db.tblCustomerPointsMaps.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
Ejemplo n.º 3
0
        public string UpdateLoyalityPointsExpiry(string ExpiryDate, Array gridData)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eLoyalityPointsCustomerData        objData     = new eLoyalityPointsCustomerData();
                List <eLoyalityPointsCustomerData> objDataList = new List <eLoyalityPointsCustomerData>();

                foreach (var item in gridData)
                {
                    objData          = BL_LoyalityAmenityMap.GetRecordById(Convert.ToInt32(item));
                    objData.dtExpiry = Convert.ToDateTime(clsUtils.ConvertddmmyyyytoDateTime(ExpiryDate));
                    objDataList.Add(objData);
                }
                int counter = 0;
                for (int c = 0; c < objDataList.Count; c++)
                {
                    BL_LoyalityAmenityMap.UpdateLoyalityPointsExpiryDate(objDataList[c]);
                    counter++;
                }
                if (objDataList.Count == counter)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Expiry Date for the selected records", 2) };
                }
                else
                {
                    var diff = objDataList.Count - counter;
                    result = new { st = 0, msg = "Not able to update" + diff + "records out off" + objDataList.Count };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = "Kindly try after some time." };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }