예제 #1
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void Gridfill()
 {
     try
     {
         EmployeeInfo infoEmployee = new EmployeeInfo();
         EmployeeSP spEmployee = new EmployeeSP();
         infoEmployee.EmployeeCode = txtEmployeeCode.Text.Trim();
         infoEmployee.EmployeeName = txtEmployeeName.Text.Trim();
         infoEmployee.DesignationId = decimal.Parse(cmbDesignation.SelectedValue.ToString());
         infoEmployee.SalaryType = cmbsalaryType.SelectedItem.ToString();
         infoEmployee.BankAccountNumber = txtBankAccountNumber.Text.Trim();
         infoEmployee.PassportNo = txtPassportNumber.Text.Trim();
         infoEmployee.LabourCardNumber = txtLabourCardNumber.Text.Trim();
         infoEmployee.VisaNumber = txtVisaNumber.Text.Trim();
         dgvEmployee.DataSource = spEmployee.EmployeeSearch(infoEmployee);
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
 /// <summary>
 /// Function to insert values to Employee Table and returns last identity
 /// </summary>
 /// <param name="employeeinfo"></param>
 /// <returns></returns>
 public decimal EmployeeAddWithReturnIdentity(EmployeeInfo employeeinfo)
 {
     decimal decEmployee = -1;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("EmployeeForTakingEmployeeId", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         
         sprmparam = sccmd.Parameters.Add("@designationId", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.DesignationId;
         sprmparam = sccmd.Parameters.Add("@employeeName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EmployeeName;
         sprmparam = sccmd.Parameters.Add("@employeeCode", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EmployeeCode;
         sprmparam = sccmd.Parameters.Add("@dob", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.Dob;
         sprmparam = sccmd.Parameters.Add("@maritalStatus", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.MaritalStatus;
         sprmparam = sccmd.Parameters.Add("@gender", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Gender;
         sprmparam = sccmd.Parameters.Add("@qualification", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Qualification;
         sprmparam = sccmd.Parameters.Add("@address", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Address;
         sprmparam = sccmd.Parameters.Add("@phoneNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PhoneNumber;
         sprmparam = sccmd.Parameters.Add("@mobileNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.MobileNumber;
         sprmparam = sccmd.Parameters.Add("@email", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Email;
         sprmparam = sccmd.Parameters.Add("@joiningDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.JoiningDate;
         sprmparam = sccmd.Parameters.Add("@terminationDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.TerminationDate;
         sprmparam = sccmd.Parameters.Add("@active", SqlDbType.Bit);
         sprmparam.Value = employeeinfo.IsActive;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@bloodGroup", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BloodGroup;
         sprmparam = sccmd.Parameters.Add("@passportNo", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PassportNo;
         sprmparam = sccmd.Parameters.Add("@passportExpiryDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.PassportExpiryDate;
         sprmparam = sccmd.Parameters.Add("@labourCardNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.LabourCardNumber;
         sprmparam = sccmd.Parameters.Add("@labourCardExpiryDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.LabourCardExpiryDate;
         sprmparam = sccmd.Parameters.Add("@visaNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.VisaNumber;
         sprmparam = sccmd.Parameters.Add("@visaExpiryDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.VisaExpiryDate;
         sprmparam = sccmd.Parameters.Add("@salaryType", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.SalaryType;
         sprmparam = sccmd.Parameters.Add("@dailyWage", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.DailyWage;
         sprmparam = sccmd.Parameters.Add("@bankName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BankName;
         sprmparam = sccmd.Parameters.Add("@branchName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BranchName;
         sprmparam = sccmd.Parameters.Add("@bankAccountNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BankAccountNumber;
         sprmparam = sccmd.Parameters.Add("@branchCode", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BranchCode;
         sprmparam = sccmd.Parameters.Add("@panNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PanNumber;
         sprmparam = sccmd.Parameters.Add("@pfNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PfNumber;
         sprmparam = sccmd.Parameters.Add("@esiNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EsiNumber;
         
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@defaultPackageId", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.DefaultPackageId;
         object AdvancePaymentId = sccmd.ExecuteScalar();
         if (AdvancePaymentId != null)
         {
             decEmployee = Convert.ToDecimal(AdvancePaymentId.ToString());
         }
         else
         {
             decEmployee = -1;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decEmployee;
 }
예제 #3
0
 /// <summary>
 /// Function to Update values in Employee Table
 /// </summary>
 /// <param name="employeeinfo"></param>
 /// <returns></returns>
 public bool EmployeeEdit(EmployeeInfo employeeinfo)
 {
     bool isEdit = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("EmployeeEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.EmployeeId;
         sprmparam = sccmd.Parameters.Add("@designationId", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.DesignationId;
         sprmparam = sccmd.Parameters.Add("@employeeName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EmployeeName;
         sprmparam = sccmd.Parameters.Add("@employeeCode", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EmployeeCode;
         sprmparam = sccmd.Parameters.Add("@dob", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.Dob;
         sprmparam = sccmd.Parameters.Add("@maritalStatus", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.MaritalStatus;
         sprmparam = sccmd.Parameters.Add("@gender", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Gender;
         sprmparam = sccmd.Parameters.Add("@qualification", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Qualification;
         sprmparam = sccmd.Parameters.Add("@address", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Address;
         sprmparam = sccmd.Parameters.Add("@phoneNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PhoneNumber;
         sprmparam = sccmd.Parameters.Add("@mobileNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.MobileNumber;
         sprmparam = sccmd.Parameters.Add("@email", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Email;
         sprmparam = sccmd.Parameters.Add("@joiningDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.JoiningDate;
         sprmparam = sccmd.Parameters.Add("@terminationDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.TerminationDate;
         sprmparam = sccmd.Parameters.Add("@active", SqlDbType.Bit);
         sprmparam.Value = employeeinfo.IsActive;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@bloodGroup", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BloodGroup;
         sprmparam = sccmd.Parameters.Add("@passportNo", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PassportNo;
         sprmparam = sccmd.Parameters.Add("@passportExpiryDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.PassportExpiryDate;
         sprmparam = sccmd.Parameters.Add("@labourCardNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.LabourCardNumber;
         sprmparam = sccmd.Parameters.Add("@labourCardExpiryDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.LabourCardExpiryDate;
         sprmparam = sccmd.Parameters.Add("@visaNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.VisaNumber;
         sprmparam = sccmd.Parameters.Add("@visaExpiryDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.VisaExpiryDate;
         sprmparam = sccmd.Parameters.Add("@salaryType", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.SalaryType;
         sprmparam = sccmd.Parameters.Add("@dailyWage", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.DailyWage;
         sprmparam = sccmd.Parameters.Add("@bankName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BankName;
         sprmparam = sccmd.Parameters.Add("@branchName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BranchName;
         sprmparam = sccmd.Parameters.Add("@bankAccountNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BankAccountNumber;
         sprmparam = sccmd.Parameters.Add("@branchCode", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.BranchCode;
         sprmparam = sccmd.Parameters.Add("@panNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PanNumber;
         sprmparam = sccmd.Parameters.Add("@pfNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PfNumber;
         sprmparam = sccmd.Parameters.Add("@esiNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EsiNumber;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = employeeinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@defaultPackageId", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.DefaultPackageId;
         int inAffectedRows = sccmd.ExecuteNonQuery();
         if (inAffectedRows > 0)
         {
             isEdit = true;
         }
         else
         {
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         Messages.ErrorMessage(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isEdit;
 }
예제 #4
0
 /// <summary>
 /// Function to get particular values from Employee table based on the parameter
 /// </summary>
 /// <param name="employeeId"></param>
 /// <returns></returns>
 public EmployeeInfo EmployeeView(decimal employeeId)
 {
     EmployeeInfo infoemployee = new EmployeeInfo();
     SqlDataReader sqldr = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("EmployeeView", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sqlcmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = employeeId;
         sqldr = sqlcmd.ExecuteReader();
         while (sqldr.Read())
         {
             infoemployee.EmployeeId = Convert.ToDecimal(sqldr["employeeId"].ToString());
             infoemployee.DesignationId = Convert.ToDecimal(sqldr["designationId"].ToString());
             infoemployee.EmployeeName = sqldr["employeeName"].ToString();
             infoemployee.EmployeeCode = sqldr["employeeCode"].ToString();
             infoemployee.Dob = Convert.ToDateTime(sqldr["dob"].ToString());
             infoemployee.MaritalStatus = sqldr["maritalStatus"].ToString();
             infoemployee.Gender = sqldr["gender"].ToString();
             infoemployee.Qualification = sqldr["qualification"].ToString();
             infoemployee.Address = sqldr["address"].ToString();
             infoemployee.PhoneNumber = sqldr["phoneNumber"].ToString();
             infoemployee.MobileNumber = sqldr["mobileNumber"].ToString();
             infoemployee.Email = sqldr["email"].ToString();
             infoemployee.JoiningDate = Convert.ToDateTime(sqldr["joiningDate"].ToString());
             infoemployee.TerminationDate = Convert.ToDateTime(sqldr["terminationDate"].ToString());
             infoemployee.IsActive = bool.Parse(sqldr["isActive"].ToString());
             infoemployee.Narration = sqldr["narration"].ToString();
             infoemployee.BloodGroup = sqldr["bloodGroup"].ToString();
             infoemployee.PassportNo = sqldr["passportNo"].ToString();
             infoemployee.PassportExpiryDate = Convert.ToDateTime(sqldr["passportExpiryDate"].ToString());
             infoemployee.LabourCardNumber = sqldr["labourCardNumber"].ToString();
             infoemployee.LabourCardExpiryDate = Convert.ToDateTime(sqldr["labourCardExpiryDate"].ToString());
             infoemployee.VisaNumber = sqldr["visaNumber"].ToString();
             infoemployee.VisaExpiryDate = Convert.ToDateTime(sqldr["visaExpiryDate"].ToString());
             infoemployee.SalaryType = sqldr["salaryType"].ToString();
             infoemployee.DailyWage = Convert.ToDecimal(sqldr["dailyWage"].ToString());
             infoemployee.BankName = sqldr["bankName"].ToString();
             infoemployee.BranchName = sqldr["branchName"].ToString();
             infoemployee.BankAccountNumber = sqldr["bankAccountNumber"].ToString();
             infoemployee.BranchCode = sqldr["branchCode"].ToString();
             infoemployee.PanNumber = sqldr["panNumber"].ToString();
             infoemployee.PfNumber = sqldr["pfNumber"].ToString();
             infoemployee.EsiNumber = sqldr["esiNumber"].ToString();
             
             infoemployee.DefaultPackageId = Convert.ToDecimal(sqldr["defaultPackageId"].ToString());
         }
     }
     catch (Exception ex)
     {
         Messages.ErrorMessage(ex.ToString());
     }
     finally
     {
         sqldr.Close();
         sqlcon.Close();
     }
     return infoemployee;
 }
예제 #5
0
 /// <summary>
 /// Function to search the employee
 /// </summary>
 /// <param name="infoEmployee"></param>
 /// <returns></returns>
 public DataTable EmployeeSearch(EmployeeInfo infoEmployee)
 {
     DataTable dtblEmployee = new DataTable();
     try
     {
         SqlDataAdapter sqlda = new SqlDataAdapter("EmployeeSearch", sqlcon);
         sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
         dtblEmployee.Columns.Add("SlNo", typeof(decimal));
         dtblEmployee.Columns["SlNo"].AutoIncrement = true;
         dtblEmployee.Columns["SlNo"].AutoIncrementSeed = 1;
         dtblEmployee.Columns["SlNo"].AutoIncrementStep = 1;
         sqlda.SelectCommand.Parameters.Add("@employeeCode", SqlDbType.VarChar).Value = infoEmployee.EmployeeCode;
         sqlda.SelectCommand.Parameters.Add("@employeeName", SqlDbType.VarChar).Value = infoEmployee.EmployeeName;
         sqlda.SelectCommand.Parameters.Add("@designationId", SqlDbType.Decimal).Value = infoEmployee.DesignationId;
         sqlda.SelectCommand.Parameters.Add("@salaryType", SqlDbType.VarChar).Value = infoEmployee.SalaryType;
         sqlda.SelectCommand.Parameters.Add("@bankAccountNumber", SqlDbType.VarChar).Value = infoEmployee.BankAccountNumber;
         sqlda.SelectCommand.Parameters.Add("@passportNumber", SqlDbType.VarChar).Value = infoEmployee.PassportNo;
         sqlda.SelectCommand.Parameters.Add("@labourCardNumber", SqlDbType.VarChar).Value = infoEmployee.LabourCardNumber;
         sqlda.SelectCommand.Parameters.Add("@visaNumber", SqlDbType.VarChar).Value = infoEmployee.VisaNumber;
         sqlda.Fill(dtblEmployee);
     }
     catch (Exception ex)
     {
         Messages.ErrorMessage(ex.ToString());
     }
     return dtblEmployee;
 }
예제 #6
0
 /// <summary>
 /// Function to view details for update based on parameter
 /// </summary>
 /// <param name="decBonusDeductionId"></param>
 /// <returns></returns>
 public BonusDedutionInfo BonusDeductionViewForUpdate(decimal decBonusDeductionId)
 {
     BonusDedutionInfo BonusDeductionInfo = new BonusDedutionInfo();
     EmployeeInfo InfoEmployee = new EmployeeInfo();
     SqlDataReader sqldr = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("BonusDeductionViewForUpdate", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         sqlcmd.Parameters.Add("@bonusDeductionId", SqlDbType.Decimal).Value = decBonusDeductionId;
         sqldr = sqlcmd.ExecuteReader();
         while (sqldr.Read())
         {
             BonusDeductionInfo.EmployeeId = decimal.Parse(sqldr["employeeId"].ToString());
             BonusDeductionInfo.Date = DateTime.Parse(sqldr["date"].ToString());
             BonusDeductionInfo.Month = DateTime.Parse(sqldr["month"].ToString());
             BonusDeductionInfo.BonusAmount = decimal.Parse(sqldr["bonusAmount"].ToString());
             BonusDeductionInfo.DeductionAmount = decimal.Parse(sqldr["deductionAmount"].ToString());
             BonusDeductionInfo.Narration = sqldr["narration"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqldr.Close();
         sqlcon.Close();
     }
     return BonusDeductionInfo;
 }
예제 #7
0
        /// <summary>
        /// Function to fill controls when cell double click in frmEmployeeRegister for updation
        /// </summary>
        /// <param name="decEmployeeId"></param>
        /// <param name="frm"></param>
        public void CallFromEmployeeRegister(decimal decEmployeeId, frmEmployeeRegister frm)
        {
            try
            {
                base.Show();
                frmEmployeeRegisterObj = frm;
                EmployeeInfo infoEmployee = new EmployeeInfo();
                EmployeeSP spEmployee = new EmployeeSP();
                infoEmployee = spEmployee.EmployeeView(decEmployeeId);
                lblEmployeeId.Text = infoEmployee.EmployeeId.ToString();
                txtEmployeeCode.Text = infoEmployee.EmployeeCode.ToString();
                strEmployeeCode = infoEmployee.EmployeeCode.ToString();
                txtEmployeeName.Text = infoEmployee.EmployeeName.ToString();
                cmbDesignation.SelectedValue = infoEmployee.DesignationId;
                dtpDob.Text = infoEmployee.Dob.ToString("dd-MMM-yyyy");
                cmbMaritalStatus.SelectedItem = infoEmployee.MaritalStatus.ToString();
                cmbGender.SelectedItem = infoEmployee.Gender.ToString();
                txtQualification.Text = infoEmployee.Qualification;
                cmbBloodGroup.SelectedItem = infoEmployee.BloodGroup.ToString();
                txtAddress.Text = infoEmployee.Address;
                txtBankAccountNumber.Text = infoEmployee.BankAccountNumber;
                txtBankName.Text = infoEmployee.BankName;
                txtBranch.Text = infoEmployee.BranchName;
                txtEmail.Text = infoEmployee.Email;
                txtEsiNumber.Text = infoEmployee.EsiNumber;
                txtlabourCardNumber.Text = infoEmployee.LabourCardNumber;
                txtBranchCode.Text = infoEmployee.BranchCode;
                txtMobileNumber.Text = infoEmployee.MobileNumber;
                txtNarration.Text = infoEmployee.Narration;
                txtPanNumber.Text = infoEmployee.PanNumber;
                txtPassportNumber.Text = infoEmployee.PassportNo;
                txtPfNumber.Text = infoEmployee.PfNumber;
                txtPhoneNumber.Text = infoEmployee.PhoneNumber;
                txtVisaNumber.Text = infoEmployee.VisaNumber;
                cmbSalaryType.SelectedItem = infoEmployee.SalaryType;
                if (cmbSalaryType.SelectedItem.ToString() == "Daily wage")
                {
                    txtDailyWage.Text = infoEmployee.DailyWage.ToString();
                }
                else
                {
                    cmbDefaultPackage.SelectedValue = int.Parse(infoEmployee.DefaultPackageId.ToString());
                }
                txtJoiningDate.Text = infoEmployee.JoiningDate.ToString("dd-MMM-yyyy");
                dtpLabourCardExpiryDate.Value = infoEmployee.LabourCardExpiryDate;
                dtpPassportExpiryDate.Value = infoEmployee.PassportExpiryDate;
                txtTerminationDate.Text = infoEmployee.TerminationDate.ToString("dd-MMM-yyyy");
                dtpVisaExpiryDate.Value = infoEmployee.VisaExpiryDate;
                txtEmployeeCode.Focus();
                if (infoEmployee.IsActive)
                {
                    cbxActive.Checked = true;
                }
                else
                {
                    cbxActive.Checked = false;
                }
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                txtEmployeeCode.Select();

            }
            catch (Exception ex)
            {
                MessageBox.Show("EC12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #8
0
 /// <summary>
 /// Function to save a salesman
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         EmployeeInfo InfoEmployee = new EmployeeInfo();
         EmployeeSP SpEmployee = new EmployeeSP();
         InfoEmployee.EmployeeCode = txtSalesmanCode.Text.Trim();
         InfoEmployee.DesignationId = Convert.ToDecimal(SpEmployee.SalesmanGetDesignationId());
         InfoEmployee.EmployeeName = txtName.Text.Trim();
         InfoEmployee.Email = txtEmail.Text.Trim();
         InfoEmployee.PhoneNumber = txtPhone.Text.Trim();
         InfoEmployee.MobileNumber = txtMobile.Text.Trim();
         InfoEmployee.Address = txtAddress.Text.Trim();
         InfoEmployee.Narration = txtNarration.Text.Trim();
         InfoEmployee.Dob = DateTime.Now;
         InfoEmployee.MaritalStatus = "Single";
         InfoEmployee.Gender = "Male";
         InfoEmployee.Qualification = string.Empty;
         InfoEmployee.BloodGroup = string.Empty;
         InfoEmployee.JoiningDate = PublicVariables._dtCurrentDate;
         InfoEmployee.TerminationDate = DateTime.Now;
         if (cbxActive.Checked)
         {
             InfoEmployee.IsActive = true;
         }
         else
         {
             InfoEmployee.IsActive = false;
         }
         InfoEmployee.SalaryType = "Monthly";
         InfoEmployee.DefaultPackageId = 1;
         InfoEmployee.BankName = string.Empty;
         InfoEmployee.BankAccountNumber = string.Empty;
         InfoEmployee.BranchName = string.Empty;
         InfoEmployee.BranchCode = string.Empty;
         InfoEmployee.PanNumber = string.Empty;
         InfoEmployee.PfNumber = string.Empty;
         InfoEmployee.EsiNumber = string.Empty;
         InfoEmployee.PassportNo = string.Empty;
         InfoEmployee.PassportExpiryDate = DateTime.Now;
         InfoEmployee.VisaNumber = string.Empty;
         InfoEmployee.VisaExpiryDate = DateTime.Now;
         InfoEmployee.LabourCardNumber = string.Empty;
         InfoEmployee.LabourCardExpiryDate = DateTime.Now;
         InfoEmployee.Extra1 = string.Empty;
         InfoEmployee.Extra2 = string.Empty;
         if (SpEmployee.EmployeeCodeCheckExistance(txtSalesmanCode.Text.Trim().ToString(), 0) == false)
         {
             decSalesManId = SpEmployee.EmployeeAddWithReturnIdentity(InfoEmployee);
             Messages.SavedMessage();
             Clear();
             Gridfill();
             if (frmRejectionInObj != null)
             {
                 this.Close();
             }
             if (frmSalesQuotationObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.InformationMessage("Salesman code already exist");
             txtSalesmanCode.Focus();
         }
         if (frmSalesReturnObj != null)
         {
             this.Close();
         }
         if (frmSalesOrderObj != null)
         {
             this.Close();
         }
         if (frmSalesInvoiceObj != null)
         {
             this.Close();
         }
         if (frmPOSObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("S5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #9
0
        //coded by nikhil
        // on 21-03-2013
        public DataTable AdvanceRegisterSearch(string strAdvanceVoucher, string strEmployeeCode, string strEmployeeName, string dtpDate,string strVouchertypeName)
        {
            EmployeeInfo infoEmployee = new EmployeeInfo();
            DataTable dtbl = new DataTable();
            try
            {
                SqlDataAdapter sqlda = new SqlDataAdapter("AdvanceRegisterSearch", sqlcon);
                sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
                dtbl.Columns.Add("SLNO", typeof(decimal));
                dtbl.Columns["SLNO"].AutoIncrement = true;
                dtbl.Columns["SLNO"].AutoIncrementSeed = 1;
                dtbl.Columns["SLNO"].AutoIncrementStep = 1;
                sqlda.SelectCommand.Parameters.Add("@voucherNo", SqlDbType.VarChar).Value = strAdvanceVoucher;
                sqlda.SelectCommand.Parameters.Add("@employeeCode", SqlDbType.VarChar).Value = strEmployeeCode;
                sqlda.SelectCommand.Parameters.Add("@employeeName", SqlDbType.VarChar).Value = strEmployeeName;
                sqlda.SelectCommand.Parameters.Add("@date", SqlDbType.VarChar).Value = dtpDate;
                sqlda.SelectCommand.Parameters.Add("@VoucherTypeName", SqlDbType.VarChar).Value = strVouchertypeName;
                    



                sqlda.Fill(dtbl);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return dtbl;

        }
예제 #10
0
 /// <summary>
 /// Function to view all details for Search based on parameter
 /// </summary>
 /// <param name="strBrandName"></param>
 /// <param name="strCategoryname"></param>
 /// <returns></returns>
 public DataTable ServiceSearch(string strBrandName, string strCategoryname)
 {
     EmployeeInfo infoEmployee = new EmployeeInfo();
     DataTable dtbl = new DataTable();
     try
     {
         SqlDataAdapter sqlda = new SqlDataAdapter("ServiceSearch", sqlcon);
         sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
         dtbl.Columns.Add("SLNO", typeof(decimal));
         dtbl.Columns["SLNO"].AutoIncrement = true;
         dtbl.Columns["SLNO"].AutoIncrementSeed = 1;
         dtbl.Columns["SLNO"].AutoIncrementStep = 1;
         sqlda.SelectCommand.Parameters.Add("@serviceName", SqlDbType.VarChar).Value = strBrandName;
         sqlda.SelectCommand.Parameters.Add("@categoryName", SqlDbType.VarChar).Value = strCategoryname;
         sqlda.Fill(dtbl);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     return dtbl;
 }
예제 #11
0
 /// <summary>
 /// On doubleClicking on the grid, It Fill the controlls to edit or delete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvSalesman_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             if (Convert.ToDecimal(dgvSalesman.CurrentRow.Cells["dgvtxtemployeeId"].Value) != 1)
             {
                 EmployeeSP spEmployee = new EmployeeSP();
                 EmployeeInfo infoEmployee = new EmployeeInfo();
                 strSalesmanId = dgvSalesman.CurrentRow.Cells["dgvtxtemployeeId"].Value.ToString();
                 FillControls();
                 btnSave.Text = "Update";
                 btnDelete.Enabled = true;
                 txtSalesmanCode.Focus();
             }
             else
             {
                 Messages.InformationMessage("Default employee cannot update or delete");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("S25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #12
0
 /// <summary>
 /// Function to call save or edit function after user confirmation and also checks invalid entries
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         EmployeeInfo infoEmployee = new EmployeeInfo();
         if (txtSalesmanCode.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter salesman code");
             txtSalesmanCode.Focus();
         }
         else if (txtName.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter salesman name");
             txtName.Focus();
         }
         else
         {
             if (btnSave.Text == "Save")
             {
                 if (PublicVariables.isMessageAdd)
                 {
                     if (Messages.SaveMessage())
                     {
                         SaveFunction();
                     }
                 }
                 else
                 {
                     SaveFunction();
                 }
                 decIdForOtherForm = decSalesManId;
                 if (frmServiceVoucherObj != null)
                 {
                     if (decIdForOtherForm != 0)
                     {
                         this.Close();
                     }
                     else
                     {
                         txtName.Focus();
                     }
                 }
                 if (frmDeliveryNoteObj != null)
                 {
                     if (decIdForOtherForm != 0)
                     {
                         this.Close();
                     }
                     else
                     {
                         txtName.Focus();
                     }
                 }
                 if (frmPOSObj != null)
                 {
                     if (decIdForOtherForm != 0)
                     {
                         this.Close();
                     }
                     else
                     {
                         txtName.Focus();
                     }
                 }
             }
             else
             {
                 if (PublicVariables.isMessageEdit)
                 {
                     if (Messages.UpdateMessage())
                     {
                         EditFunction();
                     }
                 }
                 else
                 {
                     EditFunction();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("S7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #13
0
 /// <summary>
 /// Function to edit a salesman
 /// </summary>
 public void EditFunction()
 {
     try
     {
         EmployeeInfo InfoEmployee = new EmployeeInfo();
         EmployeeSP SpEmployee = new EmployeeSP();
         InfoEmployee.EmployeeId = decSalesManId;
         InfoEmployee.EmployeeCode = txtSalesmanCode.Text.Trim();
         InfoEmployee.EmployeeName = txtName.Text.Trim();
         InfoEmployee.Email = txtEmail.Text.Trim();
         InfoEmployee.PhoneNumber = txtPhone.Text.Trim();
         InfoEmployee.MobileNumber = txtMobile.Text.Trim();
         InfoEmployee.Address = txtAddress.Text.Trim();
         InfoEmployee.Narration = txtNarration.Text.Trim();
         if (cbxActive.Checked)
         {
             InfoEmployee.IsActive = true;
         }
         else
         {
             InfoEmployee.IsActive = false;
         }
         if (SpEmployee.EmployeeCodeCheckExistance(txtSalesmanCode.Text.Trim().ToString(), decSalesManId) == false)
         {
             SpEmployee.SalesmanEdit(InfoEmployee);
             Messages.UpdatedMessage();
             ClearSearch();
             Clear();
             Gridfill();
         }
         else
         {
             Messages.InformationMessage("Salesman code already exist");
             txtSalesmanCode.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("S6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #14
0
 /// <summary>
 /// Function to get particular values from employee table based on the parameter
 /// </summary>
 /// <param name="employeeId"></param>
 /// <returns></returns>
 public EmployeeInfo SalesmanViewSpecificFeilds(decimal employeeId)
 {
     EmployeeInfo infoemployee = new EmployeeInfo();
     SqlDataReader sqldr = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("SalesmanViewSpecificFeilds", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sqlcmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = employeeId;
         sqldr = sqlcmd.ExecuteReader();
         while (sqldr.Read())
         {
             infoemployee.EmployeeId = Convert.ToDecimal(sqldr["employeeId"].ToString());
             infoemployee.EmployeeName = sqldr["employeeName"].ToString();
             infoemployee.EmployeeCode = sqldr["employeeCode"].ToString();
             infoemployee.Email = sqldr["email"].ToString();
             infoemployee.PhoneNumber = sqldr["phoneNumber"].ToString();
             infoemployee.MobileNumber = sqldr["mobileNumber"].ToString();
             infoemployee.Address = sqldr["address"].ToString();
             infoemployee.Narration = sqldr["narration"].ToString();
             infoemployee.IsActive = Convert.ToBoolean(sqldr["isActive"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqldr.Close();
         sqlcon.Close();
     }
     return infoemployee;
 }
예제 #15
0
        /// <summary>
        /// Function for save
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                EmployeeInfo infoEmployee = new EmployeeInfo();
                EmployeeSP spEmployee = new EmployeeSP();
                infoEmployee.EmployeeCode = txtEmployeeCode.Text.Trim();
                infoEmployee.EmployeeName = txtEmployeeName.Text.Trim();
                infoEmployee.DesignationId = Convert.ToDecimal(cmbDesignation.SelectedValue.ToString());
                infoEmployee.Dob = Convert.ToDateTime(dtpDob.Text.ToString());
                infoEmployee.MaritalStatus = (cmbMaritalStatus.Text.ToString()).TrimEnd();
                if (cmbGender.Text != string.Empty)
                {
                    infoEmployee.Gender = (cmbGender.SelectedItem.ToString()).TrimEnd();
                }
                else
                {
                    infoEmployee.Gender = cmbGender.Text.ToString();
                }
                infoEmployee.Qualification = txtQualification.Text.Trim();
                infoEmployee.Address = txtAddress.Text.Trim();
                infoEmployee.PhoneNumber = txtPhoneNumber.Text.Trim();
                infoEmployee.MobileNumber = txtMobileNumber.Text.Trim();
                infoEmployee.Email = txtEmail.Text.Trim();
                infoEmployee.JoiningDate = Convert.ToDateTime(txtJoiningDate.Text.ToString());
                infoEmployee.TerminationDate = Convert.ToDateTime(txtTerminationDate.Text.ToString());
                if (cbxActive.Checked)
                {
                    infoEmployee.IsActive = true;
                }
                else
                {
                    infoEmployee.IsActive = false;
                }
                infoEmployee.Narration = txtNarration.Text.Trim();
                infoEmployee.BloodGroup = (cmbBloodGroup.Text.ToString()).TrimEnd();
                infoEmployee.PassportNo = txtPassportNumber.Text.Trim();
                infoEmployee.PassportExpiryDate = Convert.ToDateTime(dtpPassportExpiryDate.Text.ToString());
                infoEmployee.VisaNumber = txtVisaNumber.Text.Trim();
                infoEmployee.VisaExpiryDate = Convert.ToDateTime(dtpVisaExpiryDate.Text.ToString());
                infoEmployee.LabourCardNumber = txtlabourCardNumber.Text.Trim();
                infoEmployee.LabourCardExpiryDate = Convert.ToDateTime(dtpLabourCardExpiryDate.Text.ToString());
                infoEmployee.SalaryType = (cmbSalaryType.SelectedItem.ToString()).TrimEnd();
                if (cmbSalaryType.SelectedItem.ToString() == "Daily wage")
                {
                    if (txtDailyWage.Text.Trim() != string.Empty)
                    {
                        infoEmployee.DailyWage = Convert.ToDecimal(txtDailyWage.Text.ToString());
                    }

                }
                else
                {
                    if (cmbDefaultPackage.Text != string.Empty)
                    {
                        infoEmployee.DefaultPackageId = Convert.ToDecimal(cmbDefaultPackage.SelectedValue.ToString());
                    }
                }
                infoEmployee.BankName = txtBankName.Text.Trim();
                infoEmployee.BankAccountNumber = txtBankAccountNumber.Text.Trim();
                infoEmployee.BranchName = txtBranch.Text.Trim();
                infoEmployee.BranchCode = txtBranchCode.Text.Trim();
                infoEmployee.PanNumber = txtPanNumber.Text.Trim();
                infoEmployee.PfNumber = txtPfNumber.Text.Trim();
                infoEmployee.EsiNumber = txtEsiNumber.Text.Trim();
                infoEmployee.ExtraDate = DateTime.Now;
                infoEmployee.Extra1 = string.Empty;
                infoEmployee.Extra2 = string.Empty;
                if (spEmployee.EmployeeCodeCheckExistance(txtEmployeeCode.Text.Trim(), 0) == false)
                {
                    decEmployeeId = spEmployee.EmployeeAddWithReturnIdentity(infoEmployee);
                    Messages.SavedMessage();
                    ClearFunction();
                    decIdForOtherForms = decEmployeeId;
                    if (frmSalesInvoiceObj != null)
                    {
                        if (decIdForOtherForms != 0)
                        {
                            this.Close();
                        }
                    }

                }
                else
                {
                    Messages.InformationMessage("Employee code already exist");
                    txtEmployeeCode.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("EC1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #16
0
 /// <summary>
 /// Function to Update values in employee Table for salesman
 /// </summary>
 /// <param name="employeeinfo"></param>
 /// <returns></returns>
 public bool SalesmanEdit(EmployeeInfo employeeinfo)
 {
     bool isEdit = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesmanEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = employeeinfo.EmployeeId;
         sprmparam = sccmd.Parameters.Add("@employeeName", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EmployeeName;
         sprmparam = sccmd.Parameters.Add("@employeeCode", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.EmployeeCode;
         sprmparam = sccmd.Parameters.Add("@address", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Address;
         sprmparam = sccmd.Parameters.Add("@phoneNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.PhoneNumber;
         sprmparam = sccmd.Parameters.Add("@mobileNumber", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.MobileNumber;
         sprmparam = sccmd.Parameters.Add("@email", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Email;
         sprmparam = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
         sprmparam.Value = employeeinfo.IsActive;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = employeeinfo.Narration;
         int inAffectedRows = sccmd.ExecuteNonQuery();
         if (inAffectedRows > 0)
         {
             isEdit = true;
         }
         else
         {
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         Messages.ErrorMessage(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isEdit;
 }
예제 #17
0
 /// <summary>
 /// Function to fill the controlls for edit or delete
 /// </summary>
 public void FillControls()
 {
     try
     {
         EmployeeSP spEmployee = new EmployeeSP();
         EmployeeInfo infoEmployee = new EmployeeInfo();
         infoEmployee = spEmployee.SalesmanViewSpecificFeilds(Convert.ToDecimal(strSalesmanId.ToString()));
         txtSalesmanCode.Text = infoEmployee.EmployeeCode;
         txtName.Text = infoEmployee.EmployeeName;
         txtEmail.Text = infoEmployee.Email;
         txtPhone.Text = infoEmployee.PhoneNumber;
         txtMobile.Text = infoEmployee.MobileNumber;
         txtAddress.Text = infoEmployee.Address;
         txtNarration.Text = infoEmployee.Narration;
         if (infoEmployee.IsActive)
         {
             cbxActive.Checked = true;
         }
         else
         {
             cbxActive.Checked = false;
         }
         decSalesManId = infoEmployee.EmployeeId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("S3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }