예제 #1
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";
        }
예제 #2
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();
            }
        }
예제 #3
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);
                }
            }
        }
예제 #4
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();
        }
예제 #5
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();
        }
예제 #6
0
파일: AddFees.cs 프로젝트: Geethanimal/GMS
 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());
             }
         }
     }
 }
예제 #7
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();
            }
        }
예제 #8
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";
            }
        }
예제 #9
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();
            }
        }
예제 #10
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);
     }
 }
예제 #11
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!");
            }
        }