private void frmPOS_Load(object sender, EventArgs e) { lblBalance.Text = "0"; label4.Text = DateTime.Now.ToLongTimeString(); // show the durrent time lblDate.Text = DateTime.Now.ToLongDateString(); // show the current date timer1.Start(); // Start time lblName.Text = ""; lblCategory.Text = ""; lblVendor.Text = ""; lblDescription.Text = ""; txtItemCode.Select(); label4.Text = DateTime.Now.ToLongTimeString(); // show the durrent time lblDate.Text = DateTime.Now.ToShortDateString(); // show the current date timer1.Start(); // Start time frmDashboard add = new frmDashboard(Model); ListViewItem item = new ListViewItem(); List <string> data = add.GetData(); item.Text = data[0]; item.SubItems.Add(data[1]); item.SubItems.Add(data[2]); //item.SubItems.Add(data[3]); listPos.Items.Add(item); }
private void btnLogin_Click(object sender, EventArgs e) { try { bool validUser = Model.login(txtUsername.Text, txtPassword.Text); if (validUser) { string username = Model.getUserNameForCurrentuser(); string usertype = Model.getUserTypeForCurrentuser(); if (usertype == "Sales") { frmDashboardAssistantView dashboardSales = new frmDashboardAssistantView(Model); dashboardSales.RefToLogin = this; this.Visible = false; txtUsername.Text = ""; txtPassword.Text = ""; dashboardSales.Show(); // show dashboard dashboardSales.ShowUserName(usertype, username); //call ShowUserName method } else { frmDashboard dashboard = new frmDashboard(Model); dashboard.RefToLogin = this; this.Visible = false; txtUsername.Text = ""; txtPassword.Text = ""; dashboard.Show(); // show dashboard dashboard.ShowUserName(usertype, username); //call ShowUserName method } //frmDashboard dashboard = new frmDashboard(Model);//create a dashboard object } else { MessageBox.Show("It appears your UserName or Password is incorrect! Please try again!", "PHARMACY MANAGEMENT SYSTEM - Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { MessageBox.Show("It appears your UserName or Password is incorrect! Please try again!", "PHARMACY MANAGEMENT SYSTEM - Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } DateTime timeNow = DateTime.Now; Model.addNewLog(timeNow, "Login", idOfCurrentUser, "Logged in"); }