Esempio n. 1
0
        public List <JobInfo> Get()
        {
            JobDAL dal = new JobDAL();

            dal._conn = this._conn;
            return(dal.Get());
        }
Esempio n. 2
0
        public UserJob(string id)
        {
            InitializeComponent();
            DataTable dt = JobDAL.getUserJob(id);

            dataGridView1.DataSource = dt;
        }
Esempio n. 3
0
        public void Delete(int id)
        {
            JobDAL dal = new JobDAL();

            dal._conn = this._conn;
            dal.Delete(id);
        }
Esempio n. 4
0
        public void Put(JobInfo j)
        {
            JobDAL dal = new JobDAL();

            dal._conn = this._conn;
            dal.Put(j);
        }
Esempio n. 5
0
 private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Columns[e.ColumnIndex].Name == "btXoa")
     {
         DialogResult result = MessageBox.Show("Bạn có chắc muốn xóa công việc này", "Đóng hộp thoại", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             DataGridViewRow row = new DataGridViewRow();
             row = dataGridView1.Rows[e.RowIndex];
             int id = int.Parse(row.Cells[1].Value.ToString());
             BLL.JobBLL.deleteJob(id);
             MessageBox.Show("Xóa thành công");
             System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
             string    uid = config.AppSettings.Settings["id"].Value;
             DataTable dt  = JobDAL.get_AllJob(int.Parse(uid));
             dataGridView1.DataSource = dt;
             //dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[e.RowIndex].Index);
         }
     }
     else if (dataGridView1.Columns[e.ColumnIndex].Name == "btSua")
     {
         DataGridViewRow row = new DataGridViewRow();
         row = dataGridView1.Rows[e.RowIndex];
         int     id     = int.Parse(row.Cells[2].Value.ToString());
         formsua update = new formsua(id);
         update.Show();
     }
 }
Esempio n. 6
0
        private void btrf_Click(object sender, EventArgs e)
        {
            System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
            string    id = config.AppSettings.Settings["id"].Value;
            DataTable dt = JobDAL.get_AllJob(int.Parse(id));

            dataGridView1.DataSource = dt;
        }
Esempio n. 7
0
 public service(DataContext db, UserManager <User> userManager, RoleManager <IdentityRole> roleManager, IConfiguration configuration)
 {
     dal = new DataDAL(db, userManager, roleManager, configuration);
     this.userManager = userManager;
     this.roleManager = roleManager;
     _configuration   = configuration;
     jdal             = new JobDAL(db);
 }
Esempio n. 8
0
 public DataTable GetJobCode()
 {
     try
     {
         JobDAL codeObj = new JobDAL();
         return(codeObj.ReadJobCode());
     }
     catch { throw; }
 }
Esempio n. 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtTencv.TextLength > 0)
     {
         if (cbPhamvi.Text != "")
         {
             int result = DateTime.Compare(dtNgkt.Value, dtNgbd.Value);
             if (result >= 0)
             {
                 System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
                 string id  = config.AppSettings.Settings["uid"].Value;
                 JobDTO job = new JobDTO();
                 job.jTitle   = txtTencv.Text;
                 job.jStarday = dtNgbd.Value.Month.ToString() + "/" + dtNgbd.Value.Day.ToString() + "/" + dtNgbd.Value.Year.ToString();
                 job.jEndday  = dtNgkt.Value.Month.ToString() + "/" + dtNgkt.Value.Day.ToString() + "/" + dtNgkt.Value.Year.ToString();
                 job.jStatus  = 0;
                 job.jPartner = int.Parse(cbNglc.SelectedValue.ToString());
                 MessageBox.Show(cbPhamvi.SelectedIndex.ToString());
                 if (cbPhamvi.SelectedIndex == 0)
                 {
                     job.jCircle = "0";
                 }
                 else
                 {
                     job.jCircle = "1";
                 }
                 //MessageBox.Show(cbNglc.SelectedValue.ToString());
                 job.jAttachments = txtfile.Text;
                 job.juser_id     = int.Parse(id);
                 JobDAL.insert(job);
                 MessageBox.Show("Thêm thành công");
                 txtTencv.Text = "";
                 cbPhamvi.Text = "";
                 txtfile.Text  = "";
                 //this.dBJobTableAdapter.Fill(this.todoList_DBDataSet.DBJob);
             }
             else
             {
                 string error = "Hãy đảm bảo thời gian hoàn thành công việc";
                 MessageBox.Show(error);
             }
         }
         else
         {
             string error = "Hãy chọn phạm vi cho công việc";
             MessageBox.Show(error);
         }
     }
     else
     {
         string error = "Hãy nhập tên công việc";
         MessageBox.Show(error);
     }
 }
