Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int GiftCardID = Convert.ToInt32(Request["GiftCardID"]);

            int UserId = Convert.ToInt32(Request["UserId"]);

            decimal GiftCardCost = Convert.ToDecimal(Request["GiftCardCost"]);

            string      GiftCardName        = Request["GiftCardName"];
            string      GiveItToEmail       = Request["GiveItToEmail"];
            string      GiftCardDescription = Request["GiftCardDescription"];
            string      GiftCardNotes       = Request["GiftCardNotes"];
            GiftCardTBx gift = new GiftCardTBx();
            gift = GM.GetGiftCardByGiftCardID(GiftCardID);
            gift.GiftCardCost        = GiftCardCost;
            gift.GiftCardName        = GiftCardName;
            gift.GiveItToEmail       = GiveItToEmail;
            gift.GiftCardDescription = GiftCardDescription;
            gift.GiftCardNote        = GiftCardNotes;
            GM.Save();
            ok = "1";
            return;
        }
        catch (Exception ex)
        {
            ok = ex.ToString();
            return;
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GiftCardManager um   = new GiftCardManager();
        GiftCardTBx     user = um.GetGiftCardByGiftCardID(Convert.ToInt32(Request["id"]));

        ok = JsonConvert.SerializeObject(user, Formatting.Indented,
                                         new JsonSerializerSettings
        {
            PreserveReferencesHandling = PreserveReferencesHandling.Objects
        });
        return;
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.AppendHeader("Access-Control-Allow-Origin", "*");
        string  giftcode = Request["giftcardcode"];
        decimal giftcost = Convert.ToDecimal(Request["giftcardcost"]);

        gift = GCM.GetGiftCardByGiftCardCode(giftcode);
        decimal cost      = Convert.ToDecimal(gift.GiftCardCost);
        decimal finalcost = cost - giftcost;

        gift.GiftCardCost = finalcost;
        gift.GiftCardName = "Gift Card $" + finalcost;
        if (gift.GiftCardCost == 0)
        {
            gift.GiftCardStatus = -1;
        }
        GCM.Save();
    }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int             id   = Convert.ToInt32(Request["id"]);
         GiftCardManager pm   = new GiftCardManager();
         GiftCardTBx     page = pm.GetGiftCardByGiftCardID(id);
         page.GiftCardStatus = Convert.ToInt32(Request["status"]);
         pm.Save();
         ok = Request["status"];
         return;
     }
     catch (Exception ex)
     {
         ok = ex.ToString();
         return;
     }
 }
Пример #5
0
 public void AddGiftCard(GiftCardTBx giftcard)
 {
     db.GiftCardTBxes.InsertOnSubmit(giftcard);
     Save();
 }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int modalid = Convert.ToInt32(Request["modalid"]);

            int GiftCardID = Convert.ToInt32(Request["GiftCardID"]);

            int userID = Convert.ToInt32(Request["userID"]);

            decimal GiftCardCost = Convert.ToDecimal(Request["giftcardcost"]);

            string GiftCardName        = Request["giftcardname"];
            string GiveItToEmail       = Request["giveittoemail"];
            string GiftCardDescription = Request["giftcarddesc"];
            string GiftCardNotes       = Request["giftcardnotes"];
            int    vouchernum          = 9;
            string Password            = RandomPassword(6);

            string GiftCardCode = CreateRandomVoucher(vouchernum);

            //kiem tra email da ton tai hay chuwa
            UserManager UM            = new UserManager();
            UsersTbx    usersend      = UM.GetUserByID(userID);
            string      usernamesend  = usersend.FirstName + " " + usersend.LastName;
            string      useremailsend = usersend.Email;


            UsersTbx user = UM.GetUserByUserEmail(GiveItToEmail);
            string   desc = "";
            if (user != null)
            {
                if (user.Email != null)
                {
                    desc  = "You have recived gift card of NoaNailsSpa from: " + "<br/>" + "User: "******"<br/>" + "Email: " + useremailsend + "<br/>" + "Note: " + GiftCardNotes;
                    desc += "<br/><br/>";
                    desc += "Please download our app for free to use" + "<a href='#'>" + " here " + "</a>" + "and login to use gift card.";
                    desc += "<br/><br/>";
                }
            }
            else
            {
                UsersTbx u = new UsersTbx();
                u.FirstName   = GiveItToEmail;
                u.Password    = UTIL.Encrypt(Password, true);
                u.Email       = GiveItToEmail;
                u.Status      = 1;
                u.UserLevel   = 0;
                u.TotalReward = 0;
                UM.AddUser(u);
                UM.Save();
                desc  = "You have recived gift card of NoaNailsSpa from: " + "<br/>" + "User: "******"<br/>" + "Email: " + useremailsend + "<br/>" + "Note: " + GiftCardNotes;
                desc += "<br/><br/>";
                desc += "Please download our app for free to use" + "<a href='#'>" + " here " + "</a>" + "and login with the acount below to use gift card.";
                desc += "<br/><br/>";
                desc += "Email: " + GiveItToEmail + "<br/>" + "Password: "******"*****@*****.**", GiveItToEmail, "Gift Card NailsSpa Salon", desc, "NoaNailsSpa", "*****@*****.**", "Kid3101@", "relay-hosting.secureserver.net");



            GiftCardManager r = new GiftCardManager();

            GiftCardTBx reward = new GiftCardTBx();



            if (GiftCardID != 0)//------- EDIT -----------------------------------------||
            {
                reward = r.GetGiftCardByGiftCardID(GiftCardID);
            }
            reward.GiftCardName  = GiftCardName;
            reward.GiftCardCost  = GiftCardCost;
            reward.GiveItToEmail = GiveItToEmail;


            if (GiftCardID == 0) //-------- ADD -----------------------------------||
            {
                DateTime     current = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Unspecified);
                TimeZoneInfo src     = TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id);
                TimeZoneInfo des     = TimeZoneInfo.FindSystemTimeZoneById("SA Western Standard Time");
                reward.GiftCardAddedDate   = TimeZoneInfo.ConvertTime(current, src, des);
                reward.GiftCardStatus      = 1;
                reward.GiftCardCode        = GiftCardCode;
                reward.CreateByUserId      = userID;
                reward.GiftCardName        = GiftCardName;
                reward.GiftCardCost        = GiftCardCost;
                reward.GiveItToEmail       = GiveItToEmail;
                reward.GiftCardDescription = GiftCardDescription;
                reward.GiftCardNote        = GiftCardNotes;

                r.AddGiftCard(reward);
            }
            r.Save();

            ok = "1";
            return;
        }
        catch (Exception ex)
        {
            ok = ex.ToString();
            return;
        }
    }