Example #1
0
 public CustomerMainWindow(object sessionInfo)
 {
     InitializeComponent();
     _currentUserSessionInformation = (UserInformationProperties)sessionInfo;
     textBoxSessionUser.Text        = _currentUserSessionInformation.Name;
     textBoxSessionVendor.Text      = _currentUserSessionInformation.Vendor_Name;
     textBoxCurrentDate.Text        = ConsignmentCompanyProject.com.app.utlitiy.BusinessUtlities.getCurrentDateTime;
 }
        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);
            }
        }
Example #3
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            UserInformationProperties _userSession = new UserInformationProperties();
            LoginProperties           logindata    = new LoginProperties();

            if ((textBoxUserName.Text != null) && (textBoxPassword.Text != null))
            {
                logindata.Username = textBoxUserName.Text;
                logindata.Password = textBoxPassword.Text;
                _userSession       = loginHandler.validateUserCredentials(logindata);



                if (_userSession != null)
                {
                    splashscreen.Hide();
                    this.Enabled = false;
                    this.Visible = false;

                    if (_userSession.Role.Equals("MANAGER"))
                    {
                        ManagerMainWindow managerWindow = new ManagerMainWindow(_userSession);
                        managerWindow.Text = _userSession.Name;
                        managerWindow.Show();
                    }
                    else if (_userSession.Role.Equals("VENDOR"))
                    {
                        com.windows.forms.CustomerMainWindow customerWindow = new com.windows.forms.CustomerMainWindow(_userSession);
                        customerWindow.Text = _userSession.Vendor_Name;
                        customerWindow.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Invalid Username/Password".ToUpper(), "Login failed".ToUpper(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("PLEASE PROVIDE USERNAME AND PASSWORD PROPERLY".ToUpper(), "Login failed".ToUpper(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            UserInformationProperties userInformation = new UserInformationProperties();
            modifyInformationDelegate <UserInformationProperties> modifyProfileInformation = new modifyInformationDelegate <UserInformationProperties>(UserInformationHandler.updateUserInformation);
            bool result = false;

            try
            {
                userInformation.User_Id  = textBoxUserId.Text;
                userInformation.Contact  = textBoxContact.Text;
                userInformation.Address  = textBoxAddress.Text.ToUpper();
                userInformation.EMail_Id = textBoxEmail.Text.ToUpper();
                result = modifyProfileInformation.Invoke(userInformation);
                if (result)
                {
                    MessageBox.Show("Profile updated successfully", "Profile", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }catch (Exception ex)
            {
                Console.WriteLine("Please enter appropriate values to the fields", ex.StackTrace);
            }
        }
        private void UserProfileChangeForm_Load(object sender, EventArgs e)
        {
            //get the current userid from session object
            //*********Testing
            string userId = "Jay11144205";

            if (userId != null && userId.Length > 0)
            {
                try {
                    UserInformationProperties currentUserInfo = new UserInformationProperties();
                    userInformationDelegate <UserInformationProperties> getUserInfo = new userInformationDelegate <UserInformationProperties>(UserInformationHandler.getUserProfileInformation);
                    currentUserInfo        = getUserInfo.Invoke(userSessionInformation.User_Id);
                    textBoxnName.Text      = currentUserInfo.Name;
                    textBoxUserId.Text     = currentUserInfo.User_Id;
                    textBoxContact.Text    = currentUserInfo.Contact;
                    textBoxAddress.Text    = currentUserInfo.Address;
                    textBoxEmail.Text      = currentUserInfo.EMail_Id;
                    textBoxStatus.Text     = currentUserInfo.Status;
                    textBoxVendorName.Text = currentUserInfo.Vendor_Name;
                }catch (Exception ex) { Console.WriteLine("Form load error", ex.StackTrace); }
            }
        }
Example #6
0
 public InventoryManagementForm(object session)
 {
     InitializeComponent();
     inventoryManagementHandler = new InvetoryManagementHandler();
     _userSessionInformation    = (UserInformationProperties)session;
 }
 public ManagerMainWindow(object session)
 {
     InitializeComponent();
     _userSessionInformation = (UserInformationProperties)session;
 }
 public CustomerManagementForm(object sessionData)
 {
     InitializeComponent();
     _userSessionInformation = (UserInformationProperties)sessionData;
 }
 public UserProfileChangeForm(object session)
 {
     InitializeComponent();
     userSessionInformation = (UserInformationProperties)session;
 }
 public NewUserRegistrationForm(object sessionData)
 {
     InitializeComponent();
     userSessionInformation = (UserInformationProperties)sessionData;
 }
 public NewOrdersForm(object session)
 {
     InitializeComponent();
     _userSessionInformation = (UserInformationProperties)session;
     _orderHandler           = new OrderHandler();
 }
 public static bool updateUserInformation(UserInformationProperties userInformation)
 {
     return(userDataHandler.updateUserInfo(userInformation));
 }
 public void addNewUser(UserInformationProperties userInformation, string currentUser)
 {
     com.app.model.UserDBProcessHandler userDbHandler = new UserDBProcessHandler();
     userDbHandler.addUser(userInformation, currentUser);
 }
Example #14
0
 public OrderReturnForm(object session)
 {
     InitializeComponent();
     _userInformationSession = (UserInformationProperties)session;
     orderReturnHandler      = new OrderReturnHandler();
 }