private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" update USER_PASSWD set ");
                sb.AppendLine("     USER_NAME = @USER_NAME ");
                sb.AppendLine("     , USER_RESNUM = @USER_RESNUM ");
                sb.AppendLine("     , USER_PASS = @USER_PASS ");
                sb.AppendLine("     , USER_DEPT = @USER_DEPT ");
                sb.AppendLine("     , USER_MAN = @USER_MAN ");
                sb.AppendLine("     , USER_SELECT = @USER_SELECT ");
                sb.AppendLine("     , USER_SERVER1 = @USER_SERVER1 ");
                sb.AppendLine("     , USER_SERVER2 = @USER_SERVER2 ");
                sb.AppendLine("     , USER_SERVER3 = @USER_SERVER3 ");
                sb.AppendLine(" where 1=1 ");
                sb.AppendLine("     and USER_CODE = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", txtCode.Text);
                sCommand.Parameters.AddWithValue("@USER_NAME", txtName.Text);
                sCommand.Parameters.AddWithValue("@USER_RESNUM", txt주민번호.Text);
                sCommand.Parameters.AddWithValue("@USER_PASS", txt비밀번호.Text);
                sCommand.Parameters.AddWithValue("@USER_DEPT", "" + cmb부서.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@USER_MAN", "" + cmb담당자.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@USER_SELECT", "" + cmb검색조건.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@USER_SERVER1", (rb서버1.Checked == true ? "1" : "0"));
                sCommand.Parameters.AddWithValue("@USER_SERVER2", (rb서버2.Checked == true ? "1" : "0"));
                sCommand.Parameters.AddWithValue("@USER_SERVER3", "0");

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update USER_PASSWD");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 2
0
        private bool deletePost()
        {
            bool flag = false;

            try
            {
                wnDm          wnDm          = new wnDm();
                wnAdo         wnAdo         = new wnAdo();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine(" delete from F_INTER_MST");
                stringBuilder.AppendLine(" where 1 = 1");
                stringBuilder.AppendLine("     AND M_CODE = @M_CODE");
                stringBuilder.AppendLine("     AND M_NAME = @M_NAME");
                stringBuilder.AppendLine("     AND INSERT_STAFF = @INSERT_STAFF");

                SqlCommand sCommand = new SqlCommand(stringBuilder.ToString());
                sCommand.Parameters.AddWithValue("@M_CODE", (object)this.txtCode.Text);
                sCommand.Parameters.AddWithValue("@M_NAME", (object)this.txtName.Text);
                sCommand.Parameters.AddWithValue("@INSERT_STAFF", (object)Common.p_strStaffNo);

                flag = wnAdo.SqlCommandEtc(sCommand, "Delete_F_INTER_MST_Table") > 0;
                if (!flag)
                {
                    int num = (int)MessageBox.Show("삭제 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                int num = (int)MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(100, ex.Message + " - " + ex.ToString());
            }
            return(flag);
        }
Esempio n. 3
0
        public int updateWorkState(string plan_date, string plan_cd, string state_cd)
        {
            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();
                sb = new StringBuilder();

                sb.AppendLine("update F_PLAN set");
                sb.AppendLine("      STATE_CD = '" + state_cd + "' "); // RAW_OUT_YN = 'Y',
                sb.AppendLine("where PLAN_DATE = '" + plan_date + "' ");
                sb.AppendLine(" and PLAN_CD = '" + plan_cd + "' ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "update_PLAN_RAW_OUT");
                if (qResult > 0)
                {
                    return(0);  // 0 true, 1 false
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("error" + e.ToString());
                return(9);
            }
        }
Esempio n. 4
0
        //private byte[] GetImage(string path)
        //{

        //    FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
        //    BinaryReader reader = new BinaryReader(stream);

        //    byte[] image = reader.ReadBytes((int)stream.Length);
        //    reader.Close();
        //    stream.Close();

        //    return image;
        //}

        #endregion common logic



        public void updateFlowChkExam(int amt)
        {
            String LLotNo = txt_lot_no.Text.ToString();

            try
            {
                wnDm wDm = new wnDm();

                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine("update F_WORK_FLOW_DETAIL set POOR_AMT = " + amt + " where LOT_NO='" + LLotNo + "' and FLOW_CD='0006'");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "insert_RAW_CHK_EXAM_TB");
            }
            catch (Exception e)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, e.Message + " - " + e.ToString());
                Popup.pop오류리포트 msg = new pop오류리포트(e.Message + " - " + e.ToString());
                msg.ShowDialog();
                return;
            }
        }
Esempio n. 5
0
        private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" update DEPTCODE set ");
                sb.AppendLine("     CODE_DESC = @CODE_DESC ");
                sb.AppendLine("     , USE_CHECK = @USE_CHECK ");
                sb.AppendLine("     , 구분 = @구분 ");
                sb.AppendLine("     , 조회순서 = @조회순서 ");
                sb.AppendLine("     , 소계 = @소계 ");
                sb.AppendLine("     , 부서계 = @부서계 ");
                sb.AppendLine("     , AreaCode = @AreaCode ");
                sb.AppendLine(" where 1=1 ");
                sb.AppendLine("     and DEPT_CODE = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CODE_DESC", txtName.Text);
                sCommand.Parameters.AddWithValue("@USE_CHECK", "" + cmb사용여부.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@구분", "" + cmb구분.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@조회순서", txt조회순서.Text);
                sCommand.Parameters.AddWithValue("@소계", txt소계.Text);
                sCommand.Parameters.AddWithValue("@부서계", txt부서계.Text);
                sCommand.Parameters.AddWithValue("@AreaCode", "" + cmb지역.SelectedValue.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update_DEPTCODE_Table");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex) {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString()); Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 6
0
        public int deletePlan(string plan_date, string plan_cd, string jumun_date, string jumun_cd, string jumun_seq)
        {
            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine("delete from F_PLAN ");
                sb.AppendLine("    where PLAN_DATE = @PLAN_DATE ");
                sb.AppendLine("    and PLAN_CD = @PLAN_CD ");


                sb.AppendLine("delete from F_PLAN_RAW ");
                sb.AppendLine("    where PLAN_DATE = @PLAN_DATE ");
                sb.AppendLine("    and PLAN_CD = @PLAN_CD ");

                sb.AppendLine("delete from F_PLAN_FAC ");
                sb.AppendLine("    where PLAN_DATE = @PLAN_DATE ");
                sb.AppendLine("    and PLAN_CD = @PLAN_CD ");

                sb.AppendLine("delete from F_PLAN_SUBJECT ");
                sb.AppendLine("    where PLAN_DATE = @PLAN_DATE ");
                sb.AppendLine("    and PLAN_CD = @PLAN_CD ");

                sb.AppendLine("update F_JUMUN_DETAIL ");
                sb.AppendLine("    set PLAN_YN = 'N' ");
                sb.AppendLine("    where JUMUN_DATE = @JUMUN_DATE ");
                sb.AppendLine("         and JUMUN_CD = @JUMUN_CD ");
                sb.AppendLine("         and SEQ = @JUMUN_SEQ ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@PLAN_DATE", plan_date);
                sCommand.Parameters.AddWithValue("@PLAN_CD", plan_cd);
                sCommand.Parameters.AddWithValue("@JUMUN_DATE", jumun_date);
                sCommand.Parameters.AddWithValue("@JUMUN_CD", jumun_cd);
                sCommand.Parameters.AddWithValue("@JUMUN_SEQ", jumun_seq);

                int qResult = wAdo.SqlCommandEtc(sCommand, "delete_PLAN_TB");
                if (qResult > 0)
                {
                    return(0);  // 0 true, 1 false
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception e)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, e.Message + " - " + e.ToString());
                return(9);
            }
        }
        private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" update MANCODE set ");
                sb.AppendLine("     CODE_DESC = @CODE_DESC ");
                sb.AppendLine("     , 직급 = @직급 ");
                sb.AppendLine("     , DEPT_CODE = @DEPT_CODE ");
                sb.AppendLine("     , 입사일자 = @입사일자 ");
                sb.AppendLine("     , MAN_OUTCHK = @MAN_OUTCHK ");
                sb.AppendLine("     , 퇴사일자 = @퇴사일자 ");
                sb.AppendLine(" where 1=1 ");
                sb.AppendLine("     and MAN_CODE = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CODE_DESC", txtName.Text);
                sCommand.Parameters.AddWithValue("@직급", txt직급.Text);
                sCommand.Parameters.AddWithValue("@DEPT_CODE", "" + cmb부서.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@입사일자", (dtp입사일자.Text == "1900-01-01" ? "" : dtp입사일자.Text));
                sCommand.Parameters.AddWithValue("@MAN_OUTCHK", (chk퇴사구분.Checked == true ? "1" : "0"));
                sCommand.Parameters.AddWithValue("@퇴사일자", (dtp퇴사일자.Text == "1900-01-01" ? "" : dtp퇴사일자.Text));

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update MANCODE");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 8
0
        public int deleteWork(string txt_work_date, string lbl_work_cd)
        {
            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine("delete from F_WORK_RESULT ");
                sb.AppendLine("    where WORK_DATE = @WORK_DATE ");
                sb.AppendLine("    and WORK_CD = @WORK_CD ");


                sb.AppendLine("delete from F_WORK_RESULT_FLOW ");
                sb.AppendLine("    where WORK_DATE = @WORK_DATE ");
                sb.AppendLine("    and WORK_CD = @WORK_CD ");

                sb.AppendLine("delete from F_WORK_RESULT_RAW ");
                sb.AppendLine("    where WORK_DATE = @WORK_DATE ");
                sb.AppendLine("    and WORK_CD = @WORK_CD ");


                //sb.AppendLine("update F_PLAN ");
                //sb.AppendLine("    set ORDER_YN = 'N' ");
                //sb.AppendLine("    where JUMUN_DATE = @JUMUN_DATE ");
                //sb.AppendLine("         and JUMUN_CD = @JUMUN_CD ");
                //sb.AppendLine("         and SEQ = @JUMUN_SEQ ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@WORK_DATE", txt_work_date);
                sCommand.Parameters.AddWithValue("@WORK_CD", lbl_work_cd);
                //sCommand.Parameters.AddWithValue("@JUMUN_DATE", w_jumun_date);
                //sCommand.Parameters.AddWithValue("@JUMUN_CD", w_jumun_cd);
                //sCommand.Parameters.AddWithValue("@JUMUN_SEQ", w_jumun_seq);

                int qResult = wAdo.SqlCommandEtc(sCommand, "delete_PLAN_TB");
                if (qResult > 0)
                {
                    return(0);  // 0 true, 1 false
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception e)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, e.Message + " - " + e.ToString());
                return(9);
            }
        }
