Ejemplo n.º 1
0
        private void Metal_Logic()
        {
            try
            {
                if (txt_metalcd.Text.ToString().Equals(""))
                {
                    MessageBox.Show("메탈코드를 입력하시기 바랍니다.");
                    return;
                }

                if (txt_modelnm.Text.ToString().Equals(""))
                {
                    MessageBox.Show("모델명을 입력하시기 바랍니다.");
                    return;
                }

                byte[] flow_img;
                int    flow_img_size = 0;
                if (path != null && path != "")
                {
                    flow_img      = ComInfo.GetImage(path);
                    flow_img_size = flow_img.Length;
                }
                else
                {
                    flow_img      = null;
                    flow_img_size = 0;
                }


                if (txt_metalcd.Enabled)
                {
                    string lot_no = dtp_inputdate.Text.ToString().Replace("-", "");
                    lot_no = lot_no.Substring(2).ToString();

                    wnDm wDm   = new wnDm();
                    int  rsNum = wDm.Insert_Metal(
                        txt_metalcd.Text.ToString()
                        , txt_modelnm.Text.ToString()
                        , dtp_makedate.Text.ToString()
                        , txt_spec.Text.ToString()
                        , txt_ordercust.Text.ToString()
                        , txt_makecust.Text.ToString()
                        , dtp_inputdate.Text.ToString()
                        , txt_comment.Text.ToString()
                        , lot_no
                        );
                    if (rsNum == 0)
                    {
                        resetSetting();
                        MessageBox.Show("성공적으로 등록하였습니다.");
                    }
                    else if (rsNum == 1)
                    {
                        MessageBox.Show("저장에 실패하였습니다");
                    }
                    else if (rsNum == 2)
                    {
                        MessageBox.Show("SQL COMMAND 에러");
                    }
                    else if (rsNum == 3)
                    {
                        MessageBox.Show("기존 코드가 있으니 \n 다른 코드로 입력 바랍니다.");
                    }
                    else
                    {
                        MessageBox.Show("Exception 에러1");
                    }
                }
                else
                {
                    wnDm wDm   = new wnDm();
                    int  rsNum = wDm.Update_Metal(
                        txt_metalcd.Text.ToString()
                        , txt_modelnm.Text.ToString()
                        , dtp_makedate.Text.ToString()
                        , txt_spec.Text.ToString()
                        , txt_ordercust.Text.ToString()
                        , txt_makecust.Text.ToString()
                        , dtp_inputdate.Text.ToString()
                        , txt_comment.Text.ToString()
                        );
                    if (rsNum == 0)
                    {
                        MessageBox.Show("성공적으로 수정하였습니다.");
                    }
                    else if (rsNum == 1)
                    {
                        MessageBox.Show("저장에 실패하였습니다");
                    }
                    else
                    {
                        MessageBox.Show("Exception 에러");
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }