Esempio n. 1
0
        public void Update(Guid id, string firstName, string lastName)
        {
            var person = new Person
                {
                    Id = id,
                    FirstName = firstName,
                };

            UpdateOne(person);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FileInfo info = new FileInfo("C:\\windows\\explorer.exe");
            long size = info.Length;
            string outtext = string.Format("Размер файла explorer.exe <b>{0}</b> байт", size);
            Output.Text = outtext;
            Person p = new Person("Romka", "*****@*****.**");
            Output2.Text = p.GenerateHtml();

            string filename = Server.MapPath(@"App_Data\TextFile.txt");
            output1 = File.ReadAllText(filename);
            output1 = output1.Replace("<%LOGIN%>", p.login);
            output1 = output1.Replace("<%EMAIL%>", p.email);
        }
        protected void Page_Load(object Object, EventArgs e)
        {
            Page.Header.Controls.Add(
                new LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("css/style.css") + "\" />"));

            if (!IsPostBack)
            {
                PopulateStaticControls();
                this.imgCheckImage.ImageUrl = this.CheckImageURLSetting;
                this.tbComment.Attributes["placeholder"] = this.CommentCaptionSetting;
                if (Convert.ToBoolean(this.ShowPortalLoginSetting))
                {
                    this.hfTracker.Value = "0";
                }
                else
                {
                    this.hfTracker.Value = "1";
                }

                this.btnChooseLogin.Value = this.ChooseLoginTextSetting;
                this.btnGiveNow.Value = this.GiveNowTextSetting;
                this.hfLoginLocation.Value = Page.ResolveUrl("default.aspx?page="+this.LoginPageSetting.ToString()).ToString();
                this.forgotLogin.NavigateUrl = this.ForgotLoginSetting;
                this.forgotPassword.NavigateUrl = this.ForgotPasswordSetting;

            }
            else
            {
                switch(hfTracker.Value)
                {
                    case "1":
                        //assuming all data is correct
                        int iPersonId = GetPersonIdFromInputData();
                        if (iPersonId != 0)
                        {
                            Person person = new Person(iPersonId);
                            this._person = new Person(iPersonId);
                            this.SelectedFunds = GetSelectedFundCollection();
                            /*this.SelectedFundsSerialized = this.SerializeToString(this.SelectedFunds,typeof(ContributionFundCollection));
                            this.hfSerializedFunds.Value = this.SelectedFundsSerialized;*/
                            this.LoadGateways();
                            if (this.SubmitPreAuthorization())
                            {
                                this.buildConfirmationScreen(person);
                                this.hfConfirmationID.Value = this.ConfirmationNumber.ToString();
                                this.hfPersonID.Value = this._person.PersonID.ToString();
                                this.hfTracker.Value = "2";
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }
                        break;
                    case "2":
                        /*DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ContributionFundCollection));
                        using(MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(hfSerializedFunds.Value.Trim()))) {
                            this.SelectedFunds = (ContributionFundCollection)serializer.ReadObject(ms);
                        }*/
                        this._person = new Person(Convert.ToInt32(this.hfPersonID.Value));
                        this.LoadGateways();
                        if (this.SubmitTransaction())
                        {
                            this.buildThankYou();
                            this.hfTracker.Value = "3";
                        }
                        else
                        {
                            return;
                        }
                        break;
                }
            }
        }
        protected void buildConfirmationScreen(Person person)
        {
            HtmlGenericControl template = new HtmlGenericControl("script")
            {
                InnerHtml = "<table cellpadding=\"0\" cellspacing=\"0\" class=\"confirmationData\">{{#each info}}<tr><td class=\"label\">{{label}}</td><td class=\"data\">{{{data}}}&nbsp;</td></tr>{{/each}}</table>"
            };
            template.Attributes.Add("type", "text/x-handlebars-template");
            template.Attributes.Add("id", "datatable-template");
            Page.Header.Controls.Add(template);

            StringBuilder confData = new StringBuilder();

            confData.Append("var personData={ info: [");
            confData.Append("{label:\"Name\",data:\"" + person.FullName + "\"},");
            confData.Append("{label:\"Email Address\",data:\"" + person.Emails.FirstActive + "\"},");
            confData.Append("{label:\"Phone\",data:\"" + person.Phones.FindByType(276) + "\"},");
            confData.Append("{label:\"Address\",data:\"" + this.currentAddress.Address.StreetLine1 + "<br>" + this.currentAddress.Address.City + ", " + this.currentAddress.Address.State + "<br>" + this.currentAddress.Address.PostalCode + "\"},");
            confData.Append("{label:\"Country\",data:\"" + this.currentAddress.Address.Country + "\"}");
            confData.Append("]};");

            confData.AppendLine();
            confData.Append("var giftData={ info: [");

            foreach (ContributionFund contribFund in this.SelectedFunds) {
                Fund curFund = new Fund(Convert.ToInt16(contribFund.FundId));
                confData.Append("{label:\"" + curFund.OnlineName + "\",data:\"" + String.Format("{0:C}", contribFund.Amount) + "\"},");
            }
            confData.Append("{label:\"\",data:\"\"},");
            confData.Append("{label:\"Total\",data:\"" + String.Format("{0:C}", Convert.ToDecimal(hfTotalContribution.Value)).ToString() + "\"},");
            confData.Append("{label:\"Memo\",data:\"" + tbComment.Text + "\"}");
            confData.Append("]};");

            confData.Append("var paymentData={ info: [");
            confData.Append("{label:\"Payment Data\",data:\"" + rblPaymentMethod.SelectedItem.Text + "\"},");
            confData.Append("{label:\"Account Number\",data:\"" + MaskAccountNumber(tbAccountNumber.Text) + MaskAccountNumber(tbCCNumber.Text) + "\"},");
            if (tbRoutingNumber.Text.Length > 0)
            {
                confData.Append("{label:\"Bank Name\",data:\"" + tbBankName.Text + "\"},");
                confData.Append("{label:\"Routing Number\",data:\"" + tbRoutingNumber.Text + "\"}");
            }
            if (tbCCNumber.Text.Length > 0)
            {
                confData.Append("{label:\"Expiration Date\",data:\"" + ddlExpMonth.SelectedValue + "/" + ddlExpYear.SelectedValue + "\"}");
            }
            confData.Append("]};");

            HtmlGenericControl templateData = new HtmlGenericControl("script")
            {
                InnerHtml = confData.ToString()
            };

            templateData.Attributes.Add("type", "text/javascript");
            Page.Header.Controls.Add(templateData);
            return;
        }