예제 #1
0
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        GoDine a = new GoDine();
        Roles.AddUserToRole(CreateUserWizard1.UserName, "Advertiser");
        // Get the UserId of the just-added user
        MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName);
        Guid newUserId = (Guid)newUser.ProviderUserKey;
        Guid newSalesId = a.Generate_Sales_ID(newUserId);

        // Determine the full verification URL (i.e., http://yoursite.com/Verification.aspx?ID=...)
        string urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
        string verifyUrl = "Verify.aspx?ID=" + newUserId.ToString();
        string fullUrl = urlBase + verifyUrl;

        //Determine the full sales URL (i.e., http://user.aroundtowngifts.com/BuyGiftCard.aspx?Sale=...)
        string buyGCUrl = "BuyGiftCard.aspx?Sale=" + newSalesId.ToString();
        string saleUrl = urlBase + buyGCUrl;

        //// SENDING EMAIL
        string subject = "Welcome to AroundTown";
        string body = GoDineEmails.PrepareMailBodyWith("newsalesuser.htm", "%name%", CreateUserWizard1.UserName, "%verificationUrl%", fullUrl, "%salesUrl%", saleUrl);
        GoDineEmails.SendMail(CreateUserWizard1.UserName, subject, body);

        // FOUND HERE: http://forums.asp.net/t/1196734.aspx
        TextBox userNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName");

        MembershipUser user = Membership.GetUser(userNameTextBox.Text);
        Membership.UpdateUser(user);
        Response.Redirect("~/Verify.aspx");
    }
 protected void AttemptTransaction(string cuser, long barcode, decimal amount, string concept, int PINtry)
 {
     TransactionStatus ts;
     GoDine a = new GoDine();
     ts = a.Transaction_from_GcBC_2_CUser_PIN(barcode, cuser, amount, concept, 0, PINtry);
     string status = "";
     if (!ts.cuserexist) {
         status = status + "\nCompany user does not exist";
     }
     if (!ts.giftcardexist){
         status = status + "\nGift card is not valid";
     }
     if (status == "")  {
         if (!ts.enoughmoney)
         {
             Response.Write("START\nWARNING\nNot enough money,  $" + ts.moneyleft.ToString("0.00") + "   left.\nSTOP");
         }
         else if (ts.status == 1000)
         {
             Response.Write("START\nSUCCESS\nTRANSACTION SUCCESS\nThere is    $" + ts.moneyleft.ToString("0.00") + "    left in the gift card.\nSTOP");
         }
         else if (ts.PINprotected)
         {
             Response.Write("START\nPROTECTED\nGift card is password protected, insert PIN\nSTOP");
         }
         else
         {
             Response.Write("START\n0\nUnknown problem. Please contact GoDine.\nSTOP");
         }
     }
     else {
         Response.Write("START\nWARNING" + status + "\nSTOP");
     }
 }
예제 #3
0
    protected void btnpayment_Click(object sender, EventArgs e)
    {
        GoDine a = new GoDine();
        MembershipUser user = Membership.GetUser();
        bool paramOK = true;
        decimal net = 0;
        decimal ratio = (decimal) 0.97;
        int code;

        try
        {
            net = Convert.ToDecimal(tbpaymentCAD.Text);
        }
        catch
        {
            lblinfo.Text = "ERROR -> Amount to pay is not valid";
            paramOK = false;
            return;
        }
        try
        {
            if (tbPIN.Text == "") { code = -1; }
            else { code = Convert.ToInt32(tbPIN.Text); }
        }
        catch
        {
            lblinfo.Text = "ERROR -> PIN is not valid";
            paramOK = false;
            return;
        }

        if (paramOK){
            tbpaymentCAD.Text = "";
            tbPIN.Text = "";

            long barcode = a.GiftCard_Create_with_code(code, 0); // IT IS FORCED
            a.GiftCard_AddInfo_EmailType(barcode, user.UserName);
            //user.UserName

            string concept = "User payment by credit card/paypal";
            a.Insert_Money_2_GiftCard(net, net*ratio, barcode, concept, 0);
            lblinfo.Text = "Success";

            //// SENDING EMAIL
            string subject = "AroundTown GiftCard";
            string body = GoDineEmails.PrepareMailBodyWith("newgiftcard.htm", "%name%", user.Email, "%amount%", net.ToString("0.00"), "%code%", barcode.ToString("0"));
            GoDineEmails.SendMail(user.Email, subject, body);

            Response.Redirect("GiftCards.aspx");
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataClassesAlbertDataContext db;
            db = new DataClassesAlbertDataContext();
            GoDine a = new GoDine();

            MembershipUser user = Membership.GetUser();
            Guid userID = (Guid)user.ProviderUserKey;
            var company = (from c in db.Companies where c.UserID == userID select c).Single();
            Setup_GiftCardSales(userID.ToString());

            GiftcardSellingMesage.Text = "Here's your gift card link, where your customers can buy gift cards for just your store, any time, even when your store is closed. " + HOST_URL + "/BuyGiftCard.aspx?Company=" + userID.ToString();

            LabelTitle.Text = company.Name;
    }
예제 #5
0
    protected void Set_Table_Filtered(string filterSeller)
    {
        GoDine GD = new GoDine();

        DataTable dt;
        DataClassesAlbertDataContext db;

        db = new DataClassesAlbertDataContext();
        dt = new DataTable("Sellers");
        var Sellers = from sl in db.SalesIDs select sl;

        dt.Columns.Add("Email", typeof(string));
        dt.Columns.Add("NumberOfSales", typeof(string));
        dt.Columns.Add("%CurrentDealRate", typeof(string));
        dt.Columns.Add("$TotalOfGiftCardsSold", typeof(string));
        dt.Columns.Add("$TotalIncomeFromSales", typeof(decimal));
        dt.Columns.Add("$WePaidThem", typeof(decimal));
        dt.Columns.Add("CreationDate", typeof(DateTime));
        dt.Columns.Add("SellerID", typeof(string));

        foreach (var seller in Sellers)
        {
            MembershipUser user = Membership.GetUser(seller.UserID);
            String username = user.UserName;
            if (username.Contains(filterSeller))
            {
                SellerStats stats = GD.SellerSts(seller.SellerID);
                DataRow tablerow = dt.NewRow();
                tablerow["Email"] = username;
                tablerow["NumberOfSales"] = stats.numSales.ToString();
                tablerow["%CurrentDealRate"] = seller.DealRate.ToString("0.00");
                tablerow["$TotalOfGiftCardsSold"] =  stats.sold.ToString("0.00");
                tablerow["$TotalIncomeFromSales"] = stats.owed;
                tablerow["$WePaidThem"] = GD.getPaidToSeller(seller.SellerID);
                tablerow["CreationDate"] = user.CreationDate;
                tablerow["SellerID"] = seller.SellerID.ToString();
                dt.Rows.Add(tablerow);
            }
        }

        Session["dt"] = dt;
        GV.DataSource = dt;
        GV.AllowSorting = true;
        GV.AllowPaging = true;
        GV.PageSize = 50;
        //GV.Columns["Money"].ItemStyle.HorizontalAlign = HorizontalAlign.Right;
        GV.DataBind();
    }
예제 #6
0
    protected void btncreategc_Click(object sender, EventArgs e)
    {
        try {
            int code;

            if (tbcreategc.Text == "") { code = -1; }
            else { code = Convert.ToInt32(tbcreategc.Text); }

            GoDine a = new GoDine();
            string strusername = ddcreategc.SelectedValue;
            long barcode = a.GiftCard_Create_with_code(code, 1); // IT IS FORCED
            a.GiftCard_AddInfo_EmailType(barcode, strusername);
            lblcreategc.Text = "OK -> Gift Card created for User " + strusername + (code == -1 ? " without protection" : " with pass code = " + code.ToString());
        }
        catch
        {
            lblcreategc.Text = "ERROR -> A user name must be inserted and if there is code protection it must be a positive integer";
        }
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string filterUser = Request.QueryString["cuser"];

            if (filterUser == null)
            {
                filterUser = "";
            }

            DataClassesAlbertDataContext db;
            db = new DataClassesAlbertDataContext();
            GoDine a = new GoDine();

            MembershipUser user = Membership.GetUser();
            Guid userID = (Guid)user.ProviderUserKey;

        }
    }
예제 #8
0
 protected void btnGenerate_Click(object sender, EventArgs e)
 {
     int GCquantity;
     decimal GCvalue;
     try
     {
         GCquantity = Convert.ToInt32(txtGCnum.Text);
         GCvalue = Convert.ToDecimal(txtGCval.Text);
     }
     catch {
         lblProblems.Text = "Numberic values must be entered (integer and decimal respectively)";
         return;
     }
     GoDine a = new GoDine();
     a.GiftCard_Create_IT_TYPE_loop(GCquantity, GCvalue);
     txtGCnum.Text = "";
     txtGCval.Text = "";
     lblProblems.Text = "Successfully created  " + GCquantity.ToString() + "  giftcards of  " + GCvalue.ToString("0.00") + " $  each";
     Set_Table_Filtered("", null);
 }
예제 #9
0
    ///////////////////////////////////////////////////////////// PAYMENT SUCCESS
    public static void Payment_Success_Case_Global_MoneyAndSend(GiftCard giftCard, decimal fee)
    {
        log.Debug("Processing successful payment for GiftCard " + giftCard.GiftCardID);
        log.Debug("Value=" + giftCard.GCValue + ", fee=" + fee + ", barcode=" + giftCard.BarCode);
        DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();

        string companyName = "";
        if (giftCard.CompanyID != "00000000-0000-0000-0000-000000000000" && giftCard.CompanyID != "")
        {
            try
            {
                companyName = (from c in db.Companies where c.UserID == new Guid(giftCard.CompanyID) select c).Single().Name;
            }
            catch { }
        }

        GoDine a = new GoDine();
        a.Insert_Money_2_GiftCard(giftCard.GCValue, giftCard.GCValue - fee, giftCard.BarCode, "Payment by credit card/paypal: " + giftCard.EmailFrom, 0); //IT IS NOT FORCED
        sendSuccessEmail(giftCard, companyName);
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();// We must provide username, Get User doesnt work right here
        Guid userID = (Guid)user.ProviderUserKey;
        GoDine GD = new GoDine();

        if (IsValidString(tbcuser.Text) && tbcuser.Text.Length >= 4)
        {
            if (!GD.CUserExists(tbcuser.Text)){
                GD.CreateCUserToCompany_By_Guid(tbcuser.Text, userID, 0);
                Response.Redirect("Default.aspx"); ;
                lblproblems.Text = tbcuser.Text + " has been added as a user.";
                tbcuser.Text = "";
            } else {
                lblproblems.Text = "This user already exists.";
            }
        }
        else {
            lblproblems.Text = "Only alphanumeric characters are accepted. Minimum 4 characters.";
        }
    }
예제 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string filterUser = Request.QueryString["cuser"];

            if (filterUser == null)
            {
                filterUser = "";
            }

            DataClassesAlbertDataContext db;
            db = new DataClassesAlbertDataContext();
            GoDine a = new GoDine();

            MembershipUser user = Membership.GetUser();
            Guid userID = (Guid)user.ProviderUserKey;
            var company = (from c in db.Companies where c.UserID == userID select c).Single();

            LabelTitle.Text = company.Name;
        }
    }
예제 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataClassesAlbertDataContext db;
        db = new DataClassesAlbertDataContext();
        GoDine a = new GoDine();
        MembershipUser user = Membership.GetUser();
        Guid userID = (Guid)user.ProviderUserKey;
        var company = (from c in db.Companies where c.UserID == userID select c).Single();
        LabelTitle.Text = company.Name;

        DataTable dt;
        dt = new DataTable("Company Payments");

        var Payments = from pmt in db.CompanyPayHists
                       where pmt.CompanyID == company.CompanyID
                       where pmt.IsACompany == true
                     select pmt;

        dt.Columns.Add("Context", typeof(string));
        dt.Columns.Add("Amount($)", typeof(decimal));
        dt.Columns.Add("Date of Payment", typeof(DateTime));

        foreach (var pmt in Payments)
        {
            DataRow tablerow = dt.NewRow();

            tablerow["Context"] = pmt.Concept;
            tablerow["Amount($)"] = pmt.Amount.ToString("0.00");
            tablerow["Date of Payment"] = pmt.Date;
            dt.Rows.Add(tablerow);
        }

        Session["dt"] = dt;
        GV.DataSource = dt;
        GV.AllowSorting = true;
        GV.AllowPaging = true;
        GV.PageSize = 50;
        GV.DataBind();
    }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MembershipUser user = Membership.GetUser();
            if (user != null)
            {
                LabelTitle.Text = user.UserName;
                if (Page.User.IsInRole("Advertiser") || Page.User.IsInRole("Company"))
                {
                    buyNewGiftCard.Visible = false;
                    menuNav.Visible = false;
                    LabelTitle.Text = "";
                }
            }
            else
            {
                buyNewGiftCard.Visible = false;
                menuNav.Visible = false;
                LabelTitle.Text = "";
            }

            navbar.Visible = showNavbar;
            logo.Visible = showNavbar;
            AlternateBranding.Visible = false;

            GoDine a = new GoDine();
            String companyString = Request.QueryString["Company"];
            if (companyString != null && UniqueIDisValid(companyString))
            {
                Company company = a.GetCompanyFromUserID(new Guid(companyString));
                if (company != null)
                {
                    AlternateBranding.Text = company.Name;
                    AlternateBranding.Visible = true;
                    logoImg.Visible = false;

                }
            }
        }
예제 #14
0
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        Roles.AddUserToRole(CreateUserWizard1.UserName, "Company");
        MembershipUser user = Membership.GetUser(CreateUserWizard1.UserName);// We must provide username, Get User doesnt work right here
        Guid userID = (Guid) user.ProviderUserKey;

        TextBox tbCompany = (TextBox) CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("tbCompany");
        string company = tbCompany.Text;
        string cuser = company + " Manager";
        System.Decimal DealRate = 20;

        GoDine a = new GoDine();
        a.CreateCompanyToUserID(company, userID, DealRate, 0);
        a.CreateCUserToCompany(cuser, company, 0);

        //// SENDING EMAIL
        string subject = "Welcome to AroundTown";
        string body = GoDineEmails.PrepareMailBodyWith("newcompany.htm", "%name%", CreateUserWizard1.UserName, "%company%", company, "%cuser%", cuser, "%SALELINK%", HOST_URL + "/BuyGiftCard.aspx?Company=" + userID);
        GoDineEmails.SendMail(CreateUserWizard1.UserName, subject, body);

        //PUT THIS BACK IF WE DONT WANT USERS TO CLICK "SUCCESS"
        //Response.Redirect("Redirect.aspx");
    }
