コード例 #1
0
        private void FillCrewMasterList()
        {
            StaffMaster clsStaffMaster = null;
            DataTable   dt             = null;

            try
            {
                clsStaffMaster = new StaffMaster();
                dt             = clsStaffMaster.GetStafflist(0);
                if (dt != null)
                {
                    gvCrewList.GridControl.DataSource = dt;
                    gvCrewList.Columns[1].Visible     = false;
                    gvCrewList.Columns[8].Visible     = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Company List: " + ex.ToString(), clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void FillCrewMemberDetails(long nStaffID)
        {
            StaffMaster clsStaffMaster = null;
            DataTable   dtStaffDetails = null;

            try
            {
                clsStaffMaster = new StaffMaster();
                dtStaffDetails = clsStaffMaster.GetStaffInformation(nStaffID);

                if (dtStaffDetails != null && dtStaffDetails.Rows.Count > 0)
                {
                    lblEmployeeID.Text              = Convert.ToString(dtStaffDetails.Rows[0]["nStaffID"]);
                    txtEmployeeCode.Text            = Convert.ToString(dtStaffDetails.Rows[0]["sStaffCode"]);
                    txtEmployeeName.Text            = Convert.ToString(dtStaffDetails.Rows[0]["sStaffName"]);
                    cmbEmpDesignation.SelectedValue = Convert.ToString(dtStaffDetails.Rows[0]["nDesignationID"]);
                    cmbEmpCompany.SelectedValue     = Convert.ToString(dtStaffDetails.Rows[0]["nCompanyID"]);
                    txtEmpAbbrivation.Text          = Convert.ToString(dtStaffDetails.Rows[0]["sStaffAbbrivation"]);
                    cmbGender.SelectedValue         = Convert.ToString(dtStaffDetails.Rows[0]["sGender"]);
                    dtEmpBirthdate.EditValue        = Convert.ToDateTime(dtStaffDetails.Rows[0]["dtDOB"]);
                    txtEmpAge.Text                = Convert.ToString(dtStaffDetails.Rows[0]["sAge"]);
                    txtAddressLine1.Text          = Convert.ToString(dtStaffDetails.Rows[0]["sAddressLine1"]);
                    txtAddressLine2.Text          = Convert.ToString(dtStaffDetails.Rows[0]["sAddressLine2"]);
                    txtCity.Text                  = Convert.ToString(dtStaffDetails.Rows[0]["sCity"]);
                    txtState.Text                 = Convert.ToString(dtStaffDetails.Rows[0]["sState"]);
                    txtCountry.Text               = Convert.ToString(dtStaffDetails.Rows[0]["sCountry"]);
                    txtPincode.Text               = Convert.ToString(dtStaffDetails.Rows[0]["sPincode"]);
                    txtEmail.Text                 = Convert.ToString(dtStaffDetails.Rows[0]["sEmail"]);
                    txtPermanentAddressLine1.Text = Convert.ToString(dtStaffDetails.Rows[0]["sPermanentAddressLine1"]);
                    txtPermanentAddressLine2.Text = Convert.ToString(dtStaffDetails.Rows[0]["sPermanentAddressLine2"]);
                    txtPermanentPincode.Text      = Convert.ToString(dtStaffDetails.Rows[0]["sPermanentPincode"]);
                    txtDistrictTownVillage.Text   = Convert.ToString(dtStaffDetails.Rows[0]["sPermanentDistTown"]);
                    dtEmpDOJ.EditValue            = Convert.ToDateTime(dtStaffDetails.Rows[0]["dtDOJ"]);
                    txtGSTNNo.Text                = Convert.ToString(dtStaffDetails.Rows[0]["sGSTNNo"]);
                    txtPANNo.Text                 = Convert.ToString(dtStaffDetails.Rows[0]["sPANNo"]);
                    txtAadharNo.Text              = Convert.ToString(dtStaffDetails.Rows[0]["sAadharNo"]);
                    txtReferenceBy.Text           = Convert.ToString(dtStaffDetails.Rows[0]["sReferenceBy"]);
                    txtAllergies.Text             = Convert.ToString(dtStaffDetails.Rows[0]["sAllergies"]);
                    cmbBloodGroup.Text            = Convert.ToString(dtStaffDetails.Rows[0]["sBloodGroup"]);
                    txtWorkedSince.Text           = Convert.ToString(dtStaffDetails.Rows[0]["sWorkingSince"]);
                    txtDailyWages.Text            = Convert.ToString(dtStaffDetails.Rows[0]["sDailyWages"]);
                    txtSalary.Text                = Convert.ToString(dtStaffDetails.Rows[0]["sSalary"]);
                    txtUnionID.Text               = Convert.ToString(dtStaffDetails.Rows[0]["sUnionID"]);
                    dtUnionRenewDate.EditValue    = Convert.ToDateTime(dtStaffDetails.Rows[0]["dtUnionIDRenewalDate"]);
                    txtlic1No.Text                = Convert.ToString(dtStaffDetails.Rows[0]["sFirstLicenseNumber"]);
                    dtLic1RenewDate.EditValue     = Convert.ToDateTime(dtStaffDetails.Rows[0]["dtFirstLicenseRenewalDate"]);
                    txtLic2No.Text                = Convert.ToString(dtStaffDetails.Rows[0]["sSecondLicenseNumber"]);
                    dtLic2RenewDate.EditValue     = Convert.ToDateTime(dtStaffDetails.Rows[0]["dtSecondLicenseRenewalDate"]);
                    txtLic3No.Text                = Convert.ToString(dtStaffDetails.Rows[0]["sThirdLicenseNumber"]);
                    dtLic3RenewDate.EditValue     = Convert.ToDateTime(dtStaffDetails.Rows[0]["dtThirdLicenseRenewalDate"]);

                    string[] sPhoneAll = Convert.ToString(dtStaffDetails.Rows[0]["sPhoneNo"]).Split(',');
                    if (sPhoneAll.Length > 0)
                    {
                        int nCompPanelCount = GetPanelCount(sPhoneAll.Length);
                        for (int i = 0; i < nCompPanelCount; i++)
                        {
                            ShowHidePhonePanel(sPhoneAll[i], i + 1);
                        }
                    }
                    byte[] empImage = null;
                    if (dtStaffDetails.Rows[0]["sPhoto"] != DBNull.Value)
                    {
                        empImage = (byte[])dtStaffDetails.Rows[0]["sPhoto"];
                        MemoryStream msHeaderImage = new MemoryStream(empImage);
                        picEmployeemage.Image = Image.FromStream(msHeaderImage);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #3
0
        private void SaveCrewMember()
        {
            StaffMaster clsStaffMaster = null;

            try
            {
                string sPhone1   = Convert.ToString(txtPhone1.Text.Trim());
                string sPhone2   = Convert.ToString(txtPhone4.Text.Trim());
                string sPhone3   = Convert.ToString(txtPhone5.Text.Trim());
                string sPhone4   = Convert.ToString(txtPhone3.Text.Trim());
                string sPhone5   = Convert.ToString(txtPhone2.Text.Trim());
                string sPhoneAll = string.Empty;
                if (sPhone1 != "")
                {
                    sPhoneAll += sPhone1;
                }
                if (sPhone2 != "")
                {
                    sPhoneAll += "," + sPhone2;
                }
                if (sPhone3 != "")
                {
                    sPhoneAll += "," + sPhone3;
                }
                if (sPhone4 != "")
                {
                    sPhoneAll += "," + sPhone4;
                }
                if (sPhone5 != "")
                {
                    sPhoneAll += "," + sPhone5;
                }
                byte[] EmployeeImage = null;

                if (picEmployeemage.Image != null)
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        picEmployeemage.Image.Save(ms, ImageFormat.Jpeg);
                        EmployeeImage = new byte[ms.Length];
                        ms.Position   = 0;
                        ms.Read(EmployeeImage, 0, EmployeeImage.Length);
                    }
                }

                clsStaffMaster                            = new StaffMaster();
                clsStaffMaster.nStaffID                   = Convert.ToInt64(lblEmployeeID.Text);
                clsStaffMaster.nDesignationID             = Convert.ToInt64(cmbEmpDesignation.SelectedValue);
                clsStaffMaster.nCompanyID                 = Convert.ToInt64(cmbEmpCompany.SelectedValue);
                clsStaffMaster.sStaffCode                 = Convert.ToString(txtEmployeeCode.Text.Trim());
                clsStaffMaster.sStaffName                 = Convert.ToString(txtEmployeeName.Text.Trim());
                clsStaffMaster.sStaffAbbrivation          = Convert.ToString(txtEmpAbbrivation.Text.Trim());
                clsStaffMaster.dtDOB                      = Convert.ToDateTime(dtEmpBirthdate.Text.ToString());
                clsStaffMaster.sAge                       = Convert.ToString(txtEmpAge.Text.Trim());
                clsStaffMaster.sGender                    = Convert.ToString(cmbGender.SelectedValue);
                clsStaffMaster.sPhoneNo                   = sPhoneAll;
                clsStaffMaster.sPermanentAddressLine1     = Convert.ToString(txtPermanentAddressLine1.Text.Trim());
                clsStaffMaster.sPermanentAddressLine2     = Convert.ToString(txtPermanentAddressLine2.Text.Trim());
                clsStaffMaster.sPermanentPincode          = Convert.ToString(txtPermanentPincode.Text.Trim());
                clsStaffMaster.sPermanentDistTown         = Convert.ToString(txtDistrictTownVillage.Text.Trim());
                clsStaffMaster.sAddressLine1              = Convert.ToString(txtAddressLine1.Text.Trim());
                clsStaffMaster.sAddressLine2              = Convert.ToString(txtAddressLine2.Text.Trim());
                clsStaffMaster.sCity                      = Convert.ToString(txtCity.Text.Trim());
                clsStaffMaster.sState                     = Convert.ToString(txtState.Text.Trim());
                clsStaffMaster.sCountry                   = Convert.ToString(txtCountry.Text.Trim());
                clsStaffMaster.sPincode                   = Convert.ToString(txtPincode.Text.Trim());
                clsStaffMaster.sEmail                     = Convert.ToString(txtEmail.Text.Trim());
                clsStaffMaster.dtDOJ                      = Convert.ToDateTime(dtEmpBirthdate.Text.ToString());
                clsStaffMaster.sGSTNNo                    = Convert.ToString(txtGSTNNo.Text.Trim());
                clsStaffMaster.sPANNo                     = Convert.ToString(txtPANNo.Text.Trim());
                clsStaffMaster.sAadharNo                  = Convert.ToString(txtAadharNo.Text.Trim());
                clsStaffMaster.sReferenceBy               = Convert.ToString(txtReferenceBy.Text.Trim());
                clsStaffMaster.sAllergies                 = Convert.ToString(txtAllergies.Text.Trim());
                clsStaffMaster.sBloodGroup                = Convert.ToString(cmbBloodGroup.Text.Trim());
                clsStaffMaster.sWorkingSince              = Convert.ToString(txtWorkedSince.Text.Trim());
                clsStaffMaster.sSalary                    = Convert.ToString(txtSalary.Text.Trim());
                clsStaffMaster.sDailyWages                = Convert.ToString(txtDailyWages.Text.Trim());
                clsStaffMaster.sUnionID                   = Convert.ToString(txtUnionID.Text.Trim());
                clsStaffMaster.dtUnionIDRenewalDate       = Convert.ToDateTime(dtUnionRenewDate.Text.Trim());
                clsStaffMaster.sFirstLicenseNumber        = Convert.ToString(txtlic1No.Text.Trim());
                clsStaffMaster.dtFirstLicenseRenewalDate  = Convert.ToDateTime(dtLic1RenewDate.Text.Trim());
                clsStaffMaster.sSecondLicenseNumber       = Convert.ToString(txtLic2No.Text.Trim());
                clsStaffMaster.dtSecondLicenseRenewalDate = Convert.ToDateTime(dtLic2RenewDate.Text.Trim());
                clsStaffMaster.sThirdLicenseNumber        = Convert.ToString(txtLic2No.Text.Trim());
                clsStaffMaster.dtThirdLicenseRenewalDate  = Convert.ToDateTime(dtLic3RenewDate.Text.Trim());
                clsStaffMaster.imgPhoto                   = EmployeeImage;
                if (pnlLoginDetails.Visible == true)
                {
                    clsStaffMaster.bIsAllowAccess = true;
                    clsStaffMaster.sUserName      = Convert.ToString(txtGafferUserName.Text.Trim());
                    clsStaffMaster.sPin           = Convert.ToString(txtGafferPin.Text.Trim());
                    clsStaffMaster.sPassword      = Convert.ToString(clsEncryption.EncryptToBase64String(txtGafferConfirmPassword.Text.Trim()));
                }

                Int64 nCrewMemberID = clsStaffMaster.InsertUpdateStaffMaster();

                if (nCrewMemberID != 0)
                {
                    MessageBox.Show("Crew member is saved successfully.", clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearForm();
                }
                else
                {
                    MessageBox.Show("Error while saving crew member.", clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }