Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            userControl11.inputs_ftl_1();
            ft_login_form21.input_ftl_2();
            string Username, Company_Name, Password, Password_hint, pin_Number;

            Username      = userControl11.username;
            Company_Name  = userControl11.companyname;
            Password      = ft_login_form21.password;
            Password_hint = ft_login_form21.passwordhint;
            pin_Number    = ft_login_form21.pinnumber;

            DB_Connection dB_Connection = new DB_Connection();
            string        qry           = "INSERT INTO Usertb (Username,Company_Name,Password,Password_hint,Pin_Number) VALUES ('" + Username + "','" + Company_Name + "','" + Password + "','" + Password_hint + "','" + pin_Number + "')";
            string        qry2          = "Select * From Usertb";

            dB_Connection.InsertData(qry);
            DataTable dt = dB_Connection.getDataGrid(qry2);

            if (dt.Rows.Count != 0)
            {
                GMS_1v gMS_1V = new GMS_1v();
                gMS_1V.ShowDialog();
                Console.WriteLine(qry);
            }
        }
Esempio n. 2
0
        private void checklogin(string qry)
        {
            try
            {
                DB_Connection dB_Connection = new DB_Connection();

                DataTable dt = dB_Connection.getDataGrid(qry);
                if (dt.Rows.Count == 1)
                {
                    GMS_1v gMS_1V = new GMS_1v();

                    gMS_1V.Show();
                    ((Form)this.TopLevelControl).Hide();
                }
                else
                {
                    MessageBox.Show("Your Username or Password is incorrect! Check your username , password and try again!");
                    Username_tb_lg.Text = "";
                    Password_tb_lg.Text = "";
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void FillGridView(string qry)
        {
            string        members_qry   = "SELECT * FROM Members";
            DB_Connection dB_Connection = new DB_Connection();

            dataGridViewpackages.DataSource = dB_Connection.getDataGrid(qry);
        }
Esempio n. 4
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Are you sure that you want to update this member ?");
            string NIC_forqr  = textBoxNIC.Text;
            string Name_forqr = textboxName.Text;
            string mail_db    = memEmail_tb.Text;

            Id = textbox_Members_Id.Text;
            string NIC                      = textBoxNIC.Text;
            string name                     = textboxName.Text;
            string Gender                   = textboxGender.Text;
            string Body_Type                = textboxBodyType.Text;
            string Email                    = memEmail_tb.Text;
            string Address                  = richTextBoxAddress.Text;
            string Mobile_Number            = textboxMobileNumber.Text;
            string Health_Condition         = richTextBoxHealthCondition.Text;
            string Emergency_Contact_Name   = textboxEmergencyContactName.Text;
            string Emergency_Contact_Number = (textboxEmergencyContactPhoneNumber.Text);
            string qrimgpath                = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Images\\Member QR\\" + Id + "memQR.jpg";

            DB_Connection dB_Connection = new DB_Connection();
            string        query         = "UPDATE Members SET NICorDL='" + NIC + "', MemberName='" + name + "' , Gender='" + Gender + "' , Body_Type='" + Body_Type + "' , Address='" + Address + "' , Mobile_Number='" + Mobile_Number + "' , Health_Condition='" + Health_Condition + "' , Emergency_Contact_Name='" + Emergency_Contact_Name + "' , Emergency_Contact_Number='" + Emergency_Contact_Number + "', Member_dp='" + Member_dp_path + "' , Email = '" + Email + "' , QR_img_path='" + qrimgpath + "' WHERE Id='" + Id + "'";

            dB_Connection.update(query);


            if (NIC_forqr != NIC || Name_forqr != name || Email != mail_db)
            {
                QRmailSender qRmailSender = new QRmailSender();
                string       qrsubject    = (Id.ToString() + NIC + name).ToString();
                qRmailSender.qrgen(qrsubject, qrimgpath);
                qRmailSender.Emailgen(name, "member");
                qRmailSender.Emailsend(Email, qrimgpath);
            }
        }
Esempio n. 5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Are you sure that you want to Delete this member details ?");
            Id = textbox_Staff_Members_Id.Text;
            DB_Connection dB_Connection = new DB_Connection();
            string        query         = "DELETE FROM Staff_Member Where Id='" + Id + "'";

            dB_Connection.Delete(query);
        }
Esempio n. 6
0
        private void btnDelete_emod_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Are you sure that you want to Delete this Equipment details ?");
            equipId = txtmodeid.Text;
            DB_Connection dB_Connection = new DB_Connection();
            string        query         = "DELETE FROM Equipment Where Equip_ID='" + equipId + "'";

            dB_Connection.Delete(query);
        }
