コード例 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            BLemployee blObjct = new BLemployee();

            if (txt_code.Text != "" && txt_Name.Text != "" && txt_fatherName.Text != "" && txt_address.Text != "" && txt_phon.Text != "" && txt_nationality.Text != "" && cbGender.Text != "" && txt_maritalStatus.Text != "" && dtpDob.Text != "" && txt_PassportNo.Text != "" && dtpPasprtExpryDate.Text != "" && txt_LabrCrdNo.Text != "" && dtpLbrCrdExpryDate.Text != "" && txt_noOchildren.Text != "" && cbBloodgrp.Text != "" && txt_BankAccNo.Text != "" && txt_BankName.Text != "" && txt_BankBrach.Text != "" && txt_qlifucation.Text != "" && cbYearOfPassing.Text != "" && txt_percentageOfMarks.Text != "" && txt_university.Text != "" && txt_yearOfExperience.Text != "" && txt_EmployeeStatus.Text != "" && txt_sponserName.Text != "" && txt_VisaNo.Text != "" && dtpVisaExpryDate.Text != "" && txt_AnnualLeave.Text != "")
            {
                blObjct.DeleteEmployee(EmpId);

                MessageBox.Show("Delete Succesful");
            }
            else
            {
                MessageBox.Show("No Row Selected");
            }
        }