예제 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataClassesAlbertDataContext db;
        db = new DataClassesAlbertDataContext();
        GoDine a = new GoDine();

        MembershipUser user = Membership.GetUser();
        Guid userID = (Guid)user.ProviderUserKey;
        var salesID = (from sid in db.SalesIDs where sid.UserID == userID select sid).Single();
        decimal dealRate = a.getDealRateForSellerID(salesID.SellerID);
        SellerStats table = a.SellerSts(salesID.SellerID);
        decimal paid = a.Paid_FromSalesPaymentHist(salesID.SellerID);

        LabelTitle.Text = "Your Sales Progress";
        lbldealrate.Text = dealRate.ToString("0.00") + "%";
        lblincome.Text = "$" + table.owed.ToString("0.00");
        lblnumsales.Text = table.numSales.ToString();
        lblpaid.Text = "$" + paid.ToString("0.00");
        lbltopay.Text = "$" + (table.owed - paid).ToString("0.00");

        String salesUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "BuyGiftCard.aspx?Sale=" + salesID.SellerID.ToString();

        UrlBlurb.Text = "Your sales url: " + salesUrl + "</br> (refer people here when you're selling in order to get credit for your sales)";
    }
예제 #16
0
    protected void btnpaymentPIN_Click(object sender, EventArgs e)
    {
        int PINtry = -123;
        bool PINformatted = false;
        lblproblemsPIN.Text = "";
        try {
            PINtry = Convert.ToInt32(tbPIN.Text);
            if (PINtry >= 0) {
                PINformatted = true;
            }
        } catch{
            PINformatted = false;
        }

        if (PINformatted)
        {
            TransactionStatus ts;
            GoDine a = new GoDine();
            ts = a.Transaction_from_GcBC_2_CUser_PIN(Convert.ToInt64(tbbarcode.Text), tbcuser.Text, Convert.ToDecimal(tbamount.Text), tbconcept.Text, 0, PINtry);
            if (ts.status == 1000)
            {
                Notify_Transaction_Success(ts);
            }
            else {
                lblproblemsPIN.Text = "PIN is not correct.";
            }
        }
        else {
            lblproblemsPIN.Text = "PIN is not valid.";
        }
    }
예제 #17
0
    protected void btnpayment0_Click(object sender, EventArgs e)
    {
        GoDine a = new GoDine();
        long barcode = 0;
        int success = -1;
        decimal amount = 0;
        try
        {
            barcode = Convert.ToInt64(ddtransactionID.SelectedValue);
            barcode = UTILITIES.removeCheckSum(barcode);
            amount = Convert.ToDecimal(tbtransactionCAD.Text);
            success = 1;
        }
        catch
        {
            success = 0;
        }

        if (success == 1 && !ddtransactionCUser.SelectedValue.Contains("---"))
        {
            string concept = tbtransactionconcept.Text;
            TransactionStatus ts = a.Transaction_from_GcBC_2_CUser(barcode, ddtransactionCUser.SelectedValue, amount, concept, 1);
            if (ts.status == 1000)
            {
                lbltransaction.Text = "OK -> The amount of $" + amount.ToString() + " has been paid to company user " + ddtransactionCUser.SelectedValue + " with the gift card " + barcode.ToString() + ". There is $" + ts.moneyleft.ToString() + " left";
                tbtransactionCAD.Text = "";
            }
            else
            {
                lbltransaction.Text = "ATTENTION -> Transaction not made because there is " + ts.moneyleft + " dollars left in the selected gift card";
            }

        }
        else
        {
            lbltransaction.Text = "ERROR -> A valid amount of money must be inserted for the gift card selected, a company user must also be selected";
        }
    }
예제 #18
0
 protected string TransformDataLineIntoCsv(GiftCard gc)
 {
     GiftCardExtras extra = new GoDine().getExtraFieldsFor(gc);
     string line = UTILITIES.appendChecksum(gc.BarCode);
     line = line + "," + gc.EmailTo;
     line = line + "," + gc.EmailToValidated.ToString();
     line = line + "," + gc.TotalIn;
     line = line + "," + gc.Money;
     line = line + "," + gc.SalesDealRate;
     line = line + "," + extra.compName;
     line = line + "," + extra.salesPerson;
     line = line + "," + gc.Forced.ToString();
     line = line + "," + gc.Date.ToString("yyyy/MM/dd HH:mm:ss");
     line = line + "," + gc.MODE;
     line = line + "," + gc.EmailFrom;
     return line;
 }
예제 #19
0
    protected void btnpayment_Click(object sender, EventArgs e)
    {
        GoDine a = new GoDine();
        long barcode = 0;
        int success;
        decimal net = 0;
        try
        {
            barcode = Convert.ToInt64(ddpaymentID.SelectedValue);
            barcode = UTILITIES.removeCheckSum(barcode);
            net = Convert.ToDecimal(tbpaymentCAD.Text);
            success = 1;
        }
        catch {
            success = 0;
        }

        if (success == 1)
        {
            string concept = tbpaymentconcept.Text;
            a.Insert_Money_2_GiftCard(net, net, barcode, concept, 1);
            lblpayment.Text = "OK -> The amount of " + net.ToString() + " has been added to the gift card with barcode " + barcode.ToString();
            tbpaymentCAD.Text = "";
        }
        else {
            lblpayment.Text = "ERROR -> A valid amount of money must be inserted for the gift card selected";
        }
    }
예제 #20
0
 protected void btnSalesDealRate_Click(object sender, EventArgs e)
 {
     decimal number = -1;
     string num = tbSalesDealRate.Text;
     GoDine a = new GoDine();
     string username = ddSalesDealRate.SelectedValue;
     if (!username.Contains("---sellers---"))
     {
         number = Convert.ToDecimal(num);
         if (number >= 0 && number <= 100)
         {
             DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();
             SalesID qry = (from s in db.SalesIDs where s.UserID == a.UserName_2_Guid(username) select s).Single();
             //Company qry = qry.Single(); // if we do not insert the fist single
             qry.DealRate = number;
             db.SubmitChanges();
             lblSalesDealRate.Text = "OK -> Deal Rate set to " + number.ToString() + " % for seller " + username;
             tbSalesDealRate.Text = number.ToString();
         }
         else
         {
             lblSalesDealRate.Text = "ERROR -> Entered value must be an integer between 1 and 99 for company " + username;
         }
     }
     else
     {
         lblSalesDealRate.Text = "Please select a seller.";
     }
 }
예제 #21
0
    protected void Set_Table_Filtered(string filter, string filterIDstr)
    {
        DataTable dt;
        DataClassesAlbertDataContext db;
        GoDine a;

        db = new DataClassesAlbertDataContext();
        dt = new DataTable("GiftCards");
        a = new GoDine();

        dt.Columns.Add("BarCode", typeof(string));
        dt.Columns.Add("UserName", typeof(string));
        dt.Columns.Add("$TotalIn", typeof(decimal));
        dt.Columns.Add("$MoneyLeft", typeof(decimal));
        dt.Columns.Add("%SaleDealRate", typeof(decimal));
        dt.Columns.Add("Company", typeof(string));
        dt.Columns.Add("Seller", typeof(string));
        dt.Columns.Add("Forced", typeof(bool));
        dt.Columns.Add("CreationDate", typeof(DateTime));
        dt.Columns.Add("Mode", typeof(string));
        dt.Columns.Add("EmailFrom", typeof(string));

        if (filterIDstr == "It's a sales filter" || filterIDstr == "It's a company filter")
        {
            var giftcards = from c in db.GiftCards select c;
            if (filterIDstr == "It's a company filter")
            {
                giftcards = from c in db.GiftCards where c.CompanyID == filter select c; // THIS IS A SELECTED TABLE ACQUISITION
            }
            else
            {
                giftcards = from c in db.GiftCards where c.SellerID == filter select c; // THIS IS A SELECTED TABLE ACQUISITION
            }

            foreach (GiftCard giftcard in giftcards)
            {
                GiftCardExtras extra = a.getExtraFieldsFor(giftcard);
                string giftcard_userkey = giftcard.EmailTo;
                    DataRow tablerow = dt.NewRow();
                    tablerow["UserName"] = giftcard_userkey;
                    tablerow["$TotalIn"] = giftcard.TotalIn;
                    tablerow["$MoneyLeft"] = giftcard.Money;
                    tablerow["%SaleDealRate"] = giftcard.SalesDealRate;
                    tablerow["Company"] = extra.compName;
                    tablerow["Seller"] = extra.salesPerson;
                    tablerow["BarCode"] = UTILITIES.appendChecksum(giftcard.BarCode);
                    tablerow["Forced"] = giftcard.Forced;
                    tablerow["CreationDate"] = giftcard.Date;
                    tablerow["Mode"] = giftcard.MODE;
                    tablerow["EmailFrom"] = giftcard.EmailFrom;
                    dt.Rows.Add(tablerow);
            }
        }
        else
        {
            var giftcards = from c in db.GiftCards select c; // THIS IS A SELECTED TABLE ACQUISITION
            foreach (GiftCard giftcard in giftcards)
            {
                GiftCardExtras extra = a.getExtraFieldsFor(giftcard);
                string giftcard_userkey = giftcard.EmailTo;
                //MembershipUser memberi = Membership.GetUser(userkey_email);
                if (((filterIDstr == null) && (giftcard_userkey.Contains(filter) || giftcard_userkey.Contains(filter))) || filterIDstr == giftcard.GiftCardID.ToString())
                {
                    DataRow tablerow = dt.NewRow();
                    tablerow["UserName"] = giftcard_userkey;
                    tablerow["$TotalIn"] = giftcard.TotalIn;
                    tablerow["$MoneyLeft"] = giftcard.Money;
                    tablerow["%SaleDealRate"] = giftcard.SalesDealRate;
                    tablerow["Company"] = extra.compName;
                    tablerow["Seller"] = extra.salesPerson;
                    tablerow["BarCode"] = UTILITIES.appendChecksum(giftcard.BarCode);
                    tablerow["Forced"] = giftcard.Forced;
                    tablerow["CreationDate"] = giftcard.Date;
                    tablerow["Mode"] = giftcard.MODE;
                    tablerow["EmailFrom"] = giftcard.EmailFrom;
                    dt.Rows.Add(tablerow);
                }
            }
        }

        Session["dt"] = dt;
        GV.DataSource = dt;
        GV.AllowSorting = true;
        GV.AllowPaging = true;
        GV.PageSize = 1000000;
        //GV.Columns["Money"].ItemStyle.HorizontalAlign = HorizontalAlign.Right;
        GV.DataBind();
    }