Esempio n. 10
0
        public static bool deleteJob(int id)
        {
            string fileName = JobDAL.getFileName(id);

            if (JobDAL.deleteJob(id))
            {
                if (fileName != null)
                {
                    deleteFile(fileName);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 11
0
        //<summary>Admin method to give access admin to the admin manual</summary>
        public static bool LoginAdminBL(int adminId, string password)
        {
            bool loginAdmin = false;

            try
            {
                JobDAL jobDAL = new JobDAL();
                loginAdmin = jobDAL.LoginAdminDAL(adminId, password);
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (SystemException ex)
            {
                throw ex;
            }
            return(loginAdmin);
        }
Esempio n. 12
0
        //<summary>Search Job method to search a job based on name from the job list</summary>
        public static Job SearchJobBL(string searchJobName)
        {
            Job searchJob = null;

            try
            {
                JobDAL jobDAL = new JobDAL();
                searchJob = jobDAL.SearchJobDAL(searchJobName);
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchJob);
        }
Esempio n. 13
0
        //<summary>List Jobs method to list all the jobs in the job list</summary>
        public static List <Job> ListJobsBl()
        {
            List <Job> jobList = new List <Job>();

            try
            {
                JobDAL objJob = new JobDAL();
                jobList = objJob.ListJobsDAL();
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (SystemException ex)
            {
                throw ex;
            }
            return(jobList);
        }
Esempio n. 14
0
        //<summary>User Login method to give access any user to the user manual</summary>
        public static bool LoginUserBL(int userId, string password)
        {
            bool loginUser = false;

            try
            {
                JobDAL jobDAL = new JobDAL();
                loginUser = jobDAL.LoginUserDAL(userId, password);
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (SystemException ex)
            {
                throw ex;
            }
            return(loginUser);
        }
Esempio n. 15
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                JobDTO job          = new JobDTO();
                int    currentIndex = dataGridView1.CurrentCell.RowIndex;
                int    job_id       = Convert.ToInt32(dataGridView1.Rows[currentIndex].Cells[1].Value.ToString());
                JobDAL.delete(job);

                dataGridView1.DataSource = dt;
                //  string deleteStr = "delete from DBJob where DBJob.job_id = '" + job_id + "' ";
                //  SqlCommand cmd = new SqlCommand(deleteStr, conn);
                // cmd.CommandType = CommandType.Text;
                // cmd.EndExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }



            /* DataTable sourceData = (DataTable)dataGridView1.DataSource;
             * foreach (DataGridViewRow row in this.dataGridView1.SelectedRows)
             * {
             *   if (MessageBox.Show("Sure you wanna delete?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
             *   {
             *       JobDTO job = new JobDTO();
             *       JobDAL.delete(job);
             *       dataGridView1.DataSource = dt;
             *
             *   }
             *       int rowIndex = dataGridView1.CurrentCell.RowIndex;
             *        dataGridView1.Rows.RemoveAt(rowIndex);
             *       int IdColumn = 0;
             *       dataGridView1.Rows.RemoveAt(row.Index);
             *       string sql = "delete DBJob" + "where job_id =  ('" + job.jId + "')";
             *
             * } */
        }
Esempio n. 16
0
        private void btloc_Click(object sender, EventArgs e)
        {
            string ngbd = dtngbd.Value.Month.ToString() + "/" + dtngbd.Value.Day.ToString() + "/" + dtngbd.Value.Year.ToString();
            string ngkt = dtngkt.Value.Month.ToString() + "/" + dtngkt.Value.Day.ToString() + "/" + dtngkt.Value.Year.ToString();

            System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
            string id = config.AppSettings.Settings["id"].Value;
            //MessageBox.Show(ngbd);
            string manv = cbbmnv.SelectedValue.ToString();

            //MessageBox.Show(manv);
            if (manv == "")
            {
                DataTable dt = JobDAL.locday(ngbd, ngkt);
                dataGridView1.DataSource = dt;
            }
            else
            {
                DataTable dt = JobDAL.loc(ngbd, ngkt, int.Parse(manv));
                dataGridView1.DataSource = dt;
            }
        }
Esempio n. 17
0
        //<summary>Delete Job method to delete a already existed job from the job list</summary>
        public static bool DeleteJobBL(string deleteJobName)
        {
            bool jobDeleted = false;

            try
            {
                if (deleteJobName != null)
                {
                    JobDAL jobDAL = new JobDAL();
                    jobDeleted = jobDAL.DeleteJobDAL(deleteJobName);
                }
            }
            catch (JobPortalSystemException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(jobDeleted);
        }
Esempio n. 18
0
        //<summary>Edit Job method to edit a already existed job in the job list</summary>
        public static bool EditJobBL(Job editJob)
        {
            bool jobEdited = false;

            try
            {
                if (ValidateJob(editJob))
                {
                    JobDAL jobDAL = new JobDAL();
                    jobEdited = jobDAL.EditJobDAL(editJob);
                }
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(jobEdited);
        }
Esempio n. 19
0
        //<summary>Add Job method to add a new job in the job list</summary>
        public static bool AddJobBL(Job newJob)
        {
            bool jobAdded = false;

            try
            {
                if (ValidateJob(newJob))
                {
                    JobDAL jobDAL = new JobDAL();
                    jobAdded = jobDAL.AddJobDAL(newJob);
                }
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(jobAdded);
        }
Esempio n. 20
0
        //<summary>Register method to regsiter any new user</summary>
        public static bool RegisterUserBL(UserInfo newUser)
        {
            bool userAdded = false;

            try
            {
                if (ValidateUser(newUser))
                {
                    JobDAL jobDAL = new JobDAL();
                    userAdded = jobDAL.RegisterUserDAL(newUser);
                }
            }
            catch (JobPortalSystemException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(userAdded);
        }
Esempio n. 21
0
 public static void Insert(Job job)
 {
     //Job job = new Job(3,"Manufacturing","Washing",DateTime.Now,"RJ12-HF-7654",450,6,3);
     JobDAL.Insert(job);
     Console.WriteLine("Inserted");
 }
Esempio n. 22
0
        public static Job Get()
        {
            Job job = JobDAL.Get(2);

            return(job);;
        }
Esempio n. 23
0
        public static List <Job> GetAll()
        {
            List <Job> job = JobDAL.GetAll();

            return(job);
        }
Esempio n. 24
0
        public static Job getJob(int id)
        {
            Job data = JobDAL.getJob(id);

            return(data);
        }
Esempio n. 25
0
 public static bool addJob(Job job)
 {
     return(JobDAL.addJob(job));
 }
Esempio n. 26
0
 public static bool editJob(Job job)
 {
     return(JobDAL.editJob(job));
 }
Esempio n. 27
0
 public JobBAL()
 {
     _jobDal = new JobDAL();
 }
Esempio n. 28
0
        public static bool Delete()
        {
            bool status = JobDAL.Delete(2);

            return(status);
        }
Esempio n. 29
0
        public static void Update()
        {
            Job job = new Job(1, "	Manufacturing", "Tyres", DateTime.Now, "DL23-TH-4573", 600, 4, 4);

            JobDAL.Update(job);
        }
Esempio n. 30
0
 public service(DataContext _context)
 {
     pdal = new ProjectDAL(_context);
     jdal = new JobDAL(_context);
 }