コード例 #2
0
    protected void btnsend_Click(object sender, EventArgs e)
    {
        //validation error
        if (!Page.IsValid)
        {
            debugmessage.InnerHtml = "Invalid input";
            return;
        }

        int temp;
        int.TryParse(ddlemployeetype.SelectedValue, out temp);
        int temp2;
        int.TryParse(Session["businessid"].ToString(), out temp2);
        int manager = -1;

        if(ddlemployeetype.SelectedItem.Text == "Employee")
        {
            int.TryParse(ddlmanager.SelectedValue, out manager);
        }

        //new employee
        employee = new BLemployee(txtname.Text, temp, ddlemployeetype.SelectedItem.Text, temp2, odcbconn.conn, manager);

        if (Session["sender"] != null)
        {
            string temps = Session["sender"] + "";
            Session["sender"] = null;

            Response.Redirect(temps);
        }
        else
        {
            Response.Redirect("main.aspx");
        }

        //cont
        Response.Redirect("selectemployee.aspx");
    }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txt_code.Text != "" && txt_Name.Text != "" && txt_fatherName.Text != "" && txt_address.Text != "" && txt_phon.Text != "" && txt_nationality.Text != "" && cbGender.Text != "" && txt_maritalStatus.Text != "" && dtpDob.Text != "" && txt_PassportNo.Text != "" && dtpPasprtExpryDate.Text != "" && txt_LabrCrdNo.Text != "" && dtpLbrCrdExpryDate.Text != "" && txt_noOchildren.Text != "" && cbBloodgrp.Text != "" && txt_BankAccNo.Text != "" && txt_BankName.Text != "" && txt_BankBrach.Text != "" && txt_qlifucation.Text != "" && cbYearOfPassing.Text != "" && txt_percentageOfMarks.Text != "" && txt_university.Text != "" && txt_yearOfExperience.Text != "" && txt_EmployeeStatus.Text != "" && txt_sponserName.Text != "" && txt_VisaNo.Text != "" && dtpVisaExpryDate.Text != "" && txt_AnnualLeave.Text != "")
            {
                if (EmpId < 1)
                {
                    emp.EmpCode              = txt_code.Text;
                    emp.EmpName              = txt_Name.Text;
                    emp.FatherName           = txt_fatherName.Text;
                    emp.Address              = txt_address.Text;
                    emp.PhoneNo              = txt_phon.Text;
                    emp.Nationality          = txt_nationality.Text;
                    emp.Gender               = cbGender.Text;
                    emp.MaritalStatus        = txt_maritalStatus.Text;
                    emp.DateOfBirth          = Convert.ToDateTime(dtpDob.Text);
                    emp.PassportNo           = txt_PassportNo.Text;
                    emp.PassportExpiryDate   = Convert.ToDateTime(dtpPasprtExpryDate.Text);
                    emp.LabourCardNo         = txt_LabrCrdNo.Text;
                    emp.LabourCardExpiryDate = Convert.ToDateTime(dtpLbrCrdExpryDate.Text);
                    emp.NoOfChildren         = txt_noOchildren.Text;
                    emp.BloodGroup           = cbBloodgrp.Text;
                    emp.BankAccNo            = txt_BankAccNo.Text;
                    emp.BankName             = txt_BankName.Text;
                    emp.BankBranch           = txt_BankBrach.Text;
                    emp.Qualification        = txt_qlifucation.Text;
                    emp.YearOfPassing        = Convert.ToInt16(cbYearOfPassing.Text);
                    emp.PercentageOfMarks    = txt_percentageOfMarks.Text;
                    emp.University           = txt_university.Text;
                    emp.YearsOfExperience    = Convert.ToDecimal(txt_yearOfExperience.Text);
                    emp.EmployeeStatus       = txt_EmployeeStatus.Text;

                    MemoryStream mstream;

                    Byte[] EmpPhoto = null;

                    if (empPhoto.Image != null)
                    {
                        //Save image from PictureBox into MemoryStream object.
                        mstream = new MemoryStream();

                        empPhoto.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg);

                        if (mstream.Length > 778240)
                        {
                            MessageBox.Show("Maximum logo image size is 760 KB");

                            return;
                        }

                        //Read from MemoryStream into Byte array.
                        EmpPhoto = new Byte[mstream.Length];

                        mstream.Position = 0;

                        mstream.Read(EmpPhoto, 0, Convert.ToInt32(mstream.Length));
                    }

                    //Save logo
                    emp.EmpPhoto            = EmpPhoto;
                    emp.SponsorName         = txt_sponserName.Text;
                    emp.VisaNo              = txt_VisaNo.Text;
                    emp.VisaExpiryDate      = Convert.ToDateTime(dtpVisaExpryDate.Text);
                    emp.AnnualLeaveMaturity = Convert.ToDecimal(txt_AnnualLeave.Text);
                    int result;
                    result = blObjct.AddEmployee(emp);
                    if (result > 0)
                    {
                        MessageBox.Show("success");
                    }
                }
                else
                {
                    Employee   emp     = new Employee();
                    BLemployee blObjct = new BLemployee();
                    emp.EmpCode              = txt_code.Text;
                    emp.EmpName              = txt_Name.Text;
                    emp.FatherName           = txt_fatherName.Text;
                    emp.Address              = txt_address.Text;
                    emp.PhoneNo              = txt_phon.Text;
                    emp.Nationality          = txt_nationality.Text;
                    emp.Gender               = cbGender.Text;
                    emp.MaritalStatus        = txt_maritalStatus.Text;
                    emp.DateOfBirth          = Convert.ToDateTime(dtpDob.Text);
                    emp.PassportNo           = txt_PassportNo.Text;
                    emp.PassportExpiryDate   = Convert.ToDateTime(dtpPasprtExpryDate.Text);
                    emp.LabourCardNo         = txt_LabrCrdNo.Text;
                    emp.LabourCardExpiryDate = Convert.ToDateTime(dtpLbrCrdExpryDate.Text);
                    emp.NoOfChildren         = txt_noOchildren.Text;
                    emp.BloodGroup           = cbBloodgrp.Text;
                    emp.BankAccNo            = txt_BankAccNo.Text;
                    emp.BankName             = txt_BankName.Text;
                    emp.BankBranch           = txt_BankBrach.Text;
                    emp.Qualification        = txt_qlifucation.Text;
                    emp.YearOfPassing        = Convert.ToInt16(cbYearOfPassing.Text);
                    emp.PercentageOfMarks    = txt_percentageOfMarks.Text;
                    emp.University           = txt_university.Text;
                    emp.YearsOfExperience    = Convert.ToDecimal(txt_yearOfExperience.Text);
                    emp.EmployeeStatus       = txt_EmployeeStatus.Text;

                    MemoryStream mstream;

                    Byte[] EmpPhoto = null;

                    if (empPhoto.Image != null)
                    {
                        //Save image from PictureBox into MemoryStream object.
                        mstream = new MemoryStream();

                        empPhoto.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg);

                        if (mstream.Length > 778240)
                        {
                            MessageBox.Show("Maximum logo image size is 760 KB");

                            return;
                        }

                        //Read from MemoryStream into Byte array.
                        EmpPhoto = new Byte[mstream.Length];

                        mstream.Position = 0;

                        mstream.Read(EmpPhoto, 0, Convert.ToInt32(mstream.Length));
                    }

                    //Save logo
                    emp.EmpPhoto            = EmpPhoto;
                    emp.SponsorName         = txt_sponserName.Text;
                    emp.VisaNo              = txt_VisaNo.Text;
                    emp.VisaExpiryDate      = Convert.ToDateTime(dtpVisaExpryDate.Text);
                    emp.AnnualLeaveMaturity = Convert.ToDecimal(txt_AnnualLeave.Text);
                    emp.EmpId = EmpId;
                    int result = blObjct.UpdateEmployee(emp);
                    if (result > 0)
                    {
                        MessageBox.Show("Update Successful");
                    }
                }
            }
            else
            {
                MessageBox.Show("please fill the data");
            }
            txt_Name.Text = txt_code.Text = txt_fatherName.Text = txt_address.Text = txt_phon.Text = txt_nationality.Text = cbGender.Text = txt_maritalStatus.Text = dtpDob.Text = txt_PassportNo.Text = dtpPasprtExpryDate.Text = txt_LabrCrdNo.Text = dtpLbrCrdExpryDate.Text = txt_noOchildren.Text = cbBloodgrp.Text = txt_BankAccNo.Text = txt_BankName.Text = txt_BankBrach.Text = txt_qlifucation.Text = cbYearOfPassing.Text = txt_percentageOfMarks.Text = txt_university.Text = txt_yearOfExperience.Text = txt_EmployeeStatus.Text = txt_sponserName.Text = txt_VisaNo.Text = dtpVisaExpryDate.Text = txt_AnnualLeave.Text = "";
        }