Beispiel #1
0
 // sets the Customer up to a array used to show data in the listview as a listviewitem
 public string[] GetListViewItemRange()
 {
     string[] arr = new string[11]
     {
         CustomerNumber.ToString(), FirstName, LastName, EmailAddress.Print(), AccountBalance.ToString(), CustAdresse.PostCode.ToString(), CustAdresse.City, CustAdresse.Street, CustAdresse.StreetNr.ToString(),
              LastAccess.ToShortDateString(), ""
     };
     return(arr);
 }
Beispiel #2
0
        /// <summary>
        /// Creates the POST request.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="serviceUrl"></param>
        /// <param name="obj"></param>
        TResponse SendRequest <TRequest, TResponse>(string serviceUrl, TRequest obj)
        {
            var data     = XmlUtils.Serialize <TRequest>(obj);
            var address  = new Uri(serviceUrl);
            var byteData = UTF8Encoding.UTF8.GetBytes(data);
            var key      = Hash(string.Format("{0}{1:yyyyMMdd}{2}", IpAddress, DateTime.Now, AuthToken));
            var request  = WebRequest.Create(address) as HttpWebRequest;

            request.Method        = "POST";
            request.ContentType   = "application/xml";
            request.ContentLength = byteData.Length;
            request.Headers.Add("customerNo", CustomerNumber.ToString());
            request.Headers.Add("key", key);
            using (Stream postStream = request.GetRequestStream()) {
                postStream.Write(byteData, 0, byteData.Length);
            }
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) {
                using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) {
                    return(XmlUtils.Deserialize <TResponse>(reader));
                }
            }
        }
Beispiel #3
0
 public string PrintCustomerCrypt()
 {
     return(Crypto.EncodeLine(new string[] { CustomerNumber.ToString(), FirstName, LastName, EmailAddress.Print(), CustAdresse.ToCSVString(), LastAccess.ToShortDateString(), AccountBalance.ToString() }));
 }
        private void button1_Click(object sender, EventArgs e)
        {
            String Name, Mobile, Age, CustomerNumber;

            Name           = textBox1.Text;
            Mobile         = textBox2.Text;
            Age            = textBox3.Text;
            CustomerNumber = textBox4.Text;
            if (Name.Length == 0 || Name.Length > 30)
            {
                errorProvider1.SetError(textBox1, " Please Enter Valid Name ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (Mobile.Length == 0 || Mobile.Length > 30)
            {
                errorProvider1.SetError(textBox2, " Please Enter Valid Mobile ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (Age.Length == 0)
            {
                errorProvider1.SetError(textBox3, " Please Enter Valid Age ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (CustomerNumber.Length == 0)
            {
                errorProvider1.SetError(textBox4, " Please Enter Valid CustomerNumber ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else
            {
                con.Open();
                errorProvider1.Clear();
                cmd.Connection = con;
                SqlCommand myCommand = new SqlCommand("insert into Customers values ('" +
                                                      Name.ToString() + "','" + Mobile.ToString() + "','" + Int32.Parse(Age.ToString()) + "','" + Int32.Parse(CustomerNumber.ToString()) + "')", con);
                int success = myCommand.ExecuteNonQuery();
                if (success == 1)
                {
                    MessageBox.Show(success + " row has been inserted ");
                }
                con.Close();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            String ProductID, OrderID, ID, CustomerNumber, Amount, Price, ProductName;

            ProductID      = textBox1.Text;
            OrderID        = textBox2.Text;
            ID             = textBox3.Text;
            CustomerNumber = textBox4.Text;
            Amount         = textBox5.Text;
            Price          = textBox6.Text;
            ProductName    = textBox7.Text;
            if (ProductID.Length == 0 || ProductID.Length > 30)
            {
                errorProvider1.SetError(textBox1, " Please Enter Valid ProductID ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (OrderID.Length == 0 || OrderID.Length > 30)
            {
                errorProvider1.SetError(textBox2, " Please Enter Valid OrderID ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (ID.Length == 0 || ID.Length > 30)
            {
                errorProvider1.SetError(textBox3, " Please Enter Valid ID ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (CustomerNumber.Length == 0)
            {
                errorProvider1.SetError(textBox4, " Please Enter Valid CustomerID ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (Amount.Length == 0)
            {
                errorProvider1.SetError(textBox5, " Please Enter Valid Amount ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (Price.Length == 0)
            {
                errorProvider1.SetError(textBox6, " Please Enter Valid Price ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else if (ProductName.Length == 0 || ProductName.Length > 30)
            {
                errorProvider1.SetError(textBox7, " Please Enter Valid ProductName ");
                errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
            }
            else
            {
                con.Open();
                errorProvider1.Clear();
                cmd.Connection = con;
                SqlCommand myCommand = new SqlCommand("insert into Orders values ('" +
                                                      ProductID.ToString() + "','" + OrderID.ToString() + "','" + ID.ToString() + "','" + Int32.Parse(CustomerNumber.ToString())
                                                      + "','" + Int32.Parse(Amount.ToString()) + "','" + float.Parse(Price.ToString()) + "','" + ProductName.ToString() + "')", con);
                int success = myCommand.ExecuteNonQuery();
                if (success == 1)
                {
                    MessageBox.Show(success + " row has been inserted ");
                }
                con.Close();
            }
        }
 public override string ToString()
 {
     return(AccountNumber + "/" + CustomerNumber.ToString() + " - " + Message);
 }
 public override string ToString()
 {
     return(CustomerNumber.ToString() + " - " + Message);
 }