Esempio n. 9
0
        private bool deletePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" delete from T_GroupUser ");
                sb.AppendLine(" where GrpID = @p1  ");

                sb.AppendLine(" delete from T_GroupSub ");
                sb.AppendLine(" where GrpID = @p1  ");

                sb.AppendLine(" delete from T_GroupTop ");
                sb.AppendLine(" where GrpID = @p1  ");

                sb.AppendLine(" delete from T_Group ");
                sb.AppendLine(" where GrpID = @p1  ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", this.txtCode.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Delete Group");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("삭제 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
            }
            return(bRet);
        }
Esempio n. 10
0
        private bool updatePost()
        {
            if (!this.validate_InputBox())
            {
                return(false);
            }
            bool flag = false;

            try
            {
                wnAdo         wnAdo         = new wnAdo();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine(" UPDATE F_INTER_MST ");
                stringBuilder.AppendLine("SET M_CODE = @M_CODE");
                stringBuilder.AppendLine(", M_NAME = @M_NAME");
                stringBuilder.AppendLine(", STD_TEMP = @STD_TEMP");
                stringBuilder.AppendLine(", STD_HUM = @STD_HUM");
                stringBuilder.AppendLine(", ERROR_TEMP = @ERROR_TEMP");
                stringBuilder.AppendLine(", ERROR_HUM = @ERROR_HUM");
                stringBuilder.AppendLine(", MEMO = @MEMO");
                stringBuilder.AppendLine(", UPDATE_STAFF = @UPDATE_STAFF");
                stringBuilder.AppendLine(", UPDATE_DATE = getDate()");
                stringBuilder.AppendLine("  WHERE 1 = 1");
                stringBuilder.AppendLine("  AND M_CODE = @OLD_M_CODE");

                SqlCommand sCommand = new SqlCommand(stringBuilder.ToString());

                sCommand.Parameters.AddWithValue("@M_CODE", this.txtCode.Text);
                sCommand.Parameters.AddWithValue("@M_NAME", this.txtName.Text);
                sCommand.Parameters.AddWithValue("@STD_TEMP", this.txtStdTemp.Text);
                sCommand.Parameters.AddWithValue("@STD_HUM", this.txtStdHum.Text);
                sCommand.Parameters.AddWithValue("@ERROR_TEMP", this.txtErrTemp.Text);
                sCommand.Parameters.AddWithValue("@ERROR_HUM", this.txtErrHum.Text);
                sCommand.Parameters.AddWithValue("@MEMO", this.txtMemo.Text);
                sCommand.Parameters.AddWithValue("@UPDATE_STAFF", (object)Common.p_strStaffNo);
                sCommand.Parameters.AddWithValue("@OLD_M_CODE", this.txtOldCode.Text);

                flag = wnAdo.SqlCommandEtc(sCommand, "Save_F_INTER_MST_Table") > 0;
                if (!flag)
                {
                    int num = (int)MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(100, ex.Message + " - " + ex.ToString());
                int num = (int)MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(flag);
        }
Esempio n. 11
0
        private bool deletePost()
        {
            bool bRet = false;

            try
            {
                wnDm  wDm  = new wnDm();
                wnAdo wAdo = new wnAdo();

                StringBuilder sb = new StringBuilder();

                sb.AppendLine(" delete from PRODUCT_COLLECT ");
                sb.AppendLine(" where COLLECT_DATE = @COLLECT_DATE ");
                sb.AppendLine("     and COLLECT_NUM = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@COLLECT_DATE", dtp일자.Text);
                sCommand.Parameters.AddWithValue("@p1", lbl번호.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Delete-PRODUCT_COLLECT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("삭제 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
            }
            return(bRet);
        }
Esempio n. 12
0
        private bool insertPost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" insert into PRODUCTKIND ( ");
                sb.AppendLine("     PRODUCT_KIND ");
                sb.AppendLine("     , CODE_DESC ");
                sb.AppendLine(" ) values ( ");
                sb.AppendLine("     @PRODUCT_KIND ");
                sb.AppendLine("     , @CODE_DESC ");
                sb.AppendLine(" ) ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@PRODUCT_KIND", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CODE_DESC", txtName.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Insert PRODUCTKIND");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 13
0
        private bool deletePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" delete from STOCK_GOAL ");
                sb.AppendLine(" where 1=1 ");
                sb.AppendLine("     and GOAL_YEAR = @p1 ");
                sb.AppendLine("     and GOAL_CODE = @p2 ");
                sb.AppendLine("     and MAN_CODE = @p3 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", "" + cmb연도.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@p2", "" + cmb구분.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@p3", txt담당자코드old.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Delete STOCK_GOAL");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("삭제 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
            }
            return(bRet);
        }
Esempio n. 14
0
        private bool deletePost()
        {
            bool bRet = false;

            try
            {
                wnDm  wDm  = new wnDm();
                wnAdo wAdo = new wnAdo();

                StringBuilder sb = new StringBuilder();

                sb.AppendLine(" delete from PRODUCT_STOCK_DEPT ");
                sb.AppendLine(" where STOCK_DATE = @STOCK_DATE ");
                sb.AppendLine("     and STOCK_NUM = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@STOCK_DATE", this.dtp일자.Text);
                sCommand.Parameters.AddWithValue("@p1", this.lbl번호.Text);
                ////sCommand.Parameters.AddWithValue("@수정사원번호", Common.p_strUserNo);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Delete-PRODUCT_STOCK_DEPT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("삭제 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
            }
            return(bRet);
        }
Esempio n. 15
0
        private bool savePost(string sCust, string sCustName)
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" exec dbo.proc_할인마감 @Day1, @Day2, @SDay, @CustCode, @UserCode ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@Day1", dtp마감일자1.Text);
                sCommand.Parameters.AddWithValue("@Day2", dtp마감일자2.Text);
                sCommand.Parameters.AddWithValue("@SDay", dtp수금일자.Text);
                sCommand.Parameters.AddWithValue("@CustCode", sCust);
                sCommand.Parameters.AddWithValue("@UserCode", Common.p_strUserCode);

                int qResult = wAdo.SqlCommandEtc(sCommand, "MaGam PRODUCT_STOCK to PRODUCT_COLLECT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("거래처 [ " + sCustName + " ]의 할인마감 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 16
0
        private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" update MAJORCODE set ");
                sb.AppendLine("     CODE_DESC = @CODE_DESC ");
                sb.AppendLine(" where 1=1 ");
                sb.AppendLine("     and MAJOR_CODE = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CODE_DESC", txtName.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update MAJORCODE");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex) {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString()); Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 17
0
        private bool deletePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" delete from USER_PASSWD ");
                sb.AppendLine(" where USER_CODE = @p1  ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", this.txtCode.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Delete USER_PASSWD");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("삭제 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
            }
            return(bRet);
        }