Esempio n. 7
0
        public void Emailgen(string name, string type)
        {
            DB_Connection dB_Connection = new DB_Connection();
            string        qry           = "Select Company_Name from Usertb";
            SqlDataReader dr            = dB_Connection.getData(qry);

            dr.Read();
            subject = dr["Company_Name"].ToString();
            body    = "Welcome to " + subject + " Hi " + name + "!" + " You are now " + type + " of " + subject + "Now you can mark your attendence using this QR code";
        }
Esempio n. 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name  = txtequipname.Text;
            string type  = txtequiptype.Text;
            string price = txtamount.Text;

            DB_Connection dB_Connection = new DB_Connection();
            string        insertqry     = "INSERT INTO Equipment (Equip_Name,Equip_Type,Equip_Amount,Equip_img1,Equip_img2,Equip_img3,Equip_img4) VALUES('" + name + "','" + type + "','" + price + "','" + equip_imgpath1 + "','" + equip_imgpath2 + "','" + equip_imgpath3 + "','" + equip_imgpath4 + "')";

            Console.WriteLine(insertqry);
            dB_Connection.InsertData(insertqry);
        }
Esempio n. 9
0
 private void textbox_Members_Id_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (textbox_Members_Id.Text != "")
         {
             try
             {
                 Id = textbox_Members_Id.Text;
                 int           id            = int.Parse(textbox_Members_Id.Text);
                 DB_Connection dB_Connection = new DB_Connection();
                 SqlConnection con           = new SqlConnection(dB_Connection.connectionstring);
                 con.Open();
                 string     qry = "SELECT * FROM Members Where Id=@Id ";
                 SqlCommand cmd = new SqlCommand(qry, con);
                 cmd.Parameters.AddWithValue("@Id", id);
                 SqlDataReader da = dB_Connection.getDatausing_a(cmd);
                 if (da.HasRows)
                 {
                     while (da.Read())
                     {
                         textBoxNIC.Text                         = da.GetValue(1).ToString();
                         textboxName.Text                        = da.GetValue(2).ToString();
                         textboxGender.Text                      = da.GetValue(4).ToString();
                         textboxBodyType.Text                    = da.GetValue(5).ToString();
                         richTextBoxAddress.Text                 = da.GetValue(6).ToString();
                         textboxMobileNumber.Text                = da.GetValue(7).ToString();
                         richTextBoxHealthCondition.Text         = da.GetValue(8).ToString();
                         textboxEmergencyContactName.Text        = da.GetValue(9).ToString();
                         textboxEmergencyContactPhoneNumber.Text = da.GetValue(10).ToString();
                         pictureBox1.Image                       = new Bitmap(da.GetValue(11).ToString());
                         Member_dp_path   = da.GetValue(11).ToString();
                         memEmail_tb.Text = da.GetValue(12).ToString();
                     }
                     con.Close();
                 }
                 else
                 {
                     MessageBox.Show("There is no member by member id:" + id + "\nTry again with another Id");
                 }
             }
             catch (SqlException ex)
             {
                 MessageBox.Show(ex.ToString());
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
         }
     }
 }
Esempio n. 10
0
        public reset_admin()
        {
            InitializeComponent();
            string        idqry         = "SELECT * FROM Usertb WHERE Id = (SELECT MAX(Id) from Usertb ) ";
            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(idqry);

            if (dr.HasRows)
            {
                dr.Read();
                string id = dr["Id"].ToString();
            }
        }
Esempio n. 11
0
        private void btnupdate_emod_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Are you sure that you want to update this Equipment ?");
            equipId = txtmodeid.Text;
            string Name   = txtmodename.Text;
            string Type   = txtmodetype.Text;
            string Amount = txtmodeamount.Text;

            DB_Connection dB_Connection = new DB_Connection();
            string        query         = "UPDATE Equipment SET Equip_Name='" + Name + "', Equip_Type='" + Type + "', Equip_Amount='" + Amount + "', Equip_img1='" + equip_imgpath1 + "',Equip_img2='" + equip_imgpath2 + "',Equip_img3='" + equip_imgpath3 + "',Equip_img4='" + equip_imgpath4 + "' WHERE Equip_ID='" + equipId + "'";

            dB_Connection.update(query);
        }
Esempio n. 12
0
        private void fillpackagecombo()
        {
            string        qry           = "Select * from Packages";
            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(qry);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    string pack_name = dr["Package_Name"].ToString();
                    Package_cb.Items.Add(pack_name);
                }
            }
        }
Esempio n. 13
0
        private void dataGridView_Equipments_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Equipment_View_dialoguebox eVD = new Equipment_View_dialoguebox();

            dataGridView_Equipments.CurrentRow.Selected = true;
            string id = dataGridView_Equipments.Rows[e.RowIndex].Cells["Equip_ID"].Value.ToString();

            eVD.lbl_eid.Text    = dataGridView_Equipments.Rows[e.RowIndex].Cells["Equip_ID"].Value.ToString();
            eVD.lbl_ename.Text  = dataGridView_Equipments.Rows[e.RowIndex].Cells["Equip_Name"].Value.ToString();
            eVD.lbl_etype.Text  = dataGridView_Equipments.Rows[e.RowIndex].Cells["Equip_Type"].Value.ToString();
            eVD.lbl_eprice.Text = dataGridView_Equipments.Rows[e.RowIndex].Cells["Equip_Amount"].Value.ToString();


            string qry = "SELECT Equip_img1,Equip_img2,Equip_img3,Equip_img4 From Equipment Where Equip_ID = '" + id + "' ";

            Console.WriteLine(qry);
            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(qry);

            if (dr.HasRows)
            {
                dr.Read();

                string Equip_img1 = dr["Equip_img1"].ToString();
                string Equip_img2 = dr["Equip_img2"].ToString();
                string Equip_img3 = dr["Equip_img3"].ToString();
                string Equip_img4 = dr["Equip_img4"].ToString();

                if (Equip_img1 != null)
                {
                    eVD.equippicbox1.Image = new Bitmap(Equip_img1);
                }
                if (Equip_img2 != null)
                {
                    eVD.equippicbox2.Image = new Bitmap(Equip_img2);
                }
                if (Equip_img3 != null)
                {
                    eVD.equippicbox3.Image = new Bitmap(Equip_img3);
                }
                if (Equip_img4 != null)
                {
                    eVD.equippicbox4.Image = new Bitmap(Equip_img4);
                }
            }

            eVD.ShowDialog();
        }
Esempio n. 14
0
        private void btnAP_Add_Click(object sender, EventArgs e)
        {
            string package_name, duration, fee, qry;

            package_name = Package_Name_tb.Text;
            duration     = Duration_tb.Text;
            fee          = Fee_tb.Text;
            qry          = "INSERT INTO Packages(Package_Name,Duration,Fee) VALUES('" + package_name + "','" + duration + "','" + fee + "')";
            DB_Connection dB_Connection = new DB_Connection();
            DialogResult  dialog        = MessageBox.Show("Are you sure that you want to add this package?", "Add Package", MessageBoxButtons.YesNo);

            if (dialog == DialogResult.Yes)
            {
                dB_Connection.InsertData(qry);
            }
        }
