public void UpdateConsignor()
        {
            // SETUP
            ConsignorClasses.Consignor c = new Consignor();
            ConsignorClasses.ConsignorUtilities u = new ConsignorUtilities();
            c.Address1City = testAddressCity;
            c.Address1State = testAddressState;
            c.Address1Street = testStreet;
            c.Address1Zip = testZip;
            c.CellPhone = testCell;
            c.Comments = testComments;
            c.ConsignorID = GetMaxConsignorID();
            c.Donate = true;
            c.EmailAddress = testEmail;
            c.FirstName = testUpdatedFirstName;
            c.HomePhone = testHomePhone;
            c.LastName = testUpdatedLastName;
            c.WorkPhone = testWorkPhone;

            // TRIGGER
            bool updateResult = u.Consignor_Update(c);
            ConsignorClasses.Consignor updated = new Consignor();
            updated = u.GetExistingConsignor(GetMaxConsignorID());

            // VALIDATE
            Assert.AreEqual(true, updateResult, "expected different result");
            Assert.AreEqual(c.LastName, updated.LastName, "expected same updated last name");
            Assert.AreEqual(c.FirstName, updated.FirstName, "expected same updated first name");
        }
 /// <summary>
 /// Navigate to the report when list box items have been selected
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdGo_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItems.Count != 0)
     {
         List<string> collection = ParseSelectedItems(listBox1.SelectedItems);
         string sqlParams = ConvertToSqlParam(collection);
         ConsignorClasses.ConsignorUtilities cu = new ConsignorClasses.ConsignorUtilities();
         ConsignorClasses.Consignor c = new ConsignorClasses.Consignor();
         c = cu.GetExistingConsignor(GlobalClass.ConsignerID);
         ConsignorID = c.ConsignorID;
         LoadReport(c.ConsignorID, sqlParams);
     }
 }
 /// <summary>
 /// load the active only to start
 /// </summary>
 private void LoadActiveOnly()
 {
     string sqlParams = ConvertToSqlParam(ActiveOnlyStatus);
     ConsignorClasses.ConsignorUtilities cu = new ConsignorClasses.ConsignorUtilities();
     ConsignorClasses.Consignor c = new ConsignorClasses.Consignor();
     c = cu.GetExistingConsignor(GlobalClass.ConsignerID);
     ConsignorID = c.ConsignorID;
     LoadReport(c.ConsignorID, sqlParams);
 }
        /// <summary>
        /// load up the report
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Report_ConsignorDetailReport_Load(object sender, EventArgs e)
        {
            this.soldStatus_Select1TableAdapter.Fill(this.doubletakeDataSet.SoldStatus_Select1);
            ConsignorClasses.ConsignorUtilities cu = new ConsignorClasses.ConsignorUtilities();
            ConsignorClasses.Consignor c = new ConsignorClasses.Consignor();
            c = cu.GetExistingConsignor(GlobalClass.ConsignerID);
            ConsignorID = c.ConsignorID;
            lblConsignorName.Text = string.Format("{0} {1}", c.FirstName, c.LastName);

            // check if this is coming from the right click on the search
            if (string.IsNullOrEmpty(GlobalClass.WhateverString))
            {
                listBox1.SelectedItems.Clear();
            }
            else
            {
                LoadReport(c.ConsignorID, GlobalClass.WhateverString);
            }
        }
Beispiel #5
0
        private void GetConsignor(int ConsignorID)
        {
            ConsignorClasses.ConsignorUtilities u = new ConsignorClasses.ConsignorUtilities();
            var returnedConsignor = new ConsignorClasses.Consignor();
            returnedConsignor = u.GetExistingConsignor(ConsignorID);

            // check for C# exceptions
            if (returnedConsignor.LastName.Contains("SQL Exception"))
            {
                MessageBox.Show(returnedConsignor.Comments, "SQL Data Error", MessageBoxButtons.OK);
                ClearConsignor();
            }
            else if (returnedConsignor.LastName.Contains("C# Exception"))
            {
                MessageBox.Show(returnedConsignor.Comments, "C# Error", MessageBoxButtons.OK);
                ClearConsignor();
            }
            else
            {
                txtConsignorID.Text = ConsignorID.ToString();
                txtLastName.Text = returnedConsignor.LastName;
                txtFirstName.Text = returnedConsignor.FirstName;
                txtAddress.Text = returnedConsignor.Address1Street;
                txtCity.Text = returnedConsignor.Address1City;
                txtState.Text = returnedConsignor.Address1State;
                txtZipCode.Text = returnedConsignor.Address1Zip;
                txtHomePhone.Text = returnedConsignor.HomePhone;
                txtWorkPhone.Text = returnedConsignor.WorkPhone;
                txtCellPhone.Text = returnedConsignor.CellPhone;
                txtemail.Text = returnedConsignor.EmailAddress;
                txtComments.Text = returnedConsignor.Comments;
                ckDonate.Checked = returnedConsignor.Donate;
            }
            ClearConsignor();
        }