Пример #1
0
        public object RewardManagementInsertUpdate(JsonMember.RewardManagement obj)
        {
            RewardManagement obj1 = new RewardManagement();
            List <JsonMember.RewardManagementDetails> lstDetails = new List <JsonMember.RewardManagementDetails>();

            try
            {
                Sqldbmanager.Open();
                Sqldbmanager.CreateParameters(4);
                Sqldbmanager.AddParameters(0, "@UserId", obj.UserId);
                Sqldbmanager.AddParameters(1, "@RewardAmount", obj.RewardAmount);
                Sqldbmanager.AddParameters(2, "@ValidDay", obj.ValidDay);
                Sqldbmanager.AddParameters(3, "@RewardId", obj.RewardId);
                idr = Sqldbmanager.ExecuteReader(CommandType.StoredProcedure, "USP_RewardManagement");

                while (idr.Read())
                {
                    lstDetails.Add(new JsonMember.RewardManagementDetails()
                    {
                        RewardCode   = Convert.ToString(idr["RewardCode"]),
                        ValidFrom    = Convert.ToString(idr["ValidFrom"]),
                        ValidTill    = Convert.ToString(idr["ValidTill"]),
                        RewardAmount = Convert.ToDecimal(idr["RewardAmount"]),
                    });
                }
                if (idr.NextResult())
                {
                    while (idr.Read())
                    {
                        obj1 = new RewardManagement()
                        {
                            flag    = "true",
                            Message = "success",
                            lstRewardManagementDetails = lstDetails
                        };
                    }
                }
            }
            catch (Exception Ex)
            {
                DS   = LogError("Reward Management Insert Update", Ex.Message.ToString(), "SP Name: USP_RewardManagement");
                obj1 = new RewardManagement()
                {
                    flag    = "false",
                    Message = DS.Tables[0].Rows[0]["Meaasge"].ToString(),
                };
            }
            finally
            {
                Sqldbmanager.Close();
            }

            return(obj1);
        }
Пример #2
0
        public object ValidateRewardCode(JsonMember.RewardManagement obj)
        {
            RewardManagement obj1 = new RewardManagement();

            try
            {
                Sqldbmanager.Open();
                Sqldbmanager.CreateParameters(2);
                Sqldbmanager.AddParameters(0, "@UserId", obj.UserId);
                Sqldbmanager.AddParameters(1, "@PromoCode", obj.RewardCode);
                idr = Sqldbmanager.ExecuteReader(CommandType.StoredProcedure, "USP_ValidatePromoCode");
                while (idr.Read())
                {
                    obj1 = new RewardManagement()
                    {
                        flag         = (Convert.ToBoolean(idr["flag"])).ToString(),
                        Message      = Convert.ToString(idr["Message"]),
                        RewardId     = Convert.ToInt64(idr["RewardId"]),
                        RewardAmount = Convert.ToDecimal(idr["RewardAmount"]),
                    };
                }
            }
            catch (Exception Ex)
            {
                DS   = LogError("Validate Promo Code", Ex.Message.ToString(), "SP Name: USP_ValidatePromoCode");
                obj1 = new RewardManagement()
                {
                    flag    = "false",
                    Message = DS.Tables[0].Rows[0]["Meaasge"].ToString(),
                };
            }
            finally
            {
                Sqldbmanager.Close();
            }

            return(obj1);
        }