public bool insertNewJob(EmployeeJobAssign obj)
        {
            string insertCommand = "INSERT INTO employeejobassign (employeeId,jobId,jobDescription,jobAssignByAdminId,jobStartDate,jobDeadlineDate,departmentNo) " +
                                   " VALUES (@employeeId,@jobId,@jobDescription,@jobAssignByAdminId,@jobStartDate,@jobDeadlineDate,@departmentNo)";
            SqlCommand command = new SqlCommand(insertCommand);
            SqlParameter idParameter = new SqlParameter("@employeeId", SqlDbType.NVarChar, 50);
            idParameter.Value = obj.employeeId;
            SqlParameter jobidParameter = new SqlParameter("@jobId", SqlDbType.NVarChar, 50);
            jobidParameter.Value = obj.jobId;
            SqlParameter jobdesParameter = new SqlParameter("@jobDescription", SqlDbType.NVarChar, 50);
            jobdesParameter.Value = obj.jobDescription;
            SqlParameter jobassignadminidParameter = new SqlParameter("@jobAssignByAdminId", SqlDbType.NVarChar, 50);
            jobassignadminidParameter.Value = obj.jobAssignByAdmin;
            SqlParameter jobstartdateParameter = new SqlParameter("@jobStartDate", SqlDbType.Date);
            jobstartdateParameter.Value = obj.jobStartDate;
            SqlParameter jobDeadlineDateParameter = new SqlParameter("@jobDeadlineDate", SqlDbType.Date);
            jobDeadlineDateParameter.Value = obj.jobDeadlineDate;
            SqlParameter departmentNoParameter = new SqlParameter("@departmentNo", SqlDbType.NVarChar, 50);
            departmentNoParameter.Value = obj.departmentId;
            
            






            command.Parameters.Add(idParameter);
            command.Parameters.Add(jobidParameter);
            command.Parameters.Add(jobdesParameter);
            command.Parameters.Add(jobassignadminidParameter);
            command.Parameters.Add(jobstartdateParameter);
            command.Parameters.Add(jobDeadlineDateParameter);
            command.Parameters.Add(departmentNoParameter);



        



            if (da.Execution(command))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 2
0
        private void reassignjobjobidcomboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            string jobid = reassignjobjobidcomboBox.Text;

            rajob = ejad.GetJobAllFromJobAssign(jobid);


            reassignjobemployeeidcomboBox.Text = rajob.employeeId;          
           reassignnewjobdescriptiontext.Text= rajob.jobDescription;
           reassignnewjobstartdatetext.Value=rajob.jobStartDate;
           reassignnewjobdeadlinedatetext.Value=rajob.jobDeadlineDate;
           reassinnewjobdeptnocombobox.Text = rajob.departmentId;
            


        }
        public bool deleteJob(EmployeeJobAssign obj)
        {
            string insertCommand = "delete from employeejobassign  " +
                                   "where jobId= @jobId ";
            SqlCommand command = new SqlCommand(insertCommand);
            SqlParameter jobIdParameter = new SqlParameter("@jobId", SqlDbType.NVarChar, 50);
             jobIdParameter.Value = obj.jobId;


             command.Parameters.Add(jobIdParameter);

            if (da.Execution(command))
            {
                return true;
            }
            else
            {
                return false;
            }

        }
        public List<EmployeeJobAssign> GetAssignJobListForEmployee(string eid)
        {
            List<EmployeeJobAssign> employeeAssignjobList = new List<EmployeeJobAssign>();

            string query = "select employeeId,jobId,jobDescription,jobAssignByAdminId,jobStartDate,jobDeadlineDate,departmentNo,JobStatus from employeejobassign where employeeId='"+ eid +"' ";
            SqlCommand cmd = da.GetCommand(query);
            cmd.Connection.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                EmployeeJobAssign ej = new EmployeeJobAssign();
                ej.employeeId = reader.GetString(0);
                ej.jobId = reader.GetString(1);
                ej.jobDescription = reader.GetString(2);
                ej.jobAssignByAdmin = reader.GetString(3);
                ej.jobStartDate = reader.GetDateTime(4);
                ej.jobDeadlineDate = reader.GetDateTime(5);
                ej.departmentId = reader.GetString(6);
                ej.jobStatus = reader.GetString(7);

                employeeAssignjobList.Add(ej);
            }
            return employeeAssignjobList;
        }
        public EmployeeJobAssign GetJobAllFromJobAssign(string jobid)
        {
            EmployeeJobAssign eja = new EmployeeJobAssign();
            string query = "select employeeId,jobDescription,jobStartDate,jobDeadlineDate,departmentNo from employeejobassign where jobId= '" + jobid + "'";
            SqlCommand cmd = da.GetCommand(query);
            cmd.Connection.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {

                eja.employeeId = reader.GetString(0);              
                eja.jobDescription = reader.GetString(1);
                eja.jobStartDate = reader.GetDateTime(2);
                eja.jobDeadlineDate = reader.GetDateTime(3);
                eja.departmentId = reader.GetString(4);
                

            }
            return eja;
        }