Esempio n. 15
0
        private void dataGridView_StaffMembers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Staff_Member_View_dialogbox smv_d = new Staff_Member_View_dialogbox();

            dataGridView_StaffMembers.CurrentRow.Selected = true;

            smv_d.lbl_smid_v.Text = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Id"].Value.ToString();
            string id = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Id"].Value.ToString();

            string qry = "Select Capture_path,QR_img_path from Staff_Member Where Id='" + id + "'";

            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(qry);

            dr.Read();

            string Capture_path = dr["Capture_path"].ToString();
            string QR_img_path  = dr["QR_img_path"].ToString();


            if (Capture_path != null || Capture_path != "")
            {
                smv_d.Staff_member_dp_picturebox.Image = new Bitmap(Capture_path);
            }

            if (QR_img_path != null)
            {
                smv_d.Staff_member_qr_picturebox.Image = new Bitmap(QR_img_path);
            }

            smv_d.lbl_nod_v.Text    = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["NIC"].Value.ToString();
            smv_d.lbl_smn_v.Text    = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Name"].Value.ToString();
            smv_d.lbl_jt_v.Text     = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Job_Type"].Value.ToString();
            smv_d.lbl_pq_v.Text     = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Professional_qualifications"].Value.ToString();
            smv_d.lbl_dob_v.Text    = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["DOB"].Value.ToString();
            smv_d.lbl_jd_v.Text     = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Joined_date"].Value.ToString();
            smv_d.lbl_al_v.Text     = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Address_living"].Value.ToString();
            smv_d.lbl_mnpu_v.Text   = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Mobile_no_public"].Value.ToString();
            smv_d.lbl_mnpri_v.Text  = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Mobile_no_private"].Value.ToString();
            smv_d.lbl_ha_v.Text     = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Home_address"].Value.ToString();
            smv_d.lbl_ecnum_v.Text  = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Emergency_Contact_Name"].Value.ToString();
            smv_d.lbl_ecn_v.Text    = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Emergency_Contact_Number"].Value.ToString();
            smv_d.lbl_mail_v.Text   = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Email"].Value.ToString();
            smv_d.lbl_gender_v.Text = dataGridView_StaffMembers.Rows[e.RowIndex].Cells["Gender"].Value.ToString();
            smv_d.ShowDialog();
        }
Esempio n. 16
0
 private void textBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (memberid_tb.Text != "")
         {
             try
             {
                 int           id            = int.Parse(memberid_tb.Text);
                 DB_Connection dB_Connection = new DB_Connection();
                 SqlConnection con           = new SqlConnection(dB_Connection.connectionstring);
                 con.Open();
                 string     qry = "SELECT * FROM Members Where Id=@Id ";
                 SqlCommand cmd = new SqlCommand(qry, con);
                 cmd.Parameters.AddWithValue("@Id", id);
                 SqlDataReader da = dB_Connection.getDatausing_a(cmd);
                 if (da.HasRows)
                 {
                     while (da.Read())
                     {
                         lbl_mname.Text        = da.GetValue(2).ToString();
                         lbl_package_name.Text = da.GetValue(15).ToString();
                         string        qrypack        = "Select * From Packages where Package_Name='" + lbl_package_name.Text + "'";
                         DB_Connection dB_Connection1 = new DB_Connection();
                         SqlDataReader da2            = dB_Connection1.getData(qrypack);
                         da2.Read();
                         lbl_fee.Text = da2["Fee"].ToString();
                     }
                     con.Close();
                 }
                 else
                 {
                     MessageBox.Show("There is no Staff Member by member id:" + id + "\nTry again with another Id");
                 }
             }
             catch (SqlException ex)
             {
                 MessageBox.Show(ex.ToString());
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
         }
     }
 }