Esempio n. 18
0
        public int updateOutSignYn(string out_date, string out_cd, string up_prog_cd)
        {
            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();
                sb = new StringBuilder();

                sb.AppendLine("update F_ITEM_OUT set");
                sb.AppendLine("      PROG_CD = '" + up_prog_cd + "' "); // RAW_OUT_YN = 'Y',
                if (up_prog_cd.ToString().Equals("2"))
                {
                    sb.AppendLine("      ,OUT_SIGN_YN = 'Y' ");
                }
                else if (up_prog_cd.ToString().Equals("3"))
                {
                    sb.AppendLine("      ,QUAL_SIGN_YN = 'Y' ");
                }
                else
                {
                    sb.AppendLine("      ,ST_MG_SIGN_YN = 'Y' ");
                }
                sb.AppendLine("where OUT_DATE = '" + out_date + "' ");
                sb.AppendLine(" and OUT_CD = '" + out_cd + "' ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "update_PLAN_RAW_OUT");
                if (qResult > 0)
                {
                    return(0);  // 0 true, 1 false
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("error" + e.ToString());
                return(9);
            }
        }
Esempio n. 19
0
        private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" exec dbo.proc_영업소주문서결재처리 @STOCK_DATE, @STOCK_NUM ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@STOCK_DATE", dtp일자.Text);
                sCommand.Parameters.AddWithValue("@STOCK_NUM", lbl번호.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Move-PRODUCT_STOCK_DEPT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 20
0
        public void insert(String date, String title, String memo)
        {
            try
            {
                wnDm wDm = new wnDm();

                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine("	insert  into F_DATES (Title,date,Memo,color) values ('" + title + "','" + date + "','" + memo + "','" + scolor16 + "')");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "insert_RAW_CHK_EXAM_TB");
            }
            catch (Exception e)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, e.Message + " - " + e.ToString());
                Popup.pop오류리포트 msg = new pop오류리포트(e.Message + " - " + e.ToString());
                msg.ShowDialog();
                return;
            }
        }
Esempio n. 21
0
        private void clear()
        {
            try
            {
                wnDm wDm = new wnDm();

                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine("	delete from F_DATES where Date='" + dtp.Value.ToString().Substring(0, 10) + "' ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "insert_RAW_CHK_EXAM_TB");
            }
            catch (Exception e)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, e.Message + " - " + e.ToString());
                Popup.pop오류리포트 msg = new pop오류리포트(e.Message + " - " + e.ToString());
                msg.ShowDialog();
                return;
            }
        }
