public static bool login(user ExisitingUser, MetroForm ui)
 {
     try
     {
         row = UserDataTable.FindByusername(ExisitingUser.username);
         if (row == null)
         {
             MSG.ERROR(ui, "User Doesn't Exists in the System");
             return(false);
         }
         if ((row.username.ToString() == ExisitingUser.username) && (row.password.ToString() == ExisitingUser.password))
         {
             MSG.SUCCESS(ui, "Login Success.!");
             ui.Hide();
             frm_dashboard n = new frm_dashboard();
             n.ShowDialog();
             ui.Close();
             return(true);
         }
         else
         {
             MSG.ERROR(ui, "Username and Password Doesn't Match!");
             return(false);
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MSG.ERROR(ui, "Login Error.!, " + ex.Message);
         return(false);
     }
 }
 private void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         if ((txt_name.Text == "") || (txt_email.Text == "") || (txt_age.Text == "") || (txt_phone.Text == "") || (txt_address.Text == "") || (txt_proffession.Text == ""))
         {
             MSG.ERROR(this, "Please Enter Required Fields...");
         }
         else
         {
             Customer.name       = txt_name.Text;
             Customer.address    = txt_address.Text;
             Customer.age        = int.Parse(txt_age.Text);
             Customer.email      = txt_email.Text;
             Customer.phone      = txt_phone.Text;
             Customer.profession = txt_proffession.Text;
             Customer.saveCustomer(this);
             MSG.SUCCESS(this, "Customer Saved Successfully...Please Refresh the Customer List to Get Updated One");
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException)
     {
         MSG.ERROR(this, "Can not Save Customer");
     }
 }
 private void btn_select_Click(object sender, EventArgs e)
 {
     try
     {
         Customer.id         = int.Parse(metroGrid1.SelectedRows[0].Cells[0].Value.ToString());
         Customer.name       = metroGrid1.SelectedRows[0].Cells[1].Value.ToString();
         Customer.address    = metroGrid1.SelectedRows[0].Cells[2].Value.ToString();
         Customer.profession = metroGrid1.SelectedRows[0].Cells[3].Value.ToString();
         Customer.age        = int.Parse(metroGrid1.SelectedRows[0].Cells[4].Value.ToString());
         Customer.phone      = metroGrid1.SelectedRows[0].Cells[5].Value.ToString();
         Customer.email      = metroGrid1.SelectedRows[0].Cells[6].Value.ToString();
         if (type == "S")
         {
             this.Hide();
             frm_specs n = new frm_specs();
             n.ShowDialog();
             this.Close();
         }
         else
         {
             this.Hide();
             frm_contactlenses n = new frm_contactlenses();
             n.ShowDialog();
             this.Close();
         }
     }
     catch (Exception)
     {
         MSG.ERROR(this, "No Customers in the System. Please add a customer to continue...");
     }
 }
        private void txt_age_TextChanged(object sender, EventArgs e)
        {
            decimal m;

            if (!decimal.TryParse(txt_age.Text, out m))
            {
                MSG.ERROR(this, "Age should be a Whole Number");
            }
        }
        private void txt_lenseRs_TextChanged(object sender, EventArgs e)
        {
            double m;

            if (!double.TryParse(txt_lenseRs.Text, out m))
            {
                MSG.ERROR(this, "Total Amount must be in numbers");
                txt_lenseRs.Text = "0";
            }
        }
        private void txt_advance_TextChanged(object sender, EventArgs e)
        {
            double m;

            if (!double.TryParse(txt_advance.Text, out m))
            {
                MSG.ERROR(this, "Advance Amount must be in numbers");
                txt_advance.Text = "0";
            }
        }
 private void btn_delete_Click(object sender, EventArgs e)
 {
     try
     {
         frameTableAdapter.DeleteByID(int.Parse(grid_frame.SelectedRows[0].Cells[0].Value.ToString()));
         this.frameTableAdapter.Fill(this.technovisionDataSet.frame);
     }
     catch (Exception exep)
     {
         MSG.ERROR(this, exep.Message.ToString());
     }
 }
 private void btn_next_Click(object sender, EventArgs e)
 {
     if (txt_lenses.Text == "0" || txt_eyeWear.Text == "0" || txt_advance.Text == "0" || txt_total.Text == "0" || txt_balance.Text == "0" || txt_discount.Text == "0")
     {
         MSG.ERROR(this, "Fields can not be empty...");
     }
     else
     {
         NewSpectaclesInvoice.FillFormOne(txt_order.Text, txt_orderdate.Value.ToString("yyyy-MM-dd"), txt_duedate.Value.ToString("yyyy-MM-dd"), double.Parse(txt_eyeWear.Text), double.Parse(txt_lenses.Text), double.Parse(txt_total.Text), cmb_pay_method.Text, cmb_pay_plan.Text, cmb_testedby.Text, double.Parse(txt_advance.Text), double.Parse(txt_discount.Text), double.Parse(txt_balance.Text), cmb_orderStatus.Text, lbl_receiptNo.Text);
         new frm_specs2().Show();
     }
 }
