Пример #1
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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
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);
            }
        }
Пример #4
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!");
            }
        }