public static bool deactivateVendor(CustomerProperties vendor, string userId) { bool result = false; result = vendorDbProcessHandler.removeCustomerInfo(vendor, userId); if (result) { UserDBProcessHandler removeVendorUser = new UserDBProcessHandler(); removeVendorUser.removeMultipleCustomerUsers(vendor.Vendor_Id); } return(result); }
public CustomerProperties getCustomerInfo(string vendorName) { CustomerProperties customerProperties = new CustomerProperties(); foreach (CustomerProperties vendor in vendorLists) { if (vendor.Vendor_Name.Equals(vendorName)) { customerProperties.Vendor_Name = vendor.Vendor_Name; customerProperties.Vendor_Id = vendor.Vendor_Id; } } return(customerProperties); }
private void buttonAddUser_Click(object sender, EventArgs e) { try{ UserInformationProperties userInformation = new UserInformationProperties(); userInformation.Name = textBoxName.Text.ToUpper(); userInformation.Contact = textBoxContact.Text.ToUpper(); userInformation.Address = textBoxAddress.Text.ToUpper(); userInformation.EMail_Id = textBoxEmailId.Text.ToUpper(); userInformation.Status = "ACTIVE"; userInformation.User_Id = textBoxGeneratedUsername.Text; userInformation.Password = textBoxGeneratedPassword.Text; if (radioButtonIsVendorYes.Checked == true) { comboBoxVendorName.Enabled = true; listBoxRoles.Enabled = false; userInformation.Is_Vendor = "TRUE"; userInformation.Role = "VENDOR"; CustomerProperties vendorDetails = userInformationHandler.getCustomerInfo(comboBoxVendorName.SelectedItem.ToString()); userInformation.Vendor_Name = vendorDetails.Vendor_Name.ToUpper(); userInformation.Vendor_ID = vendorDetails.Vendor_Id.ToUpper(); } else if (radioButtonIsVendorNo.Checked == true) { comboBoxVendorName.Enabled = false; listBoxRoles.Enabled = true; userInformation.Is_Vendor = "FALSE"; userInformation.Role = listBoxRoles.SelectedIndex.ToString().ToUpper(); userInformation.Vendor_ID = "N/A"; userInformation.Vendor_Name = "N/A"; } else { MessageBox.Show("Error", "Please provide user role!", MessageBoxButtons.OK); } com.app.business.UserInformationHandler userInfoHandler = new com.app.business.UserInformationHandler(); ///*************testing userInformationHandler.addNewUser(userInformation, userSessionInformation.User_Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
private void buttonSearchVendor_Click(object sender, EventArgs e) { CustomerProperties fieldValues = new CustomerProperties(); DiscountProperties discountValues = new DiscountProperties(); searchVendorDelegate <CustomerProperties> searchVendor = new searchVendorDelegate <CustomerProperties>(CustomerInformationHandler.searchVendor); searchVendorDelegate <DiscountProperties> discountInfoVendor = new searchVendorDelegate <DiscountProperties>(CustomerInformationHandler.getVendorDiscountInfo); if ((!textBoxCustomerId.Text.Equals(null)) && (textBoxCustomerId.Text.Length > 0)) { fieldValues = searchVendor.Invoke(textBoxCustomerId.Text.ToUpper()); if (fieldValues.Vendor_Id != null) { discountValues = discountInfoVendor.Invoke(fieldValues.Vendor_Discount_ID.ToUpper()); textBoxContact.Text = fieldValues.Vendor_Contact; textBoxAddress.Text = fieldValues.Vendor_Address; textBoxCustomerName.Text = fieldValues.Vendor_Name; textBoxMailId.Text = fieldValues.Vendor_EMail_Id; textBoxDiscountRate.Text = discountValues.Discount_Rate; textBoxDiscountId.Text = discountValues.Discount_Id; if (fieldValues.Vendor_Status == "ACTIVE") { listBoxStatus.Enabled = true; listBoxStatus.Visible = true; listBoxStatus.SelectedIndex = 0; } else { listBoxStatus.Enabled = true; listBoxStatus.Visible = true; listBoxStatus.SelectedIndex = 1; } textBoxCustomerId.ReadOnly = true; } else { MessageBox.Show("INVALID VENDOR ID", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public Properties(ServerProperties server, CustomerProperties customer) { Server = server; Customer = customer; }
private void buttonDynamicButton_Click(object sender, EventArgs e) { try { if (radioButtonAddNewVendor.Checked == true) { //User defined delegate for adding new vendor in database vendorDelegate <CustomerProperties> addVendor = new vendorDelegate <CustomerProperties>(CustomerInformationHandler.addNewVendor); CustomerProperties newVendorData = new CustomerProperties(); bool result = false; try { newVendorData.Vendor_Id = textBoxCustomerId.Text.ToUpper(); newVendorData.Vendor_Name = textBoxCustomerName.Text.ToUpper(); newVendorData.Vendor_Contact = textBoxContact.Text.ToUpper(); newVendorData.Vendor_EMail_Id = textBoxMailId.Text.ToUpper(); newVendorData.Vendor_Address = textBoxAddress.Text.ToUpper(); newVendorData.Vendor_Discount_ID = textBoxDiscountId.Text; newVendorData.Vendor_Balance_Amount = Convert.ToDouble("00.0"); newVendorData.Vendor_Status = textBoxStatus.Text.ToUpper(); //******************* testing //delegate invoked result = addVendor.Invoke(newVendorData, _userSessionInformation.User_Id); if (result == true) { MessageBox.Show("New Vendor successfully".ToUpper(), "CUSTOMER", MessageBoxButtons.OK, MessageBoxIcon.Information); loadGridView(); } else { MessageBox.Show("Please provide the correct vendor details".ToUpper(), "CUSTOMER", MessageBoxButtons.OK, MessageBoxIcon.Question); } } catch (Exception ex) { MessageBox.Show("Provide Appropriate values".ToUpper(), "CUSTOMER", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.StackTrace); } } else if (radioButtonModifyVendor.Checked == true) { CustomerProperties existingVendorData = new CustomerProperties(); vendorDelegate <CustomerProperties> modifyVendor = new vendorDelegate <CustomerProperties>(CustomerInformationHandler.vendorInformationUpdate); bool result = false; try { existingVendorData.Vendor_Id = textBoxCustomerId.Text.ToUpper(); existingVendorData.Vendor_Name = textBoxCustomerName.Text.ToUpper(); existingVendorData.Vendor_Contact = textBoxContact.Text.ToUpper(); existingVendorData.Vendor_EMail_Id = textBoxMailId.Text.ToUpper(); existingVendorData.Vendor_Address = textBoxAddress.Text.ToUpper(); existingVendorData.Vendor_Status = listBoxStatus.SelectedItem.ToString(); //******************* testing //delegate invoked result = modifyVendor.Invoke(existingVendorData, _userSessionInformation.User_Id); if (result == true) { MessageBox.Show("Vendor details updated successfully", "CUSTOMER", MessageBoxButtons.OK, MessageBoxIcon.Information); loadGridView(); } else { MessageBox.Show("Please provide the correct vendor details", "CUSTOMER", MessageBoxButtons.OK, MessageBoxIcon.Question); } } catch (Exception ex) { MessageBox.Show("Provide Appropriate values", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.StackTrace); } } else if (radioButtonDeleteVendor.Checked == true) { bool result = false; CustomerProperties existingVendorData = new CustomerProperties(); vendorDelegate <CustomerProperties> deactivateVendor = new vendorDelegate <CustomerProperties>(CustomerInformationHandler.deactivateVendor); if (textBoxCustomerId.Text != null) { existingVendorData.Vendor_Id = textBoxCustomerId.Text; //********************* testing //delegate invoked result = deactivateVendor.Invoke(existingVendorData, _userSessionInformation.User_Id); if (result == true) { MessageBox.Show("Vendor deactivated from system successfully".ToUpper(), "CUSTOMER", MessageBoxButtons.OK, MessageBoxIcon.Information); clearFormContent(); loadGridView(); } } } clearFormContent(); }catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
//DATA GRID VIEW ROWS private void addDataToGridView(CustomerProperties vendorInfo, int indexNumber) { string[] vendorData = new string[] { indexNumber.ToString(), vendorInfo.Vendor_Id.ToString(), vendorInfo.Vendor_Name.ToString(), vendorInfo.Vendor_Address.ToString(), vendorInfo.Vendor_Contact.ToString(), vendorInfo.Vendor_EMail_Id.ToString(), vendorInfo.Vendor_Status.ToString(), vendorInfo.Vendor_Discount_ID.ToString(), vendorInfo.Vendor_Balance_Amount.ToString("c") }; dataGridViewVendorInformation.Rows.Add(vendorData); }
public static CustomerProperties searchVendor(string vendorId) { CustomerProperties vendorInfo = new CustomerProperties(); return(vendorInfo = vendorDbProcessHandler.getSingleCustomerInfo(vendorId)); }
public static bool vendorInformationUpdate(CustomerProperties vendorinfo, string currentUserId) { return(vendorDbProcessHandler.modifyCustomerInfo(vendorinfo, currentUserId)); }
public static bool addNewVendor(CustomerProperties vendor, string currentUserId) { return(vendorDbProcessHandler.addCustomerInfo(vendor, currentUserId)); }