コード例 #1
0
        public Object GetPromoCodeMain([FromBody] PromoCodeInput pci)
        {
            PromoCodeDetailsoutput daOP = new PromoCodeDetailsoutput();
            DataSet SelectedSlots       = new DataSet();
            string  sJSONResponse       = "";

            DataTable dt_Promocode = new DataTable();

            List <PromoDetails> proDetails = new List <PromoDetails>();

            try
            {
                dt_Promocode = getdata(string.Format("select ID,PromoCode from PromoCode"));

                for (int i = 0; i < dt_Promocode.Rows.Count; i++)
                {
                    PromoDetails PromocodeDetails = new PromoDetails {
                        ID = Convert.ToInt32(dt_Promocode.Rows[i]["ID"].ToString()), PromoCode = dt_Promocode.Rows[i]["PromoCode"].ToString()
                    };
                    proDetails.Add(PromocodeDetails);
                }

                daOP.status   = "success";
                daOP.value    = proDetails;
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }
            catch (Exception ec)
            {
                daOP.status   = "fail";
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }


            return(sJSONResponse);
        }
コード例 #2
0
        public Object GetPromoCode([FromBody] PromoCodeInput pci)
        {
            PromoCodeOutput daOP          = new PromoCodeOutput();
            DataSet         SelectedSlots = new DataSet();
            string          sJSONResponse = "";

            DataTable dt_Promocode = new DataTable();

            List <PromoCodeDetails> proDetails = new List <PromoCodeDetails>();

            try
            {
                dt_Promocode = getdata(string.Format("select PID as ID,PromoCode,PromoCodeName,PromoCodeDescription,FacilityApplicable,AddDays,DiscountAmount,DiscountPercentage,TermsAndConditions,PromoCodeStartDate,PromoCodeEndDate,PromoCodeType,PromoCodeTypeName,PID,IsActive,DurationID from PromoCodeMaster where BranchCode='{0}' and Register='{1}'  and IsDeleted=0 and IsActive=1 and PromoCodeType=1 ", pci.BranchCode, pci.Register));

                for (int i = 0; i < dt_Promocode.Rows.Count; i++)
                {
                    PromoCodeDetails PromocodeDetails = new PromoCodeDetails {
                        ID = Convert.ToInt32(dt_Promocode.Rows[i]["ID"].ToString()), PromoCode = dt_Promocode.Rows[i]["PromoCode"].ToString(), PromoCodeName = dt_Promocode.Rows[i]["PromoCodeName"].ToString(), PromoCodeDescription = dt_Promocode.Rows[i]["PromoCodeDescription"].ToString(), FacilityApplicable = dt_Promocode.Rows[i]["FacilityApplicable"].ToString(), AddDays = Convert.ToInt32(dt_Promocode.Rows[i]["AddDays"].ToString()), DiscountAmount = float.Parse(dt_Promocode.Rows[i]["DiscountAmount"].ToString()), IsActive = Convert.ToBoolean(dt_Promocode.Rows[i]["IsActive"].ToString()), DiscountPercentage = Convert.ToInt32(dt_Promocode.Rows[i]["DiscountPercentage"].ToString()), TermsAndConditions = Convert.ToString(dt_Promocode.Rows[i]["TermsAndConditions"].ToString()), PromoCodeStartDate = Convert.ToString(dt_Promocode.Rows[i]["PromoCodeStartDate"].ToString()), PromoCodeEndDate = Convert.ToString(dt_Promocode.Rows[i]["PromoCodeEndDate"].ToString()), PromoCodeType = Convert.ToInt32(dt_Promocode.Rows[i]["PromoCodeType"].ToString()), PromoCodeTypeName = Convert.ToString(dt_Promocode.Rows[i]["PromoCodeTypeName"].ToString()), DurationID = Convert.ToString(dt_Promocode.Rows[i]["DurationID"].ToString())
                    };
                    proDetails.Add(PromocodeDetails);
                }

                daOP.status   = "success";
                daOP.value    = proDetails;
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }
            catch (Exception ec)
            {
                daOP.status   = "fail";
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }


            return(sJSONResponse);
        }
コード例 #3
0
        public Object ValidatePromocode([FromBody] PromoCodeInput pci)
        {
            Class.SearchEngin       se   = new Class.SearchEngin();
            ValidatePromoCodeOutPut daOP = new ValidatePromoCodeOutPut();
            DataSet   SelectedSlots      = new DataSet();
            string    sJSONResponse      = "";
            DataTable dt_Promocode       = new DataTable();
            string    Query = "";

            Dictionary <string, string> PromocodeRequirement = new Dictionary <string, string>();

            try
            {
                PromocodeRequirement.Add("BranchCode", pci.BranchCode);
                PromocodeRequirement.Add("PromoCode", pci.PromoCode);
                PromocodeRequirement.Add("DurationId", pci.DurationId);
                PromocodeRequirement.Add("PackageCode", pci.PackageCode);
                PromocodeRequirement.Add("SlotCode", pci.SlotCode);
                PromocodeRequirement.Add("MobileNo", pci.MobileNo);
                Query = se.PromocodeQueryBuilder(PromocodeRequirement);
            }
            catch (Exception ec)
            {
            }

            List <ValidatePromoCodeDetails> ValidateproDetails = new List <ValidatePromoCodeDetails>();

            try
            {
                dt_Promocode = getdata(Query);

                for (int i = 0; i < dt_Promocode.Rows.Count; i++)
                {
                    ValidatePromoCodeDetails PromocodeDetails = new ValidatePromoCodeDetails {
                        ID = Convert.ToInt32(dt_Promocode.Rows[i]["PID"].ToString()), PromoCode = dt_Promocode.Rows[i]["PromoCode"].ToString(), PromoCodeName = dt_Promocode.Rows[i]["PromoCodeName"].ToString(), PromoCodeDescription = dt_Promocode.Rows[i]["PromoCodeDescription"].ToString(), FacilityApplicable = dt_Promocode.Rows[i]["FacilityApplicable"].ToString(), AddDays = Convert.ToInt32(dt_Promocode.Rows[i]["AddDays"].ToString()), DiscountAmount = float.Parse(dt_Promocode.Rows[i]["DiscountAmount"].ToString()), DiscountPercentage = dt_Promocode.Rows[i]["DiscountPercentage"].ToString(), TermsAndConditions = Convert.ToString(dt_Promocode.Rows[i]["TermsAndConditions"].ToString()), PromoCodeStartDate = Convert.ToString(dt_Promocode.Rows[i]["PromoCodeStartDate"].ToString()), PromoCodeEndDate = Convert.ToString(dt_Promocode.Rows[i]["PromoCodeEndDate"].ToString())
                    };
                    ValidateproDetails.Add(PromocodeDetails);
                }

                daOP.status   = "success";
                daOP.value    = ValidateproDetails;
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }
            catch (Exception ec)
            {
                daOP.status   = "fail";
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }


            return(sJSONResponse);
        }