Example #1
0
        public static void CREATE_JECBASCO()
        {
            Employee emps = new Employee();

               emps.empid = "0039";
               emps.fname = "Jose Jericho";
               emps.lname = "Basco";
               emps.mname = "Astillero";
               emps.gender = "Male";
               emps.birthdate = DateTime.Now;

               emps.contactno = "09064418634";
               emps.address = "Basud, Tabaco City";
               emps.position = "IT-Programmer";
               emps.basic_pay = Convert.ToDecimal("10826.00");
               emps.date_hired = DateTime.Now;
               emps.emp_status = "Regular";
               emps.branch = "1";
               emps.tinno = "";

               //if (pbEmpPic.Image != null)
               //{
               //    long filesize;
               //    MemoryStream mstream = new MemoryStream();
               //    pbEmpPic.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg);
               //    Byte[] arrImage = mstream.GetBuffer();
               //    filesize = mstream.Length;
               //    emps.pic = arrImage;
               //}

               emps.password = "******";

               if (emps.save())
               {
               MessageBox.Show("Okey");
               }
               else
               {
               MessageBox.Show("Error :" + db.err.Message);
               }
        }
Example #2
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            Employee emp = new Employee();
                emp.empid = txtid.Text;
                emp.fname= txtfname.Text;
                emp.lname = txtlname.Text;
                emp.mname = txtmname.Text;
                emp.gender = cbogender.Text;
                emp.birthdate = dtBday.Value;
                emp.contactno = txtcontactno.Text;
                emp.address = txtaddress.Text;
                emp.position = cbopositions.Text;
                emp.basic_pay = Convert.ToDecimal(txtbasicpay.Text);
                emp.date_hired = dtemploymentdate.Value;
                emp.emp_status = cboemploymentstatus.Text;
                string[] branchid = cbobranch.Text.Split('-');
                emp.branch = branchid[0];
                emp.tinno = txttinno.Text;
                emp.position = cbopositions.Text;
                emp.password = "******";

                if (pbEmpPic.Image != null){
                    long filesize;
                    MemoryStream mstream = new MemoryStream();
                    pbEmpPic.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    Byte[] arrImage = mstream.GetBuffer();
                    filesize = mstream.Length;
                    emp.pic = arrImage;
                }

                if (emp.save()) {
                    MessageBox.Show("Successful", "Saving...", MessageBoxButtons.OK,MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    this.Parent.Height = 0;
                    this.Parent.Controls.Clear();
                    this.Dispose();
                }
                else{
                    Logger.WriteErrorLog(db.err.ToString());
                    MessageBox.Show("Error : " + db.err.ToString() , "Saving...", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
        }