Esempio n. 22
0
        private bool updatePost_all()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo    = new wnAdo();
                StringBuilder sb      = new StringBuilder();
                int           nRowCnt = 0;

                wnDm      wDm = new wnDm();
                DataTable dt  = null;
                dt = wDm.fn_PRODUCT_STOCK_DEPT_Detail_결재대상들(srchDay, srchCust);

                if (dt != null && dt.Rows.Count > 0)
                {
                    string sDate_old = "";
                    string sNum_old  = "";
                    bool   bChk      = false;

                    for (int kk = 0; kk < dt.Rows.Count; kk++)
                    {
                        string sDate = dt.Rows[kk]["STOCK_DATE"].ToString();
                        string sNum  = dt.Rows[kk]["STOCK_NUM"].ToString();

                        string s할인율 = dt.Rows[kk]["할증체크"].ToString();
                        string s단가  = dt.Rows[kk]["단가체크"].ToString();
                        string s회전일 = dt.Rows[kk]["회전일체크"].ToString();

                        if (kk == 0)
                        {
                            // 첫 row 기본값 처리
                            sDate_old = sDate;
                            sNum_old  = sNum;
                            bChk      = false;
                        }

                        if (sDate_old + "_" + sNum_old != sDate + "_" + sNum)
                        {
                            if (bChk == false)
                            {
                                nRowCnt += 1;
                                sb.AppendLine(" exec dbo.proc_영업소주문서결재처리 '" + sDate_old + "', '" + sNum_old + "' ");
                            }

                            sDate_old = sDate;
                            sNum_old  = sNum;
                            bChk      = false;
                        }

                        //// 할인율 = V 체크
                        //if (s할인율 == "V")
                        //{
                        //    bChk = true;
                        //}

                        // 단가 = V 체크
                        if (s단가 == "V")
                        {
                            bChk = true;
                        }
                        // 회전일 = V 체크
                        if (s회전일 == "V")
                        {
                            bChk = true;
                        }
                    }

                    // 마지막 처리
                    if (bChk == false)
                    {
                        nRowCnt += 1;
                        sb.AppendLine(" exec dbo.proc_영업소주문서결재처리 '" + sDate_old + "', '" + sNum_old + "' ");
                    }
                }

                if (nRowCnt == 0)
                {
                    MessageBox.Show("결재조건에 적합한 주문서가 없습니다.");
                    return(false);
                }

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                //sCommand.Parameters.AddWithValue("@STOCK_DATE", srchDay);
                //sCommand.Parameters.AddWithValue("@STOCK_NUM", "");

                int qResult = wAdo.SqlCommandEtc(sCommand, "MoveAll-PRODUCT_STOCK_DEPT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 23
0
        private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" update CUSTOMER_PRE set ");
                sb.AppendLine("     CUST_NAME = @CUST_NAME ");
                sb.AppendLine("     , REP_NAME = @REP_NAME ");
                sb.AppendLine("     , COMP_NUM = @COMP_NUM ");
                sb.AppendLine("     , RES_NUM = @RES_NUM ");
                sb.AppendLine("     , ZIP_CODE1 = @ZIP_CODE1 ");
                sb.AppendLine("     , ZIP_AREA1 = @ZIP_AREA1 ");
                sb.AppendLine("     , ZIP_ADDR1 = @ZIP_ADDR1 ");
                sb.AppendLine("     , TEL_NUM1 = @TEL_NUM1 ");
                //sb.AppendLine("     , ZIP_CODE2 = @ZIP_CODE2 ");
                //sb.AppendLine("     , ZIP_AREA2 = @ZIP_AREA2 ");
                //sb.AppendLine("     , ZIP_ADDR2 = @ZIP_ADDR2 ");
                sb.AppendLine("     , TEL_NUM2 = @TEL_NUM2 ");
                sb.AppendLine("     , BUSINESS_STATUS = @BUSINESS_STATUS ");
                sb.AppendLine("     , BUSINESS_KIND = @BUSINESS_KIND ");
                sb.AppendLine("     , REG_DATE = @REG_DATE ");
                sb.AppendLine("     , DEAL_TYPE = @DEAL_TYPE ");
                //sb.AppendLine("     , SUPPLY_KIND = @SUPPLY_KIND ");
                sb.AppendLine("     , MAN_CODE = @MAN_CODE ");
                sb.AppendLine("     , MAJOR_CODE = @MAJOR_CODE ");
                sb.AppendLine("     , DEAL_KIND = @DEAL_KIND ");
                //sb.AppendLine("     , TRANS_KIND = @TRANS_KIND ");
                sb.AppendLine("     , LIMIT_AMOUNT = @LIMIT_AMOUNT ");
                //sb.AppendLine("     , BASE_AMOUNT = @BASE_AMOUNT ");
                //sb.AppendLine("     , BILL_AMOUNT = @BILL_AMOUNT ");
                sb.AppendLine("     , MEMO = @MEMO ");
                //sb.AppendLine("     , MEMO1 = @MEMO1 ");
                //sb.AppendLine("     , MEMO2 = @MEMO2 ");
                sb.AppendLine("     , CUST_NUM = @CUST_NUM ");
                sb.AppendLine("     , CUST_SAIL = @CUST_SAIL ");
                sb.AppendLine("     , 담보종류 = @담보종류 ");
                sb.AppendLine("     , 담보금액 = @담보금액 ");
                sb.AppendLine(" where 1=1 ");
                sb.AppendLine("     and CUST_CODE = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CUST_NAME", txtName.Text);
                sCommand.Parameters.AddWithValue("@REP_NAME", txt대표자명.Text);
                sCommand.Parameters.AddWithValue("@COMP_NUM", txt사업자번호.Text);
                sCommand.Parameters.AddWithValue("@RES_NUM", txt주민번호.Text);
                sCommand.Parameters.AddWithValue("@ZIP_CODE1", txt사업우편번호.Text);
                sCommand.Parameters.AddWithValue("@ZIP_AREA1", txt사업주소1.Text);
                sCommand.Parameters.AddWithValue("@ZIP_ADDR1", txt사업주소2.Text);
                sCommand.Parameters.AddWithValue("@TEL_NUM1", txt회사전화.Text);
                //sCommand.Parameters.AddWithValue("@ZIP_CODE2", "");
                //sCommand.Parameters.AddWithValue("@ZIP_AREA2", "");
                //sCommand.Parameters.AddWithValue("@ZIP_ADDR2", "");
                sCommand.Parameters.AddWithValue("@TEL_NUM2", txt회사팩스.Text);
                sCommand.Parameters.AddWithValue("@BUSINESS_STATUS", txt업태.Text);
                sCommand.Parameters.AddWithValue("@BUSINESS_KIND", txt종목.Text);
                sCommand.Parameters.AddWithValue("@REG_DATE", dtp거래개시일.Text);
                sCommand.Parameters.AddWithValue("@DEAL_TYPE", "" + cmb거래형태.SelectedValue.ToString());
                //sCommand.Parameters.AddWithValue("@SUPPLY_KIND", "0"); //0=비해당, 1=해당
                sCommand.Parameters.AddWithValue("@MAN_CODE", txt담당자코드.Text);
                sCommand.Parameters.AddWithValue("@MAJOR_CODE", "" + cmb진료과목.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@DEAL_KIND", "" + cmb거래형태.SelectedValue.ToString());
                //sCommand.Parameters.AddWithValue("@TRANS_KIND", "01"); //01=택배
                sCommand.Parameters.AddWithValue("@LIMIT_AMOUNT", txt여신한도.Text.Replace(",", ""));
                //sCommand.Parameters.AddWithValue("@BASE_AMOUNT", "0"); //기초금액
                //sCommand.Parameters.AddWithValue("@BILL_AMOUNT", "0"); //어음금액
                sCommand.Parameters.AddWithValue("@MEMO", txt비고.Text);
                //sCommand.Parameters.AddWithValue("@MEMO1", "");
                //sCommand.Parameters.AddWithValue("@MEMO2", "");
                sCommand.Parameters.AddWithValue("@CUST_NUM", txt요양기관번호.Text);
                sCommand.Parameters.AddWithValue("@CUST_SAIL", txt기초잔고.Text.Replace(",", ""));
                sCommand.Parameters.AddWithValue("@담보종류", txt담보종류.Text);
                sCommand.Parameters.AddWithValue("@담보금액", txt담보금액.Text.Replace(",", ""));

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update CUSTOMER_PRE");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 24
0
        private bool updatePost()
        {
            // 서버1에 저장시에는, 수금구분 = 71, 72는 저장하지 않음

            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" update PRODUCT_COLLECT set ");
                sb.AppendLine("     COLLECT_KIND = @COLLECT_KIND ");
                sb.AppendLine("     , CUST_CODE1 = @CUST_CODE1 ");
                sb.AppendLine("     , MAN_CODE1 = @MAN_CODE1 ");
                sb.AppendLine("     , COLLECT_AMOUNT = @COLLECT_AMOUNT ");
                sb.AppendLine("     , BILL_NUMBER = @BILL_NUMBER ");
                sb.AppendLine("     , BILL_TYPE = @BILL_TYPE ");
                sb.AppendLine("     , HANDLE_DATE = @HANDLE_DATE ");
                sb.AppendLine("     , ISSUE_DATE = @ISSUE_DATE ");
                sb.AppendLine("     , SETTLE_DATE = @SETTLE_DATE ");
                sb.AppendLine("     , SETTLE_CUST = @SETTLE_CUST ");
                sb.AppendLine("     , SETTLE_CUST1 = @SETTLE_CUST1 ");
                sb.AppendLine("     , COLLECT_NAME1 = @COLLECT_NAME1 ");
                sb.AppendLine("     , COLLECT_NAME2 = @COLLECT_NAME2 ");
                sb.AppendLine("     , MEMO = @MEMO ");
                //sb.AppendLine("     , USER_CODE = @USER_CODE ");
                sb.AppendLine("     , PRODUCT_KIND = @PRODUCT_KIND ");
                sb.AppendLine("     , CUST_NAME1 = @CUST_NAME1 ");
                sb.AppendLine("     , MAN_NAME1 = @MAN_NAME1 ");
                sb.AppendLine("     , DEPT_NAME1 = @DEPT_NAME1 ");
                sb.AppendLine("     , REP_NAME1 = @REP_NAME1 ");
                sb.AppendLine("     , COMP_NUM1 = @COMP_NUM1 ");
                sb.AppendLine("     , KIND_AB = @KIND_AB ");
                sb.AppendLine("     , DEAL_TYPE = @DEAL_TYPE ");
                sb.AppendLine("     , DEPT_CODE1 = @DEPT_CODE1 ");
                //sb.AppendLine("     , 미송구분 = @미송구분 ");
                sb.AppendLine(" where COLLECT_DATE = @COLLECT_DATE ");
                sb.AppendLine("     and COLLECT_NUM = @p1 ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@COLLECT_DATE", dtp일자.Text);
                sCommand.Parameters.AddWithValue("@p1", lbl번호.Text);
                sCommand.Parameters.AddWithValue("@COLLECT_KIND", "" + cmb구분.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@CUST_CODE1", txt거래처코드.Text);
                sCommand.Parameters.AddWithValue("@MAN_CODE1", txt담당자코드.Text);
                if ("" + cmb구분.SelectedValue.ToString() == "53")
                {
                    sCommand.Parameters.AddWithValue("@COLLECT_AMOUNT", (-1 * decimal.Parse(txt금액.Text.Replace(",", ""))).ToString());
                }
                else
                {
                    sCommand.Parameters.AddWithValue("@COLLECT_AMOUNT", txt금액.Text.Replace(",", ""));
                }
                sCommand.Parameters.AddWithValue("@BILL_NUMBER", txt어음번호.Text);
                sCommand.Parameters.AddWithValue("@BILL_TYPE", "" + cmb처리형태.SelectedValue.ToString());

                sCommand.Parameters.AddWithValue("@HANDLE_DATE", (dtp처리일자.Text == "1900-01-01" ? "0000-00-00" : dtp처리일자.Text));
                sCommand.Parameters.AddWithValue("@ISSUE_DATE", (dtp발행일자.Text == "1900-01-01" ? "0000-00-00" : dtp발행일자.Text));
                sCommand.Parameters.AddWithValue("@SETTLE_DATE", (dtp만기일자.Text == "1900-01-01" ? "0000-00-00" : dtp만기일자.Text));

                sCommand.Parameters.AddWithValue("@SETTLE_CUST", txt발행은행.Text);
                sCommand.Parameters.AddWithValue("@SETTLE_CUST1", txt지급처.Text);
                sCommand.Parameters.AddWithValue("@COLLECT_NAME1", txt발행인.Text);
                sCommand.Parameters.AddWithValue("@COLLECT_NAME2", txt배서인.Text);
                sCommand.Parameters.AddWithValue("@MEMO", txt비고.Text);
                //sCommand.Parameters.AddWithValue("@USER_CODE", Common.p_strUserCode);
                if (rb급여.Checked == true)
                {
                    sCommand.Parameters.AddWithValue("@PRODUCT_KIND", "10");
                }
                else
                {
                    sCommand.Parameters.AddWithValue("@PRODUCT_KIND", "20");
                }
                sCommand.Parameters.AddWithValue("@CUST_NAME1", txt거래처명.Text);
                sCommand.Parameters.AddWithValue("@MAN_NAME1", txt담당자명.Text);
                sCommand.Parameters.AddWithValue("@DEPT_NAME1", txt부서명.Text);
                sCommand.Parameters.AddWithValue("@REP_NAME1", lbl대표자.Text);
                sCommand.Parameters.AddWithValue("@COMP_NUM1", lbl사업자번호.Text);

                sCommand.Parameters.AddWithValue("@KIND_AB", (chk수금구분.Checked == true ? "1" : "0"));
                sCommand.Parameters.AddWithValue("@DEAL_TYPE", txt거래형태.Text);
                sCommand.Parameters.AddWithValue("@DEPT_CODE1", txt부서코드.Text);
                //sCommand.Parameters.AddWithValue("@미송구분", "");

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update-PRODUCT_COLLECT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex) {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString()); Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
            }
            return(bRet);
        }