예제 #22
0
    protected void ResetEverything()
    {
        value.Text = "50";
        img_Amount.ImageUrl = "~/img/icons/transp_22.png";
        img_from_email.ImageUrl = "~/img/icons/transp_22.png";
        img_confirm_from_email.ImageUrl = "~/img/icons/transp_22.png";
        img_from_name.ImageUrl = "~/img/icons/transp_22.png";
        img_to_email.ImageUrl = "~/img/icons/transp_22.png";
        img_confirm_to_email.ImageUrl = "~/img/icons/transp_22.png";
        img_to_name.ImageUrl = "~/img/icons/transp_22.png";
        message.Value = "Please Enter Your Greeting text here";

        GoDine a = new GoDine();
        String companyString = Request.QueryString["Company"];
        if (companyString != null && UniqueIDisValid(companyString))
        {
           Company company = a.GetCompanyFromUserID(new Guid(companyString));
           if (company != null)
           {
               LabelTitle.Text = " for " + company.Name;
               ATF1.Visible = false;
               ATF2.Visible = false;
               ATF3.Visible = false;
           }
        }

        rbChoice.SelectedIndex = 0;
        SectionSandbox.Visible = displaySandboxbutton;
        hideErrorMessage();
        //cbDisplayNames.Checked = true;

        demo.Style["block"] = "none";
        demo.Style["visibility"] = "collapse";
        demo.Style["display"] = "none";
        giftCardInfo.Style["visibility"] = "collapse";
        giftCardInfo.Style["block"] = "none";
        hideStepThree();
    }
예제 #23
0
 /////////////////////////////////////////////////////////////////////////// FOR COMPANY PAYMENTS
 protected void ddPaidAmount_SelectedIndexChanged(object sender, EventArgs e)
 {
     GoDine GD = new GoDine();
     if (!(ddPaidAmount.SelectedValue.Contains("---")))
     {
         int companyID = GD.Get_CompanyID_By_CompanyName(ddPaidAmount.SelectedValue);
         CompanyGiftcardSales giftcards = GD.GetGiftcardSalesForCompany(companyID);
         lblPaidAmount.Text = "Amount left to pay for this company = " + Math.Round(GD.CompanyStatus_from_CompanyID(companyID).toPay + giftcards.totalInFromGCDiscounted, 2);
     }
     else {
         tbPaidAmount.Text = "";
     }
 }
예제 #24
0
 protected void btnPaidSalesAmount_Click(object sender, EventArgs e)
 {
     DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();
     GoDine a = new GoDine();
     try
     {
         decimal amount = Convert.ToDecimal(tbPaidSalesAmount.Text);
         Guid userId = a.UserName_2_Guid(ddSalesPpl.SelectedValue);
         SalesID seller = (from s in db.SalesIDs where s.UserID == userId select s).Single();
         string concept = tbPaidSalesAmountConcept.Text;
         if (a.Pay_Amount_to_Seller(amount, seller.SellerID, concept) == 0)
         {
             lblPaidSalesAmount.Text = "OK -> Seller " + ddSalesPpl.SelectedValue + " received " + amount.ToString();
             tbPaidSalesAmount.Text = "";
         }
         else
         {
             lblPaidSalesAmount.Text = "Error -> Seller " + ddSalesPpl.SelectedValue + " did not 'get paid' Have Lana Check the logs for details :P";
         };
     }
     catch
     {
         lblPaidSalesAmount.Text = "Error -> Input value must be a number.";
     }
 }
예제 #25
0
    protected void btnpayment0_Click(object sender, EventArgs e)
    {
        GoDine a = new GoDine();
        long barcode = 0;
        decimal amount = 0;
        string problems = "";
        lblproblems.Text = "";
        lblsuccess.Text = "";
        ///////////////////////////// PRELIMINARY VERIFICATION PHASE
        if (!IsValidString(tbcuser.Text))
        {
            problems = problems + "Company User is not valid. ";
        }
        try
        {
            barcode = Convert.ToInt64(tbbarcode.Text);
            barcode = UTILITIES.GC_Del_CheckSum(barcode);
            if (barcode <= 0){
                problems = problems + "Barcode is not valid. ";
            }
        }catch{
            problems = problems + "Barcode is not valid. ";
        }
        try{
            amount = Convert.ToDecimal(tbamount.Text);
            if (amount <= 0){
                problems = problems + "Amount to pay must be positive. ";
            }
        }
        catch
        {
            problems = problems + "Amount to pay must be a number. ";
        }
        if (tbcuser.Text.Length > 50) {
            problems = problems + "Company user is not valid. ";
        }
        if (!IsValidString(tbconcept.Text))
        {
            problems = problems + "Concept is not valid. ";
        }

        ////////////////////////// SECOND VERIFICATION PHASE
        if (problems == "")
        {
            string concept = tbconcept.Text;
            int PINtry = -123456;
            TransactionStatus ts = a.Transaction_from_GcBC_2_CUser_PIN(barcode, tbcuser.Text, amount, concept, 0, PINtry);
            if (!ts.cuserexist){
                problems = problems + "Company user does not exist. ";
            }
            if (!ts.giftcardexist) {
                problems = problems + "Barcode is not valid. ";
            }

            if (problems == "")
            {
                if (!ts.enoughmoney)
                {
                    lblproblems.Text = "Not enough money,     $" + ts.moneyleft.ToString("0.00") + "     left.";
                }
                else if (ts.PINprotected)
                {
                    tbamount.Enabled = false;
                    tbbarcode.Enabled = false;
                    tbconcept.Enabled = false;
                    tbcuser.Enabled = false;
                    tbPIN.Visible = true;
                    btntransaction.Visible = false;
                    btntransactionPIN.Visible = true;
                    lblPINfix.Visible = true;
                    lblproblemsPIN.Visible = true;
                    lblok_step1.Text = "This gift card is password-protected. Insert PIN.";
                    lblproblems.Text = "";
                }
                else if (ts.status == 1000)
                {
                    Notify_Transaction_Success(ts);
                }
                else {
                    lblproblems.Text = "Unknown problem. Please contact GoDine.";
                }
            }
            else {
                lblproblems.Text = problems;
            }
        }
        else
        {
            lblproblems.Text = problems;
        }
    }
예제 #26
0
 /////////////////////////////////////////////////////////////////////////// FOR SELLER DEAL RATE
 protected void ddSalesDealRate_SelectedIndexChanged(object sender, EventArgs e)
 {
     DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();
     string Seller = ddSalesDealRate.Text;
     GoDine a = new GoDine();
     if (!(ddSalesDealRate.SelectedValue.Contains("---sellers---")))
     {
         Guid UserID = a.UserName_2_Guid(ddSalesDealRate.SelectedValue);
         Guid SellerID = a.getSellerFromUser(UserID).SellerID;
         decimal rate = a.getDealRateForSellerID(SellerID);
         tbSalesDealRate.Text = rate.ToString("0.00");
     }
     else
     {
         tbSalesDealRate.Text = "";
     }
 }
예제 #27
0
 //////////////////////////////////////////////////////////////////////////////////////////// FOR SELLERS
 protected void ddSalesPpl_SelectedIndexChanged(object sender, EventArgs e)
 {
     GoDine a = new GoDine();
     if (!(ddSalesPpl.SelectedValue.Contains("---sellers---")))
     {
         Guid UserID = a.UserName_2_Guid(ddSalesPpl.SelectedValue);
         Guid SellerID = a.getSellerFromUser(UserID).SellerID;
         SellerStats seller = a.SellerSts(SellerID);
         decimal paid = a.getPaidToSeller(SellerID);
         lblPaidSalesAmount.Text = "Amount left to pay for this seller = " + (seller.owed - paid).ToString("0.00");
     }
     else
     {
         tbPaidAmount.Text = "";
     }
 }
예제 #28
0
 ////////////////////////////////////////////////////////////////////////////////////////////  TRANSACTION
 protected void ddtransactionUsr_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddtransactionID.Items.Clear();
     DataClassesAlbertDataContext db = new DataClassesAlbertDataContext();
     GoDine a = new GoDine();
     //Guid idCustomer = a.UserName_2_Guid(ddtransactionUsr.SelectedValue);
     if (!ddtransactionUsr.SelectedValue.Contains("---"))
     {
         string idCustomer_email = ddtransactionUsr.SelectedValue;
         var barcodes = from gc in db.GiftCards where gc.EmailTo == idCustomer_email select gc.BarCode;
         int number_of_gc = 0;
         foreach (long barcode in barcodes)
         {
             ddtransactionID.Items.Add(UTILITIES.appendChecksum(barcode));
             number_of_gc = number_of_gc + 1;
         }
         if (number_of_gc > 0)
         {
             ddtransactionID_SelectedIndexChanged(null, null);
         }
         else
         {
             lbltransaction.Text = "This user has not any gift card";
         }
     }
     else
     {
         string idCustomer_email = ddtransactionUsr.SelectedValue;
         var barcodes = from gc in db.GiftCards select gc.BarCode;
         int number_of_gc = 0;
         foreach (long barcode in barcodes)
         {
             ddtransactionID.Items.Add(UTILITIES.appendChecksum(barcode));
             number_of_gc = number_of_gc + 1;
         }
         if (number_of_gc > 0)
         {
             ddtransactionID_SelectedIndexChanged(null, null);
         }
     }
 }
