Example #1
0
        public bool ProcessWorker(ProcessWorkerVO vo)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(this.ConnectionString))
                {
                    conn.Open();

                    string sql = "SP_SAVE_PROCESSWORKER";

                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@P_worker_id", vo.worker_id);
                        cmd.Parameters.AddWithValue("@P_process_id", vo.process_id);
                        cmd.Parameters.AddWithValue("@P_employee_id", vo.employee_id);
                        cmd.Parameters.AddWithValue("@P_first_regist_employee", vo.first_regist_employee);
                        cmd.Parameters.AddWithValue("@P_final_regist_employee", vo.final_regist_employee);

                        cmd.ExecuteNonQuery();
                    }
                    return(true);
                }
            }
            catch (Exception err)
            {
                return(false);

                throw err;
            }
        }
        private void OpenPopup(bool IsUpdate, ProcessWorkerVO vo = null)
        {
            if (((MainForm)this.MdiParent).ActiveMdiChild == this)
            {
                ProcessWorkerPopupForm frm = new ProcessWorkerPopupForm(emp.Employee_name, IsUpdate, vo);

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    LoadData();
                }
            }
        }
Example #3
0
        public DataTable ProcessWorkerSearch(ProcessWorkerVO vo)
        {
            DataTable dt = new DataTable();

            try
            {
                using (SqlConnection conn = new SqlConnection(this.ConnectionString))
                {
                    string sql = @"SELECT c.corporation_name, f.[factory_name], l.line_name, p.[process_name], e.employee_name, pw.[first_regist_time], pw.[first_regist_employee], pw.[final_regist_time], pw.[final_regist_employee]
                                     from  TBL_PROCESS_WORKER pw, [dbo].[TBL_PROCESS] p, [dbo].[TBL_LINE] l, [dbo].[TBL_FACTORY] f, [dbo].[TBL_CORPORATION] c, TBL_EMPLOYEE e
                                    where pw.process_id = p.process_id
								      AND p.line_id = l.line_id
                                      and l.factory_id = f.factory_id
                                      and f.corporation_id = c.corporation_id
									  and pw.employee_id = e.employee_id
                                      and (@corporation_id = 0 or  c.corporation_id = @corporation_id)
                                      and (@factory_id = 0 or f.factory_id = @factory_id)
                                      and (@line_id = 0 or l.line_id = @line_id)
									  and (@process_id = 0 or p.process_id =@process_id)
									  and (@employee_id is null or e.employee_id = @employee_id)"                                    ;
                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        cmd.Parameters.AddWithValue("@corporation_id", vo.corporation_id);
                        cmd.Parameters.AddWithValue("@factory_id", vo.factory_id);
                        cmd.Parameters.AddWithValue("@line_id", vo.line_id);
                        cmd.Parameters.AddWithValue("@process_id", vo.process_id);
                        if (vo.employee_id.Length < 1)
                        {
                            cmd.Parameters.AddWithValue("@employee_id", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@employee_id", vo.employee_id);
                        }

                        SqlDataAdapter da = new SqlDataAdapter(cmd);

                        cmd.Connection.Open();
                        da.Fill(dt);
                        cmd.Connection.Close();
                    }

                    return(dt);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Example #4
0
        public ProcessWorkerPopupForm(string employeeName, bool IsUpdate, ProcessWorkerVO vo)
        {
            InitializeComponent();

            this.IsUpdate = IsUpdate;

            this.employeeName = employeeName;
            if (IsUpdate == true)
            {
                this.vo = vo;
            }
            else
            {
                this.vo = new ProcessWorkerVO();
            }
        }
        private void Search(object sender, EventArgs e)
        {
            if (((MainForm)this.MdiParent).ActiveMdiChild == this)
            {
                dgvProcessWorker.EndEdit();

                ProcessWorkerVO vo = new ProcessWorkerVO()
                {
                    corporation_id = cboCorporationName.SelectedValue.ToInt(),
                    factory_id     = cboFactoryName.SelectedValue.ToInt(),
                    line_id        = cboLineName.SelectedValue.ToInt(),
                    process_id     = cboProcessName.SelectedValue.ToInt(),
                    employee_id    = cboWorkerName.SelectedValue.ToString()
                };

                dtDGV = service.ProcessWorkerSearch(vo);
                dgvProcessWorker.DataSource = dtDGV;
            }
        }
        private void dgvProcessWorker_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            ProcessWorkerVO updatevo = new ProcessWorkerVO
            {
                corporation_name = dgvProcessWorker[1, e.RowIndex].Value.ToString(),
                factory_name     = dgvProcessWorker[2, e.RowIndex].Value.ToString(),
                line_name        = dgvProcessWorker[3, e.RowIndex].Value.ToString(),
                process_name     = dgvProcessWorker[4, e.RowIndex].Value.ToString(),
                worker_id        = dgvProcessWorker[5, e.RowIndex].Value.ToInt(),
                employee_name    = dgvProcessWorker[6, e.RowIndex].Value.ToString()
            };

            OpenPopup(true, updatevo);
        }
Example #7
0
        private void ProsessWorkerSave(string Status, int worker_id)
        {
            if (MessageBox.Show($"공정 별 작업자를 {Status}하시겠습니까?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ProcessWorkerVO worker = new ProcessWorkerVO
                {
                    worker_id             = worker_id,
                    process_id            = cboProcessName.SelectedValue.ToInt(),
                    employee_id           = cboWorkerName.SelectedValue.ToString(),
                    first_regist_employee = employeeName,
                    final_regist_employee = employeeName
                };

                if (service.ProcessWorker(worker))
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }
Example #8
0
 public DataTable ProcessWorkerSearch(ProcessWorkerVO vo)
 {
     return(dac.ProcessWorkerSearch(vo));
 }
Example #9
0
 public bool ProcessWorker(ProcessWorkerVO vo)
 {
     return(dac.ProcessWorker(vo));
 }