예제 #1
0
        public void btnSave_Click(object sender, EventArgs e)

        {
            if (validation() == true)

            {
                obj.name          = txName.Text;
                obj.Address       = txAddress.Text;
                obj.state         = cmbState.Text;
                obj.Desigination  = cmbDesignation.Text;
                obj.email         = txmail.Text;
                obj.mobilenumber  = txMobile.Text;
                obj.qualification = txtQual.Text;
                obj.username      = txUserName.Text;
                obj.password      = txPassword.Text;
                if (this.txmail.Text.Contains('@') == false || this.txmail.Text.Contains('.') == false)
                {
                    MessageBox.Show("Please Enter A Valid Email", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (this.txMobile.Text.Length < 10 || this.txMobile.Text.Length > 10)
                {
                    MessageBox.Show("Please Enter A Valid 10 Digit Mobile Number", "Invalid Mobile", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (this.txName == this.txUserName)
                {
                    MessageBox.Show("Username & Name must be Different");
                }
                //code for storing Image to Database //

                MemoryStream stream = new MemoryStream();
                pictureBox1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte[]     pic = stream.ToArray(pi);
                EmpDataBLL eDB = new EmpDataBLL();
                eDB.empDataAdd(obj, pic);
                EmpAddGrid.DataSource = bll.Gload();
                MessageBox.Show("sucess Employee Entered ", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cmbDesignation.DataSource = null;
                cmbState.DataSource       = null;
                clear();
            }
            else
            {
            }
        }