Esempio n. 17
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string type         = "StaffMember";
            string NIC_No       = txt_boxNIC.Text;
            string name         = txt_boxName.Text;
            string Dob          = this.dateTimePickerDOB.Text;
            string joinDte      = this.dateTimePickerJoinedDate.Text;
            string jobType      = txt_boxJobtype.Text;
            string homeAdrss    = txt_boxHomeAddress.Text;
            string Adrs_Lvg     = txt_boxAddressLivg.Text;
            string PrivtNo      = txt_boxPN.Text;
            string PubNo        = txt_boxPubN.Text;
            string EmergConName = txt_boxEmergencyContactNme.Text;
            string EmergConNo   = (txt_boxEmergencyContactPNo.Text);
            string ProQuli      = txt_boxProQuli.Text;
            string Gendr        = txt_boxGender.Text;
            string Email        = txt_boxMail.Text;
            string qrimgpath    = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Images\\Staff QR\\" + staffmem_id + "memQR.jpg";
            string qrsubject    = (staffmem_id + NIC_No + name).ToString();

            DB_Connection dB_Connection = new DB_Connection();
            string        insrtqry      = "INSERT INTO Staff_Member (Capture_path,QR_img_path,NIC,Name,Gender,Job_Type,Professional_qualifications,DOB,Joined_date,Address_Living,Mobile_no_public,Mobile_no_private,Home_Address,Emergency_Contact_Name,Emergency_Contact_Number,Email) VALUES('" + staffmem_imgpath + "','" + NIC_No + "','" + name + "','" + Gendr + "','" + jobType + "','" + ProQuli + "','" + Dob + "','" + joinDte + "','" + Adrs_Lvg + "','" + PubNo + "','" + PrivtNo + "','" + homeAdrss + "','" + EmergConName + "','" + EmergConNo + "','" + Email + "' )";

            Console.WriteLine(insrtqry);
            dB_Connection.InsertData(insrtqry);
            QRmailSender qRmailSender = new QRmailSender();

            qRmailSender.qrgen(qrsubject, qrimgpath);
            if (Email != null)
            {
                DialogResult dialog = MessageBox.Show("This Staff member has not provided an Email Address! So, You can print the QR code. Do you want to print it ?", "Print QR Code", MessageBoxButtons.YesNo);
                if (dialog == DialogResult.Yes)
                {
                    string filename = qrimgpath;
                    var    p        = new Process();
                    p.StartInfo.FileName = filename;
                    p.StartInfo.Verb     = "print";
                    p.Start();
                }
            }
            else
            {
                qRmailSender.Emailgen(name, type);
                qRmailSender.Emailsend(Email, qrimgpath);
            }
        }
Esempio n. 18
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Are you sure that you want to change this?", "Reset Administrator", MessageBoxButtons.YesNo);

            if (dialog == DialogResult.Yes)
            {
                string Username      = un_tb.Text;
                string Company_name  = cn_tb.Text;
                string Password      = p_tb.Text;
                string Password_Hint = ph_tb.Text;
                string Pin_Number    = pn_tb.Text;
                string Email         = e_tb.Text;

                string        qry           = "UPDATE Usertb SET Username='******', Company_Name='" + Company_name + "', Password='******', Password_Hint='" + Pin_Number + "' WHERE Id='" + id + "'";
                DB_Connection dB_Connection = new DB_Connection();
                dB_Connection.update(qry);
            }
        }
Esempio n. 19
0
        public Addstaff()
        {
            InitializeComponent();
            string        idqry         = "SELECT * FROM Staff_Member WHERE Id = (SELECT MAX(Id) from Staff_Member ) ";
            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(idqry);

            if (dr.HasRows)
            {
                dr.Read();
                string num   = dr["Id"].ToString();
                int    num_1 = int.Parse(num);
                labelSMID.Text = "Member id : " + (num_1 + 1).ToString();
                staffmem_id    = num_1 + 1;
            }
            else
            {
                labelSMID.Text = 1.ToString();
            }
        }
Esempio n. 20
0
        public AddEquipments()
        {
            InitializeComponent();

            string        idqry         = "SELECT * FROM Equipment WHERE Equip_ID = (SELECT MAX(Equip_ID) from Equipment ) ";
            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(idqry);

            if (dr.HasRows)
            {
                dr.Read();
                string num   = dr["Equip_ID"].ToString();
                int    num_1 = int.Parse(num);
                labelEID.Text = (num_1 + 1).ToString();
                equip_id      = num_1 + 1;
            }
            else
            {
                labelEID.Text = "1";
            }
        }
Esempio n. 21
0
        public AddMembers()
        {
            InitializeComponent();
            fillpackagecombo();
            Gender_cb.Items.AddRange(new object[] { "Male", "Female" });
            string        idqry         = "SELECT * FROM Members WHERE Id = (SELECT MAX(Id) from Members ) ";
            DB_Connection dB_Connection = new DB_Connection();
            SqlDataReader dr            = dB_Connection.getData(idqry);

            if (dr.HasRows)
            {
                dr.Read();
                string num   = dr["Id"].ToString();
                int    num_1 = int.Parse(num);
                labelMID.Text = "Member id : " + (num_1 + 1).ToString();
                mem_id        = num_1 + 1;
            }
            else
            {
                labelMID.Text = 1.ToString();
            }
        }
Esempio n. 22
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Are you sure that you want to update this member ?");
            Id = textbox_Staff_Members_Id.Text;
            string NIC_forqr        = textBoxNIC.Text;
            string Name_forqr       = textboxName.Text;
            string NIC              = textBoxNIC.Text;
            string Name             = textboxName.Text;
            string JobType          = textboxJobType.Text;
            string p_qualifications = txt_boxProQuli.Text;


            string Address_living       = txt_boxAddressLivg.Text;
            string PN_private           = txt_boxPN_private.Text;
            string PN_public            = txt_boxPubN.Text;
            string Home_Address         = home_Address_tb.Text;
            string EmergencyContactName = txt_boxEmergencyContactNme.Text;
            string EmergencyContactPN   = txt_boxEmergencyContactPNo.Text;
            string Email     = txt_boxMail.Text;
            string Gender    = txt_boxGender.Text;
            string qrimgpath = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Images\\Member QR\\" + Id + "memQR.jpg";

            DB_Connection dB_Connection = new DB_Connection();
            string        query         = "UPDATE Staff_Member SET Capture_path ='" + Staff_Member_dp_path + "', QR_img_path='" + qrimgpath + "', NIC = '" + NIC + "', Name = '" + Name + "' , Job_Type='" + JobType + "', Professional_qualifications='" + p_qualifications + "', Address_living='" + Address_living + "', Mobile_no_public='" + PN_public + "', Mobile_no_private='" + PN_private + "', Home_address='" + Email + "', Emergency_Contact_Name='" + EmergencyContactName + "', Emergency_Contact_Number='" + EmergencyContactPN + "', Email='" + Email + "', Gender='" + Gender + "' ";

            dB_Connection.update(query);

            QRmailSender qRmailSender = new QRmailSender();

            if (NIC_forqr != NIC || Name_forqr != Name || Email != mail_db)
            {
                string qrsubject = (Id.ToString() + NIC + Name).ToString();

                qRmailSender.qrgen(qrsubject, qrimgpath);
                qRmailSender.Emailgen(Name, "member");
                qRmailSender.Emailsend(Email, qrimgpath);
            }
        }