예제 #29
0
    protected void RedirectToPaypal(decimal AMOUNT)
    {
        String saleString = Request.QueryString["Sale"];
        String companyString = Request.QueryString["Company"];
        UTILITIES.GiftCardReady GCready = new UTILITIES.GiftCardReady();
        GCready.FromName = fromName.Text;
        GCready.FromEmail = fromEmail.Text;
        GCready.ToName = toName.Text;
        GCready.ToEmail = toEmail.Text;
        if (message.Value.Contains("Please Enter Your Greeting text here")){
            GCready.TEXT = "";
        }
        else{GCready.TEXT = message.Value;}

        GCready.amount = AMOUNT;
        GCready.STRVAL = "$ " + AMOUNT.ToString("0.00");
        GCready.TYPE = rbChoice.SelectedIndex;
        GCready.DIR_BACKBMP = backgroundImage.Value;
        GCready.DIR_TXTBMP = "";
        displayName = cbDisplayNames.Checked;
        GCready.DisplayName = displayName;
        Random random = new Random();
        GCready.paypalID = DateTime.Now.ToString("yyMMddHHmmss") + fromEmail.Text.Replace('@', '-') + random.Next(1000).ToString("000");
        GCready.SalesID = "00000000-0000-0000-0000-000000000000";
        String CompanyID = "00000000-0000-0000-0000-000000000000";
        decimal salesDeal = 0;
        GoDine a = new GoDine();
        if (saleString != null && UniqueIDisValid(saleString))
        {
            GCready.SalesID = saleString;
            try
            {
                salesDeal = a.getDealRateForSellerID(new Guid(saleString));
            }
            catch
            {
            }
        }
        if (companyString != null && UniqueIDisValid(companyString))
        {
            try
            {
                //sales people don't make comission for giftcards that are for individual companies
                //if it's a valid company ID it'll overwrite the salesID, if it's not valid it won't save the CompanyID
                salesDeal = a.CompanyGiftCardDealRate(companyString);
                CompanyID = companyString;
                GCready.SalesID = "00000000-0000-0000-0000-000000000000";
            }
            catch
            {
            }
        }
        long barcode = a.GiftCard_Create_with_code(-1, 0); // IT IS NOT FORCED
        string barcodeWithChecksum = UTILITIES.appendChecksum(barcode);
        System.Console.WriteLine(barcodeWithChecksum);

        a.GiftCard_AddInfo_EmailType(barcode, GCready.ToEmail, GCready.FromEmail, GCready.ToName, GCready.FromName, GCready.DIR_BACKBMP, GCready.DIR_TXTBMP, GCready.TEXT, GCready.STRVAL, GCready.amount, GCready.paypalID, GCready.DisplayName, GCready.SalesID, salesDeal, CompanyID);
        if (GCready.TYPE == 1)
        {
            a.GiftCard_AddInfo_PrintType(barcode);
        }
        else if (GCready.TYPE == 2)
        {
            a.GiftCard_AddInfo_ShippingType(barcode, "", ""); // if shipping, the address must be applied exactly after the info of the email type
        }

        GCready.barcode = barcode;

        Session["GCready"] = GCready;

        //string input_permanent = "?cmd=_xclick&[email protected]&currency_code=CAD&country=CA&no_shipping=1&shipping=0.001&handling=0.00&image_url=" + WEBSITE_ADDRESS + "/img/paypal150px.png&return=" + WEBSITE_ADDRESS + "/TransactionStatus.aspx&cancel_return=" + WEBSITE_ADDRESS + "/TransactionStatus.aspx";
        string input_permanent = "?cmd=_ext-enter&redirect_cmd=_xclick&[email protected]";//&shipping=0.00&handling=0.00
        input_permanent += "&currency_code=CAD&no_shipping=1&country=CA&image_url=" + HOST_URL + "/img/paypal150px.png";
        input_permanent += "&callback_url=" + HOST_URL + "/About.aspx";

        string input_permanent_sandbox = "?cmd=_ext-enter&redirect_cmd=_xclick&[email protected]";//&shipping=0.00&handling=0.00
        input_permanent_sandbox += "&currency_code=CAD&no_shipping=1&country=CA&image_url=" + HOST_URL + "/img/paypal150px.png";
        input_permanent_sandbox += "&callback_url=" + HOST_URL + "/About.aspx";

        string input_dependent = "&item_name=AroundTown Giftcard, " + AMOUNT.ToString("0.00") + "$ value";
        input_dependent += "&amount=" + AMOUNT.ToString("0.00") + "&email=" + GCready.FromEmail + "&receiver_email=" + GCready.FromEmail;
        input_dependent += "&custom=" + GCready.paypalID + "&first_name=" + GCready.FromName;
        //https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside

        string resp_redirect;
        if (useSandbox)
        {
            resp_redirect = PAYPAL_ADDRESS_SANDBOX + input_permanent_sandbox + input_dependent + "&return=" + HOST_URL + "/PaymentSuccess.aspx&cancel_return=" + HOST_URL + "/PaymentPending.aspx";
        }
        else {
            resp_redirect = PAYPAL_ADDRESS + input_permanent + input_dependent + "&return=" + HOST_URL + "/PaymentSuccess.aspx&cancel_return=" + HOST_URL + "/PaymentPending.aspx";
        }

        log.Debug("Redirecting to paypal: " + resp_redirect);

        Response.Redirect(resp_redirect);
    }
예제 #30
0
 protected void btnPaidAmount_Click(object sender, EventArgs e)
 {
     GoDine a = new GoDine();
     try {
         decimal amount = Convert.ToDecimal(tbPaidAmount.Text);
         string company = ddPaidAmount.SelectedValue;
         string concept = tbPaidAmountConcept.Text;
         if (a.Pay_Amount_to_Company(amount, company, concept, 1) == 0)
         {
             lblPaidAmount.Text = "OK -> " + company + " receives " + amount.ToString();
             tbPaidAmount.Text = "";
         }
         else {
             lblPaidAmount.Text = "Error -> Company " + company + " was not found";
         };
     }catch{
         lblPaidAmount.Text = "Error -> Input value must be a number";
     }
 }