示例#1
0
        internal Message SaveCompany(COMPANY_VO vo, bool update)
        {
            CompanyDAC dac = new CompanyDAC();

            return(dac.SaveCompany(vo, update));
        }
示例#2
0
        public Message SaveCompany(COMPANY_VO vo, bool update)
        {
            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = new SqlConnection(this.ConnectionString);
                    cmd.CommandText = "SP_SaveCompany";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@P_UPDATE", update);
                    cmd.Parameters.AddWithValue("@P_COM_CODE", vo.COM_CODE);
                    cmd.Parameters.AddWithValue("@P_COM_NAME", vo.COM_NAME);
                    cmd.Parameters.AddWithValue("@P_COM_TYP", vo.COM_TYP);
                    cmd.Parameters.AddWithValue("@P_COM_CEO", vo.COM_CEO);
                    cmd.Parameters.AddWithValue("@P_COM_REG_NUM", vo.COM_REG_NUM);
                    cmd.Parameters.AddWithValue("@P_COM_TYP_INDSTRY", vo.COM_TYP_INDSTRY);
                    cmd.Parameters.AddWithValue("@P_COM_TYP_BSNS", vo.COM_TYP_BSNS);
                    cmd.Parameters.AddWithValue("@P_COM_MANAGER", vo.COM_MANAGER);
                    cmd.Parameters.AddWithValue("@P_COM_EML", vo.COM_EML);
                    cmd.Parameters.AddWithValue("@P_COM_TEL", vo.COM_TEL);
                    cmd.Parameters.AddWithValue("@P_COM_FAX", vo.COM_FAX);
                    cmd.Parameters.Add(new SqlParameter("@P_COM_STR_DATE", System.Data.SqlDbType.DateTime));
                    cmd.Parameters["@P_COM_STR_DATE"].Value = (object)vo.COM_STR_DATE ?? DBNull.Value;
                    cmd.Parameters.Add(new SqlParameter("@P_COM_END_DATE", System.Data.SqlDbType.DateTime));
                    cmd.Parameters["@P_COM_END_DATE"].Value = (object)vo.COM_END_DATE ?? DBNull.Value;
                    cmd.Parameters.AddWithValue("@P_COM_TRAD_YN", vo.COM_TRAD_YN);
                    cmd.Parameters.AddWithValue("@P_COM_AUTOIN_YN", vo.COM_AUTOIN_YN);
                    cmd.Parameters.AddWithValue("@P_COM_START_YN", vo.COM_START_YN);
                    cmd.Parameters.AddWithValue("@P_COM_USE_YN", vo.COM_USE_YN);
                    cmd.Parameters.AddWithValue("@P_COM_INFO", vo.COM_INFO);
                    cmd.Parameters.AddWithValue("@P_COM_LAST_MDFR", vo.COM_LAST_MDFR);
                    cmd.Parameters.AddWithValue("@P_COM_LAST_MDFY", vo.COM_LAST_MDFY);
                    cmd.Parameters.Add(new SqlParameter("@P_ReturnCode", System.Data.SqlDbType.NVarChar, 5));
                    cmd.Parameters["@P_ReturnCode"].Direction = System.Data.ParameterDirection.Output;

                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                    cmd.Connection.Close();

                    string  result  = cmd.Parameters["@P_ReturnCode"].Value.ToString();
                    Message message = new Message();
                    if (result == "S01")
                    {
                        message.IsSuccess     = true;
                        message.ResultMessage = "성공적으로 등록되었습니다.";
                    }
                    else if (result == "S02")
                    {
                        message.IsSuccess     = true;
                        message.ResultMessage = "성공적으로 수정되었습니다.";
                    }
                    else if (result == "S03")
                    {
                        message.IsSuccess     = false;
                        message.ResultMessage = "코드 중복";
                    }
                    else if (result == "S00")
                    {
                        message.IsSuccess     = false;
                        message.ResultMessage = "실패하였습니다.";
                    }

                    return(message);
                }
            }
            catch (Exception err)
            {
                return(new Message(err));
            }
        }
示例#3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtComCode.Text == "" || txtComName.Text == "" || cboComType.Text == "" || cboAutoYN.Text == "" ||
                    cboStartYN.Text == "" || cboUseYN.Text == "")
                {
                    MessageBox.Show("필수정보 입력 필요");
                    return;
                }

                COMPANY_VO vo = new COMPANY_VO();
                vo.COM_CODE        = txtComCode.Text;
                vo.COM_NAME        = txtComName.Text;
                vo.COM_TYP         = cboComType.Text;
                vo.COM_CEO         = txtOwnerName.Text;
                vo.COM_REG_NUM     = txtRegNum.Text;
                vo.COM_TYP_INDSTRY = txtComType.Text;
                vo.COM_TYP_BSNS    = txtTypeTEA.Text;
                vo.COM_MANAGER     = txtManager.Text;
                vo.COM_EML         = txtEmail.Text;
                vo.COM_TEL         = txtTell.Text;
                if (dtpStart.Checked)
                {
                    vo.COM_STR_DATE = dtpStart.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    vo.COM_STR_DATE = null;
                }
                if (dtpEnd.Checked)
                {
                    vo.COM_END_DATE = dtpEnd.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    vo.COM_END_DATE = null;
                }
                vo.COM_TRAD_YN   = cboTradeYN.Text;
                vo.COM_FAX       = txtFAX.Text;
                vo.COM_AUTOIN_YN = cboAutoYN.Text;
                vo.COM_START_YN  = cboStartYN.Text;
                vo.COM_USE_YN    = cboUseYN.Text;
                vo.COM_INFO      = txtComDesc.Text;
                vo.COM_LAST_MDFR = COM_LAST_MDFR;
                vo.COM_LAST_MDFY = COM_LAST_MDFY;

                CompanyService service = new CompanyService();
                Message        msg     = service.SaveCompany(vo, Update);
                if (msg.IsSuccess)
                {
                    MessageBox.Show(msg.ResultMessage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show(msg.ResultMessage);
                    return;
                }
            }
            catch (Exception err)
            {
                this.Log.WriteError($"[[RECV {this.Name}]]:{err.Message}");
            }
        }