Esempio n. 25
0
        private bool insertPost()
        {
            // 서버1에 저장시에는, 수금구분 = 71, 72는 저장하지 않음

            bool bRet = false;

            try
            {
                wnAdo wAdo = new wnAdo();

                StringBuilder sb = new StringBuilder();
                sb = new StringBuilder();

                string sRetVal = "";

                string s구분코드 = "" + cmb구분.SelectedValue.ToString();

                if (s구분코드 != "71" && s구분코드 != "72" && s구분코드 != "73" && s구분코드 != "90")
                {
                    //일반용 전표번호
                    sb.AppendLine(" select right('000' + convert(nvarchar(4), isnull(max(convert(int, COLLECT_NUM)), 0) + 1), 4) ");
                    sb.AppendLine(" from PRODUCT_COLLECT ");
                    sb.AppendLine(" where COLLECT_DATE = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ");
                    sb.AppendLine("     and COLLECT_NUM < '7000' ");
                }
                else
                {
                    if (s구분코드 == "90")
                    {
                        sb.AppendLine(" select right('000' + convert(nvarchar(4), isnull(max(convert(int, COLLECT_NUM)), 9000) + 1), 4) ");
                        sb.AppendLine(" from PRODUCT_COLLECT ");
                        sb.AppendLine(" where COLLECT_DATE = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ");
                        sb.AppendLine("     and COLLECT_NUM > '9000' ");
                    }
                    else
                    {
                        sb.AppendLine(" select @maxKey = right('000' + convert(nvarchar(4), isnull(max(convert(int, COLLECT_NUM)), 7000) + 1), 4) ");
                        sb.AppendLine(" from PRODUCT_COLLECT ");
                        sb.AppendLine(" where COLLECT_DATE = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ");
                        sb.AppendLine("     and COLLECT_NUM > '7000' ");
                        sb.AppendLine("     and COLLECT_NUM < '9000' ");
                    }
                }

                sRetVal = wConst.maxValue_Check(sb.ToString());
                if (sRetVal == "")
                {
                    MessageBox.Show("데이터 검색 중 오류 발생!!!");
                    return(false);
                }

                lbl번호.Text = sRetVal;

                sb = new StringBuilder();

                sb.AppendLine(" declare @maxKey nvarchar(4) ");
                sb.AppendLine(" set @maxKey = '" + sRetVal + "' ");

                sb.AppendLine(" insert into PRODUCT_COLLECT ( ");
                sb.AppendLine("     COLLECT_DATE ");
                sb.AppendLine("     , COLLECT_NUM ");
                sb.AppendLine("     , COLLECT_KIND ");
                sb.AppendLine("     , CUST_CODE1 ");
                sb.AppendLine("     , MAN_CODE1 ");
                sb.AppendLine("     , COLLECT_AMOUNT ");
                sb.AppendLine("     , BILL_NUMBER ");
                sb.AppendLine("     , BILL_TYPE ");
                sb.AppendLine("     , HANDLE_DATE ");
                sb.AppendLine("     , ISSUE_DATE ");
                sb.AppendLine("     , SETTLE_DATE ");
                sb.AppendLine("     , SETTLE_CUST ");
                sb.AppendLine("     , SETTLE_CUST1 ");
                sb.AppendLine("     , COLLECT_NAME1 ");
                sb.AppendLine("     , COLLECT_NAME2 ");
                sb.AppendLine("     , MEMO ");
                sb.AppendLine("     , USER_CODE ");
                sb.AppendLine("     , PRODUCT_KIND ");
                sb.AppendLine("     , CUST_NAME1 ");
                sb.AppendLine("     , MAN_NAME1 ");
                sb.AppendLine("     , DEPT_NAME1 ");
                sb.AppendLine("     , REP_NAME1 ");
                sb.AppendLine("     , COMP_NUM1 ");
                sb.AppendLine("     , KIND_AB ");
                sb.AppendLine("     , DEAL_TYPE ");
                sb.AppendLine("     , DEPT_CODE1 ");
                sb.AppendLine("     , INSERT_DATE ");
                sb.AppendLine("     , 미송구분 ");
                sb.AppendLine("     , CHK_PRT ");
                sb.AppendLine(" ) values ( ");
                sb.AppendLine("     @COLLECT_DATE ");
                sb.AppendLine("     , @maxKey ");
                sb.AppendLine("     , @COLLECT_KIND ");
                sb.AppendLine("     , @CUST_CODE1 ");
                sb.AppendLine("     , @MAN_CODE1 ");
                sb.AppendLine("     , @COLLECT_AMOUNT ");
                sb.AppendLine("     , @BILL_NUMBER ");
                sb.AppendLine("     , @BILL_TYPE ");
                sb.AppendLine("     , @HANDLE_DATE ");
                sb.AppendLine("     , @ISSUE_DATE ");
                sb.AppendLine("     , @SETTLE_DATE ");
                sb.AppendLine("     , @SETTLE_CUST ");
                sb.AppendLine("     , @SETTLE_CUST1 ");
                sb.AppendLine("     , @COLLECT_NAME1 ");
                sb.AppendLine("     , @COLLECT_NAME2 ");
                sb.AppendLine("     , @MEMO ");
                sb.AppendLine("     , @USER_CODE ");
                sb.AppendLine("     , @PRODUCT_KIND ");
                sb.AppendLine("     , @CUST_NAME1 ");
                sb.AppendLine("     , @MAN_NAME1 ");
                sb.AppendLine("     , @DEPT_NAME1 ");
                sb.AppendLine("     , @REP_NAME1 ");
                sb.AppendLine("     , @COMP_NUM1 ");
                sb.AppendLine("     , @KIND_AB ");
                sb.AppendLine("     , @DEAL_TYPE ");
                sb.AppendLine("     , @DEPT_CODE1 ");
                sb.AppendLine("     , getdate() "); //INSERT_DATE
                sb.AppendLine("     , @미송구분 ");
                sb.AppendLine("     , '0' ");
                sb.AppendLine(" ) ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@COLLECT_DATE", dtp일자.Text);
                sCommand.Parameters.AddWithValue("@COLLECT_KIND", "" + cmb구분.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@CUST_CODE1", txt거래처코드.Text);
                sCommand.Parameters.AddWithValue("@MAN_CODE1", txt담당자코드.Text);
                if ("" + cmb구분.SelectedValue.ToString() == "53")
                {
                    sCommand.Parameters.AddWithValue("@COLLECT_AMOUNT", (-1 * decimal.Parse(txt금액.Text.Replace(",", ""))).ToString());
                }
                else
                {
                    sCommand.Parameters.AddWithValue("@COLLECT_AMOUNT", txt금액.Text.Replace(",", ""));
                }
                sCommand.Parameters.AddWithValue("@BILL_NUMBER", txt어음번호.Text);
                sCommand.Parameters.AddWithValue("@BILL_TYPE", "" + cmb처리형태.SelectedValue.ToString());

                sCommand.Parameters.AddWithValue("@HANDLE_DATE", (dtp처리일자.Text == "1900-01-01" ? "0000-00-00" : dtp처리일자.Text));
                sCommand.Parameters.AddWithValue("@ISSUE_DATE", (dtp발행일자.Text == "1900-01-01" ? "0000-00-00" : dtp발행일자.Text));
                sCommand.Parameters.AddWithValue("@SETTLE_DATE", (dtp만기일자.Text == "1900-01-01" ? "0000-00-00" : dtp만기일자.Text));

                sCommand.Parameters.AddWithValue("@SETTLE_CUST", txt발행은행.Text);
                sCommand.Parameters.AddWithValue("@SETTLE_CUST1", txt지급처.Text);
                sCommand.Parameters.AddWithValue("@COLLECT_NAME1", txt발행인.Text);
                sCommand.Parameters.AddWithValue("@COLLECT_NAME2", txt배서인.Text);
                sCommand.Parameters.AddWithValue("@MEMO", txt비고.Text);
                sCommand.Parameters.AddWithValue("@USER_CODE", Common.p_strUserCode);
                if (rb급여.Checked == true)
                {
                    sCommand.Parameters.AddWithValue("@PRODUCT_KIND", "10");
                }
                else
                {
                    sCommand.Parameters.AddWithValue("@PRODUCT_KIND", "20");
                }
                sCommand.Parameters.AddWithValue("@CUST_NAME1", txt거래처명.Text);
                sCommand.Parameters.AddWithValue("@MAN_NAME1", txt담당자명.Text);
                sCommand.Parameters.AddWithValue("@DEPT_NAME1", txt부서명.Text);
                sCommand.Parameters.AddWithValue("@REP_NAME1", lbl대표자.Text);
                sCommand.Parameters.AddWithValue("@COMP_NUM1", lbl사업자번호.Text);

                sCommand.Parameters.AddWithValue("@KIND_AB", (chk수금구분.Checked == true ? "1" : "0"));
                sCommand.Parameters.AddWithValue("@DEAL_TYPE", txt거래형태.Text);
                sCommand.Parameters.AddWithValue("@DEPT_CODE1", txt부서코드.Text);
                sCommand.Parameters.AddWithValue("@미송구분", "");

                int qResult = wAdo.SqlCommandEtc(sCommand, "Insert-PRODUCT_COLLECT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex) {
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
            }
            return(bRet);
        }
        private bool insertPost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" insert into DEPTCODE ( ");
                sb.AppendLine("     DEPT_CODE ");
                sb.AppendLine("     , CODE_DESC ");
                sb.AppendLine("     , USE_CHECK ");
                sb.AppendLine("     , 구분 ");
                sb.AppendLine("     , 조회순서 ");
                sb.AppendLine("     , 소계 ");
                sb.AppendLine("     , 부서계 ");
                sb.AppendLine("     , AreaCode ");
                sb.AppendLine(" ) values ( ");
                sb.AppendLine("     @DEPT_CODE ");
                sb.AppendLine("     , @CODE_DESC ");
                sb.AppendLine("     , @USE_CHECK ");
                sb.AppendLine("     , @구분 ");
                sb.AppendLine("     , @조회순서 ");
                sb.AppendLine("     , @소계 ");
                sb.AppendLine("     , @부서계 ");
                sb.AppendLine("     , @AreaCode ");
                sb.AppendLine(" ) ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@DEPT_CODE", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CODE_DESC", txtName.Text);
                sCommand.Parameters.AddWithValue("@USE_CHECK", "" + cmb사용여부.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@구분", "" + cmb구분.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@조회순서", txt조회순서.Text);
                sCommand.Parameters.AddWithValue("@소계", txt소계.Text);
                sCommand.Parameters.AddWithValue("@부서계", txt부서계.Text);
                sCommand.Parameters.AddWithValue("@AreaCode", "" + cmb지역.SelectedValue.ToString());

                int qResult = wAdo.SqlCommandEtc(sCommand, "Insert DEPTCODE");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
        private bool updatePost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" declare @cnt int ");

                // 최종처리자 = -1 : 아래 처리 후 삭제 대상임.
                sb.AppendLine(" update CUST_DISCOUNT set ");
                sb.AppendLine("     최종처리자 = '(삭제)' ");
                sb.AppendLine(" where 거래처코드 = @p1  ");

                int nRowCnt = 0;

                for (int kk = 0; kk < grdItem.Rows.Count; kk++)
                {
                    string s코드  = "";
                    string s명칭  = "";
                    string s규격  = "";
                    string s할인율 = "";

                    s코드  = "" + (string)grdItem.Rows[kk].Cells[4].Value;
                    s명칭  = "" + (string)grdItem.Rows[kk].Cells[5].Value;
                    s규격  = "" + (string)grdItem.Rows[kk].Cells[6].Value;
                    s할인율 = ("" + (string)grdItem.Rows[kk].Cells[11].Value).Replace(",", "");

                    if (s코드 != "")
                    {
                        nRowCnt += 1;

                        sb.AppendLine(" select @cnt = count(*) from CUST_DISCOUNT ");
                        sb.AppendLine(" where 거래처코드 = @p1 ");
                        sb.AppendLine("     and 제품코드 = '" + s코드 + "' ");

                        sb.AppendLine(" if (@cnt = 0) ");
                        sb.AppendLine(" begin ");

                        // ####################################################################################
                        sb.AppendLine(" insert into CUST_DISCOUNT ( ");
                        sb.AppendLine("     거래처코드 ");
                        sb.AppendLine("     , 거래처명 ");
                        sb.AppendLine("     , 제품코드 ");
                        sb.AppendLine("     , 제품명 ");
                        sb.AppendLine("     , 규격 ");
                        sb.AppendLine("     , 할인율 ");
                        sb.AppendLine("     , 입력자 ");
                        sb.AppendLine("     , 입력자명 ");
                        sb.AppendLine("     , 최종처리자 ");
                        sb.AppendLine("     , 최종처리일 ");
                        sb.AppendLine("     , 비고 ");
                        sb.AppendLine(" ) values ( ");
                        sb.AppendLine("     @p1 ");
                        sb.AppendLine("     , @거래처명 ");
                        sb.AppendLine("     , '" + s코드 + "' ");
                        sb.AppendLine("     , '" + s명칭 + "' ");
                        sb.AppendLine("     , '" + s규격 + "' ");
                        sb.AppendLine("     , " + s할인율 + " ");
                        sb.AppendLine("     , @입력자 ");
                        sb.AppendLine("     , @입력자명 ");
                        sb.AppendLine("     , @최종처리자 ");
                        sb.AppendLine("     , getdate() ");
                        sb.AppendLine("     , '' ");
                        sb.AppendLine(" ) ");

                        sb.AppendLine(" end ");
                        sb.AppendLine(" else ");
                        sb.AppendLine(" begin ");

                        // ####################################################################################
                        sb.AppendLine(" update CUST_DISCOUNT set ");
                        sb.AppendLine("     할인율 = " + s할인율 + " ");
                        sb.AppendLine("     , 최종처리자 = @최종처리자 ");
                        sb.AppendLine("     , 최종처리일 = getdate() ");
                        sb.AppendLine(" where 거래처코드 = @p1 ");
                        sb.AppendLine("     and 제품코드 = '" + s코드 + "' ");

                        sb.AppendLine(" end ");
                    }
                }

                if (nRowCnt == 0)
                {
                    MessageBox.Show("[ 상품 정보 ] 를 입력하세요.");
                    return(false);
                }

                sb.AppendLine(" delete from CUST_DISCOUNT ");
                sb.AppendLine(" where 거래처코드 = @p1 ");
                sb.AppendLine("     and 최종처리자 = '(삭제)' ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@p1", txt거래처코드old.Text);
                sCommand.Parameters.AddWithValue("@거래처명", txt거래처명.Text);
                sCommand.Parameters.AddWithValue("@입력자", Common.p_strUserID);
                sCommand.Parameters.AddWithValue("@입력자명", "" + Common.p_strUserName);
                sCommand.Parameters.AddWithValue("@최종처리자", "" + Common.p_strUserID);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Update CUST_DISCOUNT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex) {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString()); Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
        private bool insertPost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                sb.AppendLine(" select isnull(max(convert(int, MAN_CODE)), " + cmb부서지역.SelectedValue.ToString() + "000) + 1 ");
                sb.AppendLine(" from MANCODE where MAN_CODE like '" + cmb부서지역.SelectedValue.ToString() + "%' ");
                string sRetVal = wConst.maxValue_Check(sb.ToString());
                if (sRetVal == "")
                {
                    MessageBox.Show("데이터 검색 중 오류 발생!!!");
                    return(false);
                }

                if (int.Parse("" + cmb부서지역.SelectedValue.ToString() + "999") < int.Parse(sRetVal))
                {
                    MessageBox.Show("부서별로 규정된 범위를 초과하는 [ 코드 ]입니다." + " [ " + sRetVal + " ]");
                    return(false);
                }

                sb = new StringBuilder();

                sb.AppendLine(" insert into MANCODE ( ");
                sb.AppendLine("     MAN_CODE ");
                sb.AppendLine("     , CODE_DESC ");
                sb.AppendLine("     , 직급 ");
                sb.AppendLine("     , DEPT_CODE ");
                sb.AppendLine("     , 입사일자 ");
                sb.AppendLine("     , MAN_OUTCHK ");
                sb.AppendLine("     , 퇴사일자 ");
                sb.AppendLine(" ) values ( ");
                sb.AppendLine("     @MAN_CODE ");
                sb.AppendLine("     , @CODE_DESC ");
                sb.AppendLine("     , @직급 ");
                sb.AppendLine("     , @DEPT_CODE ");
                sb.AppendLine("     , @입사일자 ");
                sb.AppendLine("     , @MAN_OUTCHK ");
                sb.AppendLine("     , @퇴사일자 ");
                sb.AppendLine(" ) ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@MAN_CODE", sRetVal);
                sCommand.Parameters.AddWithValue("@CODE_DESC", txtName.Text);
                sCommand.Parameters.AddWithValue("@직급", txt직급.Text);
                sCommand.Parameters.AddWithValue("@DEPT_CODE", "" + cmb부서.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@입사일자", (dtp입사일자.Text == "1900-01-01" ? "" : dtp입사일자.Text));
                sCommand.Parameters.AddWithValue("@MAN_OUTCHK", (chk퇴사구분.Checked == true ? "1" : "0"));
                sCommand.Parameters.AddWithValue("@퇴사일자", (dtp퇴사일자.Text == "1900-01-01" ? "" : dtp퇴사일자.Text));

                int qResult = wAdo.SqlCommandEtc(sCommand, "Insert MANCODE");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
        private bool insertPost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                int nRowCnt = 0;

                for (int kk = 0; kk < grdItem.Rows.Count; kk++)
                {
                    string s코드  = "";
                    string s명칭  = "";
                    string s규격  = "";
                    string s할인율 = "";

                    s코드  = "" + (string)grdItem.Rows[kk].Cells[4].Value;
                    s명칭  = "" + (string)grdItem.Rows[kk].Cells[5].Value;
                    s규격  = "" + (string)grdItem.Rows[kk].Cells[6].Value;
                    s할인율 = ("" + (string)grdItem.Rows[kk].Cells[11].Value).Replace(",", "");

                    if (s코드 != "")
                    {
                        nRowCnt += 1;

                        sb.AppendLine(" insert into CUST_DISCOUNT ( ");
                        sb.AppendLine("     거래처코드 ");
                        sb.AppendLine("     , 거래처명 ");
                        sb.AppendLine("     , 제품코드 ");
                        sb.AppendLine("     , 제품명 ");
                        sb.AppendLine("     , 규격 ");
                        sb.AppendLine("     , 할인율 ");
                        sb.AppendLine("     , 입력자 ");
                        sb.AppendLine("     , 입력자명 ");
                        sb.AppendLine("     , 최종처리자 ");
                        sb.AppendLine("     , 최종처리일 ");
                        sb.AppendLine("     , 비고 ");
                        sb.AppendLine(" ) values ( ");
                        sb.AppendLine("     @거래처코드 ");
                        sb.AppendLine("     , @거래처명 ");
                        sb.AppendLine("     , '" + s코드 + "' ");
                        sb.AppendLine("     , '" + s명칭 + "' ");
                        sb.AppendLine("     , '" + s규격 + "' ");
                        sb.AppendLine("     , " + s할인율 + " ");
                        sb.AppendLine("     , @입력자 ");
                        sb.AppendLine("     , @입력자명 ");
                        sb.AppendLine("     , @최종처리자 ");
                        sb.AppendLine("     , getdate() ");
                        sb.AppendLine("     , '' ");
                        sb.AppendLine(" ) ");
                    }
                }

                if (nRowCnt == 0)
                {
                    MessageBox.Show("[ 상품 정보 ] 를 입력하세요.");
                    return(false);
                }

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                sCommand.Parameters.AddWithValue("@거래처코드", txt거래처코드.Text);
                sCommand.Parameters.AddWithValue("@거래처명", txt거래처명.Text);
                sCommand.Parameters.AddWithValue("@입력자", Common.p_strUserID);
                sCommand.Parameters.AddWithValue("@입력자명", "" + Common.p_strUserName);
                sCommand.Parameters.AddWithValue("@최종처리자", "" + Common.p_strUserID);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Insert CUST_DISCOUNT");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }
Esempio n. 30
0
        private bool insertPost()
        {
            bool bRet = false;

            try
            {
                wnAdo         wAdo = new wnAdo();
                StringBuilder sb   = new StringBuilder();

                string sRetVal = "";

                sb.AppendLine(" select right('000000' + convert(nvarchar(7), isnull(max(convert(int, CUST_CODE)), 0) + 1), 7) ");
                sb.AppendLine(" from CUSTOMER_PRE ");
                sb.AppendLine(" where substring(CUST_CODE, 1, 4) = '" + txt담당자코드.Text.Trim() + "' ");

                sRetVal = wConst.maxValue_Check(sb.ToString());
                if (sRetVal == "")
                {
                    MessageBox.Show("데이터 검색 중 오류 발생!!!");
                    return(false);
                }
                if (sRetVal == "000001")
                {
                    sRetVal = txt담당자코드.Text.Trim() + "001";
                }

                txtCode.Text = sRetVal;

                sb = new StringBuilder();

                sb.AppendLine("declare @maxKey nvarchar(7) ");
                sb.AppendLine("set @maxKey = '" + sRetVal + "' ");

                sb.AppendLine(" insert into CUSTOMER_PRE ( ");
                sb.AppendLine("     CUST_CODE ");
                sb.AppendLine("     , CUST_NAME ");
                sb.AppendLine("     , REP_NAME ");
                sb.AppendLine("     , COMP_NUM ");
                sb.AppendLine("     , RES_NUM ");
                sb.AppendLine("     , ZIP_CODE1 ");
                sb.AppendLine("     , ZIP_AREA1 ");
                sb.AppendLine("     , ZIP_ADDR1 ");
                sb.AppendLine("     , TEL_NUM1 ");
                sb.AppendLine("     , ZIP_CODE2 ");
                sb.AppendLine("     , ZIP_AREA2 ");
                sb.AppendLine("     , ZIP_ADDR2 ");
                sb.AppendLine("     , TEL_NUM2 ");
                sb.AppendLine("     , BUSINESS_STATUS ");
                sb.AppendLine("     , BUSINESS_KIND ");
                sb.AppendLine("     , REG_DATE ");
                sb.AppendLine("     , DEAL_TYPE ");
                sb.AppendLine("     , SUPPLY_KIND ");
                sb.AppendLine("     , MAN_CODE ");
                sb.AppendLine("     , MAJOR_CODE ");
                sb.AppendLine("     , DEAL_KIND ");
                sb.AppendLine("     , TRANS_KIND ");
                sb.AppendLine("     , LIMIT_AMOUNT ");
                sb.AppendLine("     , BASE_AMOUNT ");
                sb.AppendLine("     , BILL_AMOUNT ");
                sb.AppendLine("     , MEMO ");
                sb.AppendLine("     , MEMO1 ");
                sb.AppendLine("     , MEMO2 ");
                sb.AppendLine("     , CUST_NUM ");
                sb.AppendLine("     , CUST_SAIL ");
                sb.AppendLine("     , 담보종류 ");
                sb.AppendLine("     , 담보금액 ");
                sb.AppendLine(" ) values ( ");
                sb.AppendLine("     @maxKey ");
                sb.AppendLine("     , @CUST_NAME ");
                sb.AppendLine("     , @REP_NAME ");
                sb.AppendLine("     , @COMP_NUM ");
                sb.AppendLine("     , @RES_NUM ");
                sb.AppendLine("     , @ZIP_CODE1 ");
                sb.AppendLine("     , @ZIP_AREA1 ");
                sb.AppendLine("     , @ZIP_ADDR1 ");
                sb.AppendLine("     , @TEL_NUM1 ");
                sb.AppendLine("     , @ZIP_CODE2 ");
                sb.AppendLine("     , @ZIP_AREA2 ");
                sb.AppendLine("     , @ZIP_ADDR2 ");
                sb.AppendLine("     , @TEL_NUM2 ");
                sb.AppendLine("     , @BUSINESS_STATUS ");
                sb.AppendLine("     , @BUSINESS_KIND ");
                sb.AppendLine("     , @REG_DATE ");
                sb.AppendLine("     , @DEAL_TYPE ");
                sb.AppendLine("     , @SUPPLY_KIND ");
                sb.AppendLine("     , @MAN_CODE ");
                sb.AppendLine("     , @MAJOR_CODE ");
                sb.AppendLine("     , @DEAL_KIND ");
                sb.AppendLine("     , @TRANS_KIND ");
                sb.AppendLine("     , @LIMIT_AMOUNT ");
                sb.AppendLine("     , @BASE_AMOUNT ");
                sb.AppendLine("     , @BILL_AMOUNT ");
                sb.AppendLine("     , @MEMO ");
                sb.AppendLine("     , @MEMO1 ");
                sb.AppendLine("     , @MEMO2 ");
                sb.AppendLine("     , @CUST_NUM ");
                sb.AppendLine("     , @CUST_SAIL ");
                sb.AppendLine("     , @담보종류 ");
                sb.AppendLine("     , @담보금액 ");
                sb.AppendLine(" ) ");

                //sb.AppendLine(" insert into MAN_BASEAMOUNT ( ");
                //sb.AppendLine("     CUST_CODE ");
                //sb.AppendLine("     , MAN_CODE ");
                //sb.AppendLine("     , MAN_NAME ");
                //sb.AppendLine("     , BASE_AMOUNT ");
                //sb.AppendLine("     , KIND1_AMOUNT ");
                //sb.AppendLine("     , KIND2_AMOUNT ");
                //sb.AppendLine("     , RPT_LINE ");
                //sb.AppendLine("     , RPT_AMOUNT ");
                //sb.AppendLine("     , RPT_DATE ");
                //sb.AppendLine("     , CARD_NUM ");
                //sb.AppendLine("     , START_DATE ");
                //sb.AppendLine("     , LAST_AMOUNT ");
                //sb.AppendLine(" ) values ( ");
                //sb.AppendLine("     @maxKey ");
                //sb.AppendLine("     , @MAN_CODE ");
                //sb.AppendLine("     , @p_MAN_NAME ");
                //sb.AppendLine("     , 0 ");
                //sb.AppendLine("     , 0 ");
                //sb.AppendLine("     , 0 ");
                //sb.AppendLine("     , 0 ");
                //sb.AppendLine("     , 0 ");
                //sb.AppendLine("     , '' ");
                //sb.AppendLine("     , '' ");
                //sb.AppendLine("     , '1990-01-01' ");
                //sb.AppendLine("     , 0 ");
                //sb.AppendLine(" ) ");

                SqlCommand sCommand = new SqlCommand(sb.ToString());

                //sCommand.Parameters.AddWithValue("@CUST_CODE", txtCode.Text);
                sCommand.Parameters.AddWithValue("@CUST_NAME", txtName.Text);
                sCommand.Parameters.AddWithValue("@REP_NAME", txt대표자명.Text);
                sCommand.Parameters.AddWithValue("@COMP_NUM", txt사업자번호.Text);
                sCommand.Parameters.AddWithValue("@RES_NUM", txt주민번호.Text);
                sCommand.Parameters.AddWithValue("@ZIP_CODE1", txt사업우편번호.Text);
                sCommand.Parameters.AddWithValue("@ZIP_AREA1", txt사업주소1.Text);
                sCommand.Parameters.AddWithValue("@ZIP_ADDR1", txt사업주소2.Text);
                sCommand.Parameters.AddWithValue("@TEL_NUM1", txt회사전화.Text);
                sCommand.Parameters.AddWithValue("@ZIP_CODE2", "");
                sCommand.Parameters.AddWithValue("@ZIP_AREA2", "");
                sCommand.Parameters.AddWithValue("@ZIP_ADDR2", "");
                sCommand.Parameters.AddWithValue("@TEL_NUM2", txt회사팩스.Text);
                sCommand.Parameters.AddWithValue("@BUSINESS_STATUS", txt업태.Text);
                sCommand.Parameters.AddWithValue("@BUSINESS_KIND", txt종목.Text);
                sCommand.Parameters.AddWithValue("@REG_DATE", dtp거래개시일.Text);
                sCommand.Parameters.AddWithValue("@DEAL_TYPE", "" + cmb거래형태.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@SUPPLY_KIND", "0"); //0=비해당, 1=해당
                sCommand.Parameters.AddWithValue("@MAN_CODE", txt담당자코드.Text);
                sCommand.Parameters.AddWithValue("@MAJOR_CODE", "" + cmb진료과목.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@DEAL_KIND", "" + cmb거래형태.SelectedValue.ToString());
                sCommand.Parameters.AddWithValue("@TRANS_KIND", "01"); //01=택배
                sCommand.Parameters.AddWithValue("@LIMIT_AMOUNT", txt여신한도.Text.Replace(",", ""));
                sCommand.Parameters.AddWithValue("@BASE_AMOUNT", "0"); //기초금액
                sCommand.Parameters.AddWithValue("@BILL_AMOUNT", "0"); //어음금액
                sCommand.Parameters.AddWithValue("@MEMO", txt비고.Text);
                sCommand.Parameters.AddWithValue("@MEMO1", "");
                sCommand.Parameters.AddWithValue("@MEMO2", "");
                sCommand.Parameters.AddWithValue("@CUST_NUM", txt요양기관번호.Text);
                sCommand.Parameters.AddWithValue("@CUST_SAIL", txt기초잔고.Text.Replace(",", ""));
                sCommand.Parameters.AddWithValue("@담보종류", txt담보종류.Text);
                sCommand.Parameters.AddWithValue("@담보금액", txt담보금액.Text.Replace(",", ""));

                sCommand.Parameters.AddWithValue("@p_MAN_NAME", txt담당자명.Text);

                int qResult = wAdo.SqlCommandEtc(sCommand, "Insert CUSTOMER_PRE");
                if (qResult > 0)
                {
                    bRet = true;
                }
                else
                {
                    bRet = false;
                }

                if (bRet == true)
                {
                }
                else
                {
                    MessageBox.Show("저장 중에 오류가 발생했습니다.");
                }
            }
            catch (Exception ex)
            {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString());
                MessageBox.Show("데이터베이스에 문제가 발생했습니다.");
            }
            return(bRet);
        }