Ejemplo n.º 1
0
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// 상품 조회, 2019-09-19
        /// </summary>
        /// <param name="intSeqNo"></param>
        /// <param name="strModuleName"></param>
        /// <param name="pl_objDT"></param>
        /// <param name="pl_strErrMsg"></param>
        /// <returns></returns>
        ///----------------------------------------------------------------------------------
        public static int GetProductList(string strStoreCode, string strCashAttrCode, int intProductTypeCode, out DataTable objDT, out string strErrMsg)
        {
            int  pl_intRetVal = 0;
            IDas pl_objDas    = null;

            strErrMsg = "OK";
            objDT     = null;

            try
            {
                pl_objDas = new IDas();
                pl_objDas.Open(UserGlobal.BOQ_HOST_DAS);
                pl_objDas.CommandType = CommandType.StoredProcedure;
                pl_objDas.CodePage    = 0;

                pl_objDas.AddParam("@pi_strStoreCode", DBType.adVarChar, strStoreCode, 50, ParameterDirection.Input);
                pl_objDas.AddParam("@pi_strCashAttrCode", DBType.adVarChar, strCashAttrCode, 15, ParameterDirection.Input);
                pl_objDas.AddParam("@pi_intProductTypeCode", DBType.adTinyInt, intProductTypeCode, 0, ParameterDirection.Input);
                pl_objDas.AddParam("@po_strErrMsg", DBType.adVarChar, DBNull.Value, 256, ParameterDirection.Output);
                pl_objDas.AddParam("@po_intRetVal", DBType.adInteger, DBNull.Value, 0, ParameterDirection.Output);

                pl_objDas.AddParam("@po_strDBErrMsg", DBType.adVarChar, DBNull.Value, 256, ParameterDirection.Output);
                pl_objDas.AddParam("@po_intDBRetVal", DBType.adInteger, DBNull.Value, 0, ParameterDirection.Output);

                pl_objDas.SetQuery("dbo.UP_POS_PRODUCT_UR_LST");

                if (!pl_objDas.LastErrorCode.Equals(0))
                {
                    pl_intRetVal = pl_objDas.LastErrorCode;
                    strErrMsg    = pl_objDas.LastErrorMessage;
                    return(pl_intRetVal);
                }

                objDT = new DataTable();
                objDT = pl_objDas.objDT;
            }
            catch (Exception pl_objEx)
            {
                pl_intRetVal = -15701;
                strErrMsg    = "상품 목록 조회 실패";
                UtilLog.WriteExceptionLog(pl_objEx.Message, pl_objEx.StackTrace);
            }
            finally
            {
                if (pl_objDas != null)
                {
                    pl_objDas.Close();
                    pl_objDas = null;
                }
            }

            return(pl_intRetVal);
        }
Ejemplo n.º 2
0
        public static void SendMail(string strSubject, string strAddMailTo, string strMailInfo, int intRetVal, string strErrMsg)
        {
            StringBuilder pl_sbMailInfo = null;
            StringBuilder pl_sbMailBody = null;
            HttpContext   pl_objCtx     = null;
            MailMessage   pl_objMessage = null;
            SmtpClient    pl_objClient  = null;

            string pl_strMailSuject = string.Empty;
            string pl_strIPAddr     = string.Empty;

            try
            {
                pl_sbMailInfo = new StringBuilder();
                pl_sbMailBody = new StringBuilder();

                pl_objCtx    = HttpContext.Current;
                pl_strIPAddr = UserGlobal.GetClientIP();

                pl_strMailSuject = string.Format("[{0}][{1}][{2}]-{3}", Dns.GetHostName().ToUpper(), "FamilyEvent", strSubject, pl_objCtx.Request.ServerVariables.Get("HTTP_HOST") + pl_objCtx.Request.FilePath.ToString());

                pl_sbMailInfo.Append("<B>Server</B><BR/>");
                pl_sbMailInfo.AppendFormat("ServerName: {0}", pl_objCtx.Request.ServerVariables.Get("HTTP_HOST"));
                pl_sbMailInfo.AppendFormat("<br>ServerIP: {0}", pl_objCtx.Request.ServerVariables.Get("LOCAL_ADDR"));
                pl_sbMailInfo.AppendFormat("<br>RemoteIP: {0}", pl_strIPAddr);
                pl_sbMailInfo.Append("<BR/>");
                if (!string.IsNullOrEmpty(strMailInfo))
                {
                    pl_sbMailInfo.Append(strMailInfo);
                }
                pl_sbMailInfo.Append("<BR/>");
                pl_sbMailInfo.Append("<BR/><B>Error Code</B><BR/>");
                pl_sbMailInfo.Append(intRetVal);
                pl_sbMailInfo.Append("<BR/><B>Error Message</B><BR/>");
                pl_sbMailInfo.Append(strErrMsg);

                // --------------------------------------------------
                // To let the page finish running we clear the error
                // --------------------------------------------------
                pl_sbMailBody.Append("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>");
                pl_sbMailBody.Append("<HTML>");
                pl_sbMailBody.Append("    <HEAD>");
                pl_sbMailBody.Append("        <META HTTP-EQUIV='Content-Type' Content='text/html; charset=ks_c_5601-1987'>");
                pl_sbMailBody.Append("        <STYLE type='text/css'>");
                pl_sbMailBody.Append("          BODY { font: 9pt/12pt Tahoma }");
                pl_sbMailBody.Append("          H1 { font: 13pt/15pt Tahoma }");
                pl_sbMailBody.Append("          H2 { font: 9pt/12pt Tahoma }");
                pl_sbMailBody.Append("          A:link { color: red }");
                pl_sbMailBody.Append("          A:visited { color: maroon }");
                pl_sbMailBody.Append("        </STYLE>");
                pl_sbMailBody.Append("    </HEAD>");
                pl_sbMailBody.Append("    <BODY>");
                pl_sbMailBody.Append("        <TABLE width=500 border=0 cellspacing=10>");
                pl_sbMailBody.Append("            <TR>");
                pl_sbMailBody.Append("                <TD>");
                pl_sbMailBody.Append(pl_sbMailInfo);
                pl_sbMailBody.Append("                </TD>");
                pl_sbMailBody.Append("            </TR>");
                pl_sbMailBody.Append("        </TABLE>");
                pl_sbMailBody.Append("    </BODY>");
                pl_sbMailBody.Append("</HTML>");

                pl_objMessage      = new MailMessage();
                pl_objMessage.From = new MailAddress(UserGlobal.BOQ_ADDRESS_FROM, UserGlobal.BOQ_ADDRESS_FROM);
                pl_objMessage.To.Add(UserGlobal.BOQ_ADDRESS_TO);
                //추가 주소가 있는 경우
                if (!string.IsNullOrEmpty(strAddMailTo))
                {
                    foreach (string pl_strMailTo in strAddMailTo.Split(';'))
                    {
                        pl_objMessage.To.Add(pl_strMailTo);
                    }
                }
                pl_objMessage.BodyEncoding    = Encoding.UTF8;
                pl_objMessage.SubjectEncoding = Encoding.UTF8;
                pl_objMessage.Subject         = pl_strMailSuject;
                pl_objMessage.Body            = pl_sbMailBody.ToString();
                pl_objMessage.IsBodyHtml      = true;

                if (string.IsNullOrEmpty(UserGlobal.BOQ_SMTP_ID))
                {
                    pl_objClient = new SmtpClient(UserGlobal.BOQ_SMTP_SERVER);
                }
                else
                {
                    pl_objClient = new SmtpClient(UserGlobal.BOQ_SMTP_SERVER);
                    pl_objClient.UseDefaultCredentials = false;
                    pl_objClient.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    pl_objClient.Credentials           = new NetworkCredential(UserGlobal.BOQ_SMTP_ID, UserGlobal.BOQ_SMTP_PWD);
                }

                pl_objClient.Send(pl_objMessage);
            }
            catch (SmtpException pl_objEx)
            {
                UtilLog.WriteExceptionLog(pl_objEx.Message, pl_objEx.StackTrace);
            }
            finally
            {
                pl_sbMailInfo = null;
                pl_sbMailBody = null;
                pl_objCtx     = null;

                if (pl_objMessage != null)
                {
                    pl_objMessage.Dispose();
                    pl_objMessage = null;
                }

                if (pl_objClient != null)
                {
                    pl_objClient.Dispose();
                    pl_objClient = null;
                }
            }
        }