Exemple #1
0
        public DataTable LineSearch(LineVO vo)
        {
            DataTable dt = new DataTable();

            try
            {
                using (SqlConnection conn = new SqlConnection(this.ConnectionString))
                {
                    string sql = @"select c.corporation_name, f.factory_name,[line_id], [line_note1], [line_note2], [line_name], [line_seq], [line_use], l.[first_regist_time], l.[first_regist_employee], l.[final_regist_time], l.[final_regist_employee] 
                                     From [dbo].[TBL_LINE] l, TBL_CORPORATION c, TBL_FACTORY f
                                    where l.factory_id = f.factory_id 
									  and c.corporation_id = f.corporation_id
                                      and (@corporation_id = 0 or  c.corporation_id = @corporation_id)
                                      and (@factory_id = 0 or f.factory_id = @factory_id)
                                    Order by line_seq asc;;";
                    using (SqlCommand cmd = new SqlCommand(sql, conn))
                    {
                        cmd.Parameters.AddWithValue("@corporation_id", vo.corporation_id);
                        cmd.Parameters.AddWithValue("@factory_id", vo.factory_id);

                        SqlDataAdapter da = new SqlDataAdapter(cmd);

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

                    return(dt);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Exemple #2
0
        public bool UpdateLine(LineVO item)
        {
            string sql = "Update Line set Line_Name = @Line_Name, Factory_ID = @Factory_ID, Line_CodeID = @Line_CodeID where Line_ID = @Line_ID ";

            try
            {
                using (SqlCommand cmd = new SqlCommand(sql, conn))
                {
                    cmd.Parameters.AddWithValue("@Line_Name", item.Line_Name);
                    cmd.Parameters.AddWithValue("@Factory_ID", item.Factory_ID);
                    cmd.Parameters.AddWithValue("@Line_CodeID", item.Line_CodeID);
                    cmd.Parameters.AddWithValue("@Line_ID", item.Line_ID);

                    conn.Open();
                    var rowsAffected = cmd.ExecuteNonQuery();
                    return(rowsAffected > 0);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
        }
        public LinePopupForm(string employeeName, bool IsUpdate, LineVO vo)
        {
            InitializeComponent();
            this.IsUpdate = IsUpdate;

            this.employeeName = employeeName;
            if (IsUpdate == true)
            {
                this.vo = vo;
            }
        }
Exemple #4
0
 private void OpenPopup(bool IsUpdate, LineVO vo = null)
 {
     if (((MainForm)this.MdiParent).ActiveMdiChild == this)
     {
         LinePopupForm frm = new LinePopupForm(emp.Employee_name, IsUpdate, vo);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             LoadData();
         }
     }
 }
Exemple #5
0
        private void dgvLine_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            dgvFactory.CurrentCell = null;

            if (e.RowIndex < dgvLine.Rows.Count && e.RowIndex > -1)
            {
                lineItem = new LineVO()
                {
                    Line_ID    = Convert.ToInt32(dgvLine.Rows[e.RowIndex].Cells[0].Value),
                    Line_Name  = dgvLine.Rows[e.RowIndex].Cells[1].Value.ToString(),
                    Factory_ID = Convert.ToInt32(dgvLine.Rows[e.RowIndex].Cells[2].Value)
                };
            }
        }
        private void InsertLine()
        {
            LineVO item = new LineVO
            {
                Line_Name   = txtLineName.Text,
                Factory_ID  = Convert.ToInt32(cboFactoryName.SelectedValue),
                Line_CodeID = cboCategory.SelectedValue.ToString()
            };

            try
            {
                StandardService service = new StandardService();
                service.InsertLine(item);
            }
            catch (Exception err)
            {
                Log.WriteError(err.Message, err);
            }
        }
        public LineInsUp(EditMode editMode, LineVO item)
        {
            InitializeComponent();

            if (editMode == EditMode.Insert)
            {
                mode           = "Insert";
                lblName.Text   = "공정등록";
                pbxTitle.Image = Resources.AddFile_32x32;
            }
            else
            {
                mode             = "Update";
                lblName.Text     = "공정수정";
                pbxTitle.Image   = Resources.Edit_32x32;
                code             = item.Line_ID;
                txtLineName.Text = item.Line_Name;
                fID = item.Factory_ID;
            }
        }
Exemple #8
0
        private void dgvLinelist_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex == 8)
            {
                return;
            }

            LineVO updatevo = new LineVO
            {
                corporation_name = dgvLinelist[1, e.RowIndex].Value.ToString(),
                factory_name     = dgvLinelist[2, e.RowIndex].Value.ToString(),
                line_id          = dgvLinelist[3, e.RowIndex].Value.ToInt(),
                line_name        = dgvLinelist[4, e.RowIndex].Value.ToString(),
                line_seq         = dgvLinelist[5, e.RowIndex].Value.ToInt(),
                line_note1       = dgvLinelist[6, e.RowIndex].Value.ToString(),
                line_note2       = dgvLinelist[7, e.RowIndex].Value.ToString(),
                line_use         = dgvLinelist[9, e.RowIndex].Value.ToString()
            };

            OpenPopup(true, updatevo);
        }
        private void LineSave(string UseCheck, string Status, int line_id)
        {
            if (MessageBox.Show($"라인을 {Status}하시겠습니까?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                LineVO line = new LineVO
                {
                    line_id               = line_id,
                    factory_id            = cboFactoryName.SelectedValue.ToInt(),
                    line_name             = txtLineName.Text,
                    line_seq              = Convert.ToInt32((nudLine_seq.Value.ToString().Length > 0) ? nudLine_seq.Value.ToString() : "0"),
                    line_use              = UseCheck,
                    first_regist_employee = employeeName,
                    final_regist_employee = employeeName,
                    line_note1            = txtNote1.Text,
                    line_note2            = txtNote2.Text
                };

                if (service.SaveLine(line))
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }
Exemple #10
0
        public bool SaveLine(LineVO vo)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(this.ConnectionString))
                {
                    conn.Open();

                    string sql = "SP_SAVE_LINE";

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

                        cmd.Parameters.AddWithValue("@P_line_id", vo.line_id);
                        cmd.Parameters.AddWithValue("@P_line_name", vo.line_name);
                        cmd.Parameters.AddWithValue("@P_factory_id", vo.factory_id);
                        cmd.Parameters.AddWithValue("@P_line_seq", vo.line_seq);
                        cmd.Parameters.AddWithValue("@P_line_use", vo.line_use);
                        cmd.Parameters.AddWithValue("@P_line_note1", vo.line_note1);
                        cmd.Parameters.AddWithValue("@P_line_note2", vo.line_note2);
                        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;
            }
        }
        public bool UpdateLine(LineVO item)
        {
            LineDAC dac = new LineDAC();

            return(dac.UpdateLine(item));
        }
        public bool InsertLine(LineVO item)
        {
            LineDAC dac = new LineDAC();

            return(dac.InsertLine(item));
        }
Exemple #13
0
 public bool SaveLine(LineVO vo)
 {
     return(dac.SaveLine(vo));
 }
Exemple #14
0
 public DataTable LineSearch(LineVO vo)
 {
     return(dac.LineSearch(vo));
 }