コード例 #1
0
        private void AddValues()
        {
            try
            {
                _objEmployeeDetailsSetup = new EmployeeDetailsSetup();

                _objEmployeeDetailsSetup.CompanyID       = this.OrganizationalChartControl1.empCompany;
                _objEmployeeDetailsSetup.dtEmployeeChart = this.OrganizationalChartControl1.empValueAsTable;
                _objEmployeeDetailsSetup.EmployeeID      = txtEmployeeID.Text == string.Empty ? null : txtEmployeeID.Text;
                _objEmployeeTypeSetup = new EmployeeTypeSetup();
                _objEmployeeTypeSetup.EmployeeTypeID         = Convert.ToInt32(ddlEmployeeType.SelectedValue);
                _objEmployeeCategorySetup                    = new EmployeeCategorySetup();
                _objEmployeeCategorySetup.EmployeeCategoryID = Convert.ToInt32(ddlEmployeeCategory.SelectedValue);
                _objEmployeeDetailsSetup.EmployeeTitle       = Convert.ToInt32(ddlTitle.SelectedValue);
                _objDesignationSetup = new DesignationSetup();
                _objDesignationSetup.DesignationID     = ddlDesignationEmployee.SelectedValue;
                _objEmployeeDetailsSetup.FirstName     = txtFirstName.Text == string.Empty ? null : txtFirstName.Text;
                _objEmployeeDetailsSetup.MiddleName    = txtMiddleName.Text == string.Empty ? null : txtMiddleName.Text;
                _objEmployeeDetailsSetup.LastName      = txtLastName.Text == string.Empty ? null : txtLastName.Text;
                _objEmployeeDetailsSetup.Email         = txtEmail.Text == string.Empty ? null : txtEmail.Text;
                _objEmployeeDetailsSetup.EntryUserName = LoginUserInformation.UserID;
                IsUser objIsUser = new IsUser();
                objIsUser.UserPermission    = Convert.ToInt32(ddlUserPermission.SelectedValue);
                _objEmployeeSetupController = new EmployeeSetupController();
                _objEmployeeSetupController.Save(_objEmployeeDetailsSetup, _objEmployeeTypeSetup, _objEmployeeCategorySetup, _objDesignationSetup, objIsUser);
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }
コード例 #2
0
        public void Save(EmployeeDetailsSetup objEmployeeDetailsSetup, EmployeeTypeSetup objEmployeeTypeSetup,
                         EmployeeCategorySetup objEmployeeCategorySetup, DesignationSetup objDesignationSetup, IsUser objIsUser)
        {
            try
            {
                objEmployeeDetailsSetup.EmployeeSerialNo = this.GetEmployeeSerialNo();
                var storedProcedureComandText = "INSERT INTO [hrEmployeeSetup] ([ReferenceID],[CompanyID],[EmployeeID],[EmployeeTypeID], " +
                                                " [EmployeeCategoryID] ,[Title],[FirstName],[MiddleName],[LastName],[Email],[UserPermission] ,[DataUsed],[EntryUserID],[EntryDate]) VALUES ( " +
                                                objEmployeeDetailsSetup.EmployeeSerialNo + "," +
                                                objEmployeeDetailsSetup.CompanyID + ",'" +
                                                objEmployeeDetailsSetup.EmployeeID + "', " +
                                                objEmployeeTypeSetup.EmployeeTypeID + ", " +
                                                objEmployeeCategorySetup.EmployeeCategoryID + ", '" +
                                                objEmployeeDetailsSetup.EmployeeTitle + "', '" +
                                                objEmployeeDetailsSetup.FirstName + "', '" +
                                                objEmployeeDetailsSetup.MiddleName + "', '" +
                                                objEmployeeDetailsSetup.LastName + "', '" +
                                                objEmployeeDetailsSetup.Email + "'," +
                                                objIsUser.UserPermission + ",'" +
                                                "A" + "', '" +
                                                objEmployeeDetailsSetup.EntryUserName + "'," +
                                                "CAST(GETDATE() AS DateTime));";
                clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandText);

                objDesignationSetup.LastPositionNo = this.GetLastPosition(objEmployeeDetailsSetup);
                var storedProcedureComandTextDesignation = "INSERT INTO [empDesignation]([ReferenceID],[DesignationID],[LastPosition],[DataUsed],[EntryUserID],[EntryDate]) VALUES( " +
                                                           objEmployeeDetailsSetup.EmployeeSerialNo + ",'" +
                                                           objDesignationSetup.DesignationID + "'," +
                                                           objDesignationSetup.LastPositionNo + ",'" +
                                                           "A" + "','" +
                                                           objEmployeeDetailsSetup.EntryUserName + "'," +
                                                           "CAST(GETDATE() AS DateTime));";
                clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandTextDesignation);
                string storedProcedureComandTextChart = null;
                foreach (DataRow rowNo in objEmployeeDetailsSetup.dtEmployeeChart.Rows)
                {
                    OrganizationalChartSetup objOrganizationalChartSetup = new OrganizationalChartSetup();
                    objOrganizationalChartSetup.EntityTypeID = Convert.ToInt32(rowNo["EntityTypeID"].ToString());
                    objOrganizationalChartSetup.EntityID     = Convert.ToInt32(rowNo["EntityID"].ToString());
                    storedProcedureComandTextChart          += "INSERT INTO [orgEmployeeChart] ([ReferenceID],[EntityTypeID],[EntityID],[LastPosition],[DataUsed],[EntryUserID],[EntryDate] " +
                                                               ") VALUES( " + objEmployeeDetailsSetup.EmployeeSerialNo + "," +
                                                               objOrganizationalChartSetup.EntityTypeID + "," +
                                                               objOrganizationalChartSetup.EntityID + "," +
                                                               objDesignationSetup.LastPositionNo + ",'" +
                                                               "A" + "','" +
                                                               objEmployeeDetailsSetup.EntryUserName + "'," +
                                                               "CAST(GETDATE() AS DateTime));";
                }
                if (storedProcedureComandTextChart != null)
                {
                    clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandTextChart);
                }
            }
            catch (Exception msgException)
            {
                throw msgException;
            }
        }