Exemple #9
0
 private void metroTile1_Click(object sender, EventArgs e)
 {
     if (txt_new_pw.Text == txt_confirm_pw.Text)
     {
         user u = new user(txt_userName.Text, txt_nic.Text, txt_phone.Text);
         userController.reset(u, txt_new_pw.Text, this);
     }
     else
     {
         MSG.ERROR(this, "Confirmation Password is not matching...");
     }
 }
 public static bool register(user NewUser, MetroForm ui)
 {
     try
     {
         UserTable.Insert(NewUser.username, NewUser.password, NewUser.fullName, NewUser.nic, NewUser.contactNumber);
         MSG.SUCCESS(ui, "New User Registration Success!");
         return(true);
     }
     catch (MySql.Data.MySqlClient.MySqlException)
     {
         MSG.ERROR(ui, "New User Registration Failed!");
         return(false);
     }
 }
        public static bool reset(user ExisitingUser, string NewPassword, MetroForm ui)
        {
            try
            {
                row = UserDataTable.FindByusername(ExisitingUser.username);
                if (row == null)
                {
                    MSG.ERROR(ui, "Invalid Username...!");
                    return(false);
                }

                else if (row.nic != ExisitingUser.nic)
                {
                    MSG.ERROR(ui, "Invalid NIC...!");
                    return(false);
                }
                else if (row.contactNumber != ExisitingUser.contactNumber)
                {
                    MSG.ERROR(ui, "Invalid Contact Number...!");
                    return(false);
                }
                else if (NewPassword == "")
                {
                    MSG.ERROR(ui, "Password Can not be empty......!");
                    return(false);
                }
                else if (row.username == ExisitingUser.username && row.nic == ExisitingUser.nic && row.contactNumber == ExisitingUser.contactNumber)
                {
                    UserTable.UpdatePasswordByUsername(NewPassword, ExisitingUser.username);
                    MSG.SUCCESS(ui, "Password Reset Success.!");
                    UserDataTable.Clear();
                    UserDataTable = UserTable.GetData();
                    return(true);
                }
                else
                {
                    MSG.ERROR(ui, "Password Reset Error.!");
                    return(false);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MSG.ERROR(ui, "Password Reset Error.Please Try again..." + ex.Message);
                return(false);
            }
        }
 private void frm_contactlenses_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'technovisionDataSet.testers' table. You can move, or remove it, as needed.
     this.testersTableAdapter.Fill(this.technovisionDataSet.testers);
     // TODO: This line of code loads data into the 'technovisionDataSet.testers' table. You can move, or remove it, as needed.
     try
     {
         getNewNumbers();
         cmb_jobType.SelectedIndex     = 0;
         cmb_orderStatus.SelectedIndex = 0;
         cmb_pay_method.SelectedIndex  = 0;
         cmb_pay_plan.SelectedIndex    = 0;
         cmb_testby.SelectedIndex      = 0;
     }
     catch (Exception)
     {
         MSG.ERROR(this, "There are no testers in the system.Add Tester to continue with Errors");
     }
 }
Exemple #13
0
 private void btn_login_Click(object sender, EventArgs e)
 {
     try
     {
         if ((txt_username.Text == "") || (txt_password.Text == ""))
         {
             MSG.ERROR(this, "Username or Password Empty...");
         }
         else
         {
             user u = new user(txt_username.Text, txt_password.Text);
             u.Login(this);
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MSG.ERROR(this, "Can not Login. Please Try Again... " + ex.Message);
     }
 }
 private void btn_next_Click(object sender, EventArgs e)
 {
     if (txt_advRs.Text == "" || txt_balRs.Text == "" || txt_duedate.Text == "" || txt_lenseRs.Text == "" || txt_order_no.Text == "" || txt_orderdate.Text == "")
     {
         MSG.ERROR(this, "Fields cannot be Empty...");
     }
     else
     {
         try
         {
             NewContactLenseInvoice.fillFormOne(txt_order_no.Text, txt_orderdate.Value.ToString("yyyy-MM-dd"), txt_duedate.Value.ToString("yyyy-MM-dd"), cmb_pay_method.Text, cmb_pay_plan.Text, double.Parse(txt_lenseRs.Text), double.Parse(txt_advRs.Text), double.Parse(txt_balRs.Text), cmb_testby.Text, lbl_receiptNo.Text, cmb_jobType.Text, cmb_orderStatus.Text);
             new frm_contactlenses2(this).Show();
             this.Hide();
         }
         catch (Exception)
         {
             MSG.ERROR(this, "Error Orccured");
         }
     }
 }
 private void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_dist_sph_right.Text == "" || txt_dist_cyl_right.Text == "" || txt_dist_axis_right.Text == "" || txt_dist_sph_left.Text == "" || txt_dist_cyl_left.Text == "" || txt_dist_axis_left.Text == "" || txt_add_sph_right.Text == "" || txt_add_cyl_right.Text == "" || txt_add_axis_right.Text == "" || txt_add_sph_left.Text == "" || txt_add_cyl_left.Text == "" || txt_add_axis_left.Text == "" || txt_lense_type.Text == "" || txt_PD.Text == "" || txt_seg_height.Text == "" || txt_specialInc.Text == "" || txt_remarks.Text == "")
         {
             MSG.ERROR(this, "Fields can no be empty.If you want to leave a empty field please put (-) into text fields");
         }
         else
         {
             NewSpectaclesInvoice.FillFormTwo(txt_dist_sph_right.Text, txt_dist_cyl_right.Text, txt_dist_axis_right.Text, txt_dist_sph_left.Text, txt_dist_cyl_left.Text, txt_dist_axis_left.Text, txt_add_sph_right.Text, txt_add_cyl_right.Text, txt_add_axis_right.Text, txt_add_sph_left.Text, txt_add_cyl_left.Text, txt_add_axis_left.Text, txt_lense_type.Text, cmb_frame.Text, txt_PD.Text, txt_seg_height.Text, txt_specialInc.Text, txt_remarks.Text);
             NewSpectaclesInvoice.save(this);
             new frm_orderComplete(Customer.id, NewSpectaclesInvoice.OrderNumber, "SPEC").Show();
         }
     }
     catch (Exception)
     {
         MSG.ERROR(this, "Can not Save Please try again...");
     }
 }
        private void btn_calculate_Click(object sender, EventArgs e)
        {
            if (txt_total.Text == "0")
            {
                MSG.ERROR(this, "Total can not be Zero(0)");
            }
            else if (txt_advance.Text == "")
            {
                txt_advance.Text = "0";
            }

            else if (txt_discount.Text == "")
            {
                txt_discount.Text = "0";
            }

            double sellprice = double.Parse(txt_total.Text) - double.Parse(txt_discount.Text);
            double balance   = sellprice - double.Parse(txt_advance.Text);

            txt_balance.Text = balance.ToString();
        }
 private void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         if (txt_right_old_sph.Text == "" || txt_right_old_cyl.Text == "" || txt_right_old_axis.Text == "" || txt_right_old_add.Text == "" || txt_left_old_sph.Text == "" || txt_left_old_cyl.Text == "" || txt_left_old_axis.Text == "" || txt_left_old_add.Text == "" || txt_left_present_sph.Text == "" || txt_left_present_cyl.Text == "" || txt_left_present_axis.Text == "" || txt_left_present_add.Text == "" || txt_right_present_sph.Text == "" || txt_right_present_cyl.Text == "" || txt_right_present_axis.Text == "" || txt_right_present_add.Text == "" || txt_right_bc.Text == "" || txt_right_pow.Text == "" || txt_right_dia.Text == "" || txt_right_desz.Text == "" || txt_left_bc.Text == "" || txt_left_pow.Text == "" || txt_left_dia.Text == "" || txt_left_desz.Text == "" || txt_trail.Text == "" || txt_refract.Text == "" || txt_special.Text == "" || txt_remarks.Text == "" || txt_kread.Text == "" || txt_blink.Text == "")
         {
             MSG.ERROR(this, "Fields can no be empty.If you want to leave a empty field please put (-) into text fields");
         }
         else
         {
             NewContactLenseInvoice.fillFormTwo(txt_right_old_sph.Text, txt_right_old_cyl.Text, txt_right_old_axis.Text, txt_right_old_add.Text, txt_left_old_sph.Text, txt_left_old_cyl.Text, txt_left_old_axis.Text, txt_left_old_add.Text, txt_left_present_sph.Text, txt_left_present_cyl.Text, txt_left_present_axis.Text, txt_left_present_add.Text, txt_right_present_sph.Text, txt_right_present_cyl.Text, txt_right_present_axis.Text, txt_right_present_add.Text, txt_right_bc.Text, txt_right_pow.Text, txt_right_dia.Text, txt_right_desz.Text, txt_left_bc.Text, txt_left_pow.Text, txt_left_dia.Text, txt_left_desz.Text, txt_trail.Text, txt_refract.Text, txt_special.Text, txt_remarks.Text, txt_kread.Text, txt_blink.Text);
             NewContactLenseInvoice.save(this);
             new frm_orderComplete(Customer.id, NewContactLenseInvoice.OrderNumber, "LENSE").Show();
             contactLense.Close();
             this.Close();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException)
     {
         MSG.ERROR(this, "Can not Save Please try again...");
     }
 }
 private void metroTile4_Click(object sender, EventArgs e)
 {
     MSG.ERROR(this, "Backup will be enabled in the next Build");
 }