Esempio n. 23
0
 private void btn_show_pwhint_Click(object sender, EventArgs e)
 {
     try
     {
         DB_Connection dB_Connection = new DB_Connection();
         string        qry           = "Select Password_Hint From Usertb";
         SqlDataReader dr            = dB_Connection.getData(qry);
         if (dr.HasRows)
         {
             dr.Read();
             pw_hint_lbl.Text = "Password Hint is : " + dr["Password_Hint"].ToString();
             pw_hint_lbl.Show();
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 24
0
        public Login()
        {
            InitializeComponent();
            DB_Connection dB_Connection = new DB_Connection();
            string        qry           = "Select * from Usertb";
            DataTable     dt            = dB_Connection.getDataGrid(qry);

            if (dt.Rows.Count != 0)
            {
                loginForm1.Show();
            }
            else
            {
                this.panel1.Controls.Clear();
                ft_wrapper ft_Wrapper = new ft_wrapper()
                {
                    Dock = DockStyle.Fill, TopLevel = false, TopMost = true
                };
                ft_Wrapper.FormBorderStyle = FormBorderStyle.None;
                this.panel1.Controls.Add(ft_Wrapper);
                ft_Wrapper.Show();
            }
        }
Esempio n. 25
0
        private void FillGridView(string qry)
        {
            DB_Connection dB_Connection = new DB_Connection();

            dataGridView_Members.DataSource = dB_Connection.getDataGrid(qry);
        }
Esempio n. 26
0
        private void button1_Click(object sender, EventArgs e)
        {
            string type                     = "Member";
            string NIC                      = textBoxNIC.Text;
            string name                     = textboxName.Text;
            string DOB                      = this.dateTimePicker1.Text;
            string Gender                   = Gender_cb.Text;
            string Body_Type                = textboxBodyType.Text;
            string Address                  = richTextBoxAddress.Text;
            string Mobile_Number            = textboxMobileNumber.Text;
            string Health_Condition         = richTextBoxHealthCondition.Text;
            string Emergency_Contact_Name   = textboxEmergencyContactName.Text;
            string Emergency_Contact_Number = (textboxEmergencyContactPhoneNumber.Text);
            string joineddate               = DateTime.Now.Date.ToString("MM/dd/yyyy");
            string Email                    = memEmail_tb.Text;
            string qrimgpath                = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Images\\Member QR\\" + mem_id + "memQR.jpg";

            Console.WriteLine(qrimgpath);
            string packageName = Package_cb.Text;
            string qrsubject   = (mem_id + NIC + name).ToString();

            if (packageName != "")
            {
                //Insert Data to members table
                DB_Connection dB_Connection = new DB_Connection();
                string        insertqry     = "INSERT INTO Members(NICorDL,MemberName,DOB,Gender,Body_Type,Address,Mobile_Number,Health_Condition,Emergency_Contact_Name,Emergency_Contact_Number,Member_dp,Email,QR_img_path,Joined_Date,Package_name) VALUES('" + NIC + "','" + name + "','" + DOB + "','" + Gender + "','" + Body_Type + "','" + Address + "'," + Mobile_Number + ",'" + Health_Condition + "','" + Emergency_Contact_Name + "','" + Emergency_Contact_Number + "','" + mem_imgpath + "','" + Email + "','" + qrimgpath + "','" + joineddate + "','" + packageName + "')";
                dB_Connection.InsertData(insertqry);

                //get data from package table
                DB_Connection dB_Connection1 = new DB_Connection();
                string        qrypack        = "Select * From Packages where Package_Name='" + packageName + "'";
                SqlDataReader da2            = dB_Connection1.getData(qrypack);
                da2.Read();

                //calculation
                string   amount = da2["Fee"].ToString();
                DateTime date   = DateTime.Now.Date;
                string   days   = da2["Duration"].ToString();
                Console.WriteLine(date.AddDays(int.Parse(days)));
                string due_date = date.AddDays(int.Parse(days)).ToString("MM/dd/yyyy");

                //Insert Data to Payments table
                DB_Connection dB_Connection2 = new DB_Connection();
                string        qryinsertpay   = "INSERT INTO Payment(mem_id,Name,package,due_date,amount,paid) VALUES('" + mem_id + "','" + name + "','" + packageName + "','" + due_date + "','" + amount + "','0')";
                Console.WriteLine(qryinsertpay);
                dB_Connection2.InsertData(qryinsertpay);

                QRmailSender qRmailSender = new QRmailSender();
                qRmailSender.qrgen(qrsubject, qrimgpath);

                if (Email != null)
                {
                    DialogResult dialog = MessageBox.Show("This member has not provided an Email Address! So, You can print the QR code. Do you want to print it ?", "Print QR Code", MessageBoxButtons.YesNo);
                    if (dialog == DialogResult.Yes)
                    {
                        string filename = qrimgpath;
                        var    p        = new Process();
                        p.StartInfo.FileName = filename;
                        p.StartInfo.Verb     = "print";
                        p.Start();
                    }
                }
                else
                {
                    qRmailSender.Emailgen(name, type);
                    qRmailSender.Emailsend(Email, qrimgpath);
                }
            }
            else
            {
                MessageBox.Show("Select package or check if you have added packages to the system!", "Warning!");
            }
        }
Esempio n. 27
0
        private void txtmodeid_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (txtmodeid.Text != "")
                {
                    try
                    {
                        equipId = txtmodeid.Text;
                        int           id            = int.Parse(txtmodeid.Text);
                        DB_Connection dB_Connection = new DB_Connection();
                        SqlConnection con           = new SqlConnection(dB_Connection.connectionstring);
                        con.Open();
                        string     qry = "SELECT * FROM Equipment Where Equip_ID=@Id ";
                        SqlCommand cmd = new SqlCommand(qry, con);
                        cmd.Parameters.AddWithValue("@Id", id);
                        SqlDataReader da = dB_Connection.getDatausing_a(cmd);
                        if (da.HasRows)
                        {
                            while (da.Read())
                            {
                                txtmodename.Text   = da.GetValue(1).ToString();
                                txtmodetype.Text   = da.GetValue(2).ToString();
                                txtmodeamount.Text = da.GetValue(3).ToString();

                                if (da.GetValue(5).ToString() != null)
                                {
                                    picbmodequip1.Image = new Bitmap(da.GetValue(5).ToString());
                                    equip_imgpath1      = da.GetValue(5).ToString();
                                }
                                if (da.GetValue(6).ToString() != null)
                                {
                                    picbmodequip2.Image = new Bitmap(da.GetValue(6).ToString());
                                    equip_imgpath2      = da.GetValue(6).ToString();
                                }
                                if (da.GetValue(7).ToString() != null)
                                {
                                    picbmodequip3.Image = new Bitmap(da.GetValue(7).ToString());
                                    equip_imgpath3      = da.GetValue(7).ToString();
                                }
                                if (da.GetValue(8).ToString() != null)
                                {
                                    picbmodequip4.Image = new Bitmap(da.GetValue(8).ToString());
                                    equip_imgpath4      = da.GetValue(8).ToString();
                                }
                            }
                            con.Close();
                        }
                        else
                        {
                            MessageBox.Show("There is no Equipment by id:" + id + "\nTry again with another Id");
                        }
                    }
                    catch (SqlException ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
        }
Esempio n. 28
0
        private void textbox_Members_Id_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (textbox_Staff_Members_Id.Text != "")
                {
                    try
                    {
                        Id = textbox_Staff_Members_Id.Text;
                        int           id            = int.Parse(textbox_Staff_Members_Id.Text);
                        DB_Connection dB_Connection = new DB_Connection();
                        SqlConnection con           = new SqlConnection(dB_Connection.connectionstring);
                        con.Open();
                        string     qry = "SELECT * FROM Staff_Member Where Id=@Id ";
                        SqlCommand cmd = new SqlCommand(qry, con);
                        cmd.Parameters.AddWithValue("@Id", id);
                        SqlDataReader da = dB_Connection.getDatausing_a(cmd);
                        if (da.HasRows)
                        {
                            while (da.Read())
                            {
                                textBoxNIC.Text     = da.GetValue(3).ToString();
                                textboxName.Text    = da.GetValue(4).ToString();
                                textboxJobType.Text = da.GetValue(5).ToString();
                                txt_boxProQuli.Text = da.GetValue(6).ToString();


                                txt_boxAddressLivg.Text         = da.GetValue(9).ToString();
                                txt_boxPN_private.Text          = da.GetValue(10).ToString();
                                txt_boxPubN.Text                = da.GetValue(11).ToString();
                                home_Address_tb.Text            = da.GetValue(12).ToString();
                                txt_boxEmergencyContactNme.Text = da.GetValue(13).ToString();
                                txt_boxEmergencyContactPNo.Text = da.GetValue(14).ToString();
                                txt_boxMail.Text                = da.GetValue(15).ToString();
                                mail_db            = da.GetValue(15).ToString();
                                txt_boxGender.Text = da.GetValue(16).ToString();

                                if (da.GetValue(1).ToString() != "")
                                {
                                    pictureBox1.Image    = new Bitmap(da.GetValue(1).ToString());
                                    Staff_Member_dp_path = da.GetValue(1).ToString();
                                }
                            }
                            con.Close();
                        }
                        else
                        {
                            MessageBox.Show("There is no Staff Member by member id:" + id + "\nTry again with another Id");
                        }
                    }
                    catch (SqlException ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
        }