Esempio n. 1
0
        public ResponseModel DownLoadCSVFile()
        {
            string out_msg   = string.Empty;
            string proc_name = xmlCommonUtil.PROCEDURE_TITLE;

            SqlParameter[] sqlparams = xmlCommonUtil.SQLPARAMETERS;
            DataSet        ds        = null;

            try
            {
                ds = xmlCommonUtil.ReturnDataSet_Common(proc_name, sqlparams, false, out out_msg);
            }
            catch (Exception ex)
            {
                //out_msg = xmlCommonUtil.returnErrorMSGXML("DownLoadCSVFile", ex);
                return(xmlCommonUtil.returnErrorMSGXML("DownLoadCSVFile", ex));
            }

            //if (!string.IsNullOrEmpty(out_msg))
            //{
            //    xmlCommonUtil.ResponseWrite(out_msg);
            //    return null;
            //}

            if (ds == null || ds.Tables.Count == 0)
            {
                return(xmlCommonUtil.ResponseWriteErrorMSG("DownLoadCSVFile 리턴 데이터에 오류가 있습니다."));
                //return null;
            }

            return(this.MakeCSVFile(ds));
        }
Esempio n. 2
0
        private void SaveMMSFiles(int file_cnt, string mms_body, string mms_subject, string filePath, List <MMSFiles> file_list, ref int mms_seq)
        {
            if (file_cnt == -1 && string.IsNullOrEmpty(filePath))
            {
                xmlCommonUtil.ResponseWriteErrorMSG("mms_file 저장 중 오류가 발생했습니다.(파일이 존재하지 않거나, 파일 정보를 넘기지 않았습니다.)");
                return;
            }
            string out_msg = string.Empty;

            //
            string proc_name = PROC_SEND_MOBILE_MSG_CUD;

            //
            List <SqlParameter> temp_param = new List <SqlParameter>();

            temp_param.Add(new SqlParameter("@" + XMLCommonUtil.GUBUN_KEY_STRING, GUBUN_SAVE_MMS_FILE));
            //temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_IP_GUBUN, _httpContext.Request.ServerVariables["REMOTE_ADDR"]));
            temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_IP_GUBUN, _httpContext.Connection.RemoteIpAddress));
            //temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_KEY_GUBUN, xmlCommonUtil.QueryString[XMLCommonUtil.OPERATOR_KEY_GUBUN]));
            temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_KEY_GUBUN, xmlCommonUtil.RequestData.GetValue(XMLCommonUtil.OPERATOR_KEY_GUBUN)));


            //*
            bool include_organization_key = XMLCommonUtil.INCLUDE_ORGANIZATION_KEY;

            if (include_organization_key)
            {
                //temp_param.Add(new SqlParameter("@" + XMLCommonUtil.ORGANIZATION_KEY_GUBUN, xmlCommonUtil.QueryString[XMLCommonUtil.ORGANIZATION_KEY_GUBUN].ToString()));
                temp_param.Add(new SqlParameter("@" + XMLCommonUtil.ORGANIZATION_KEY_GUBUN, xmlCommonUtil.RequestData.GetValue(XMLCommonUtil.ORGANIZATION_KEY_GUBUN)));
            }
            //*/

            temp_param.Add(new SqlParameter("@" + FILE_CNT_KEY, file_cnt == -1 ? 1 : file_cnt));
            temp_param.Add(new SqlParameter("@" + MMS_BODY_KEY, mms_body));
            temp_param.Add(new SqlParameter("@" + MMS_SUBJECT_key, mms_subject));

            if (file_cnt == -1 && !string.IsNullOrEmpty(filePath))
            {
                //temp_param.Add(new SqlParameter("@" + FILE_TYPE_KEY + "1", xmlCommonUtil.QueryString[FILE_TYPE + "1"]));
                temp_param.Add(new SqlParameter("@" + FILE_TYPE_KEY + "1", xmlCommonUtil.RequestData.GetValue(FILE_TYPE + "1")));
                temp_param.Add(new SqlParameter("@" + FILE_NAME_KEY + "1", filePath));
            }
            //기존 방식
            else
            {
                for (int i = 0; i < file_list.Count; i++)
                {
                    MMSFiles m = file_list[i];

                    try
                    {
                        webClient.DownloadFile(m.FileDownloadUrl, m.FileLocalPath);
                    }
                    catch (Exception ex)
                    {
                        xmlCommonUtil.ResponseWriteErrorMSG("첨부파일을 원격서버에서 로컬로 복사해 오던 중 오류발생하였습니다.(원격 : " + m.FileDownloadUrl + ", 로컬 : " + m.FileLocalPath + ")", ex);
                        return;
                    }
                    int c = i + 1;
                    temp_param.Add(new SqlParameter("@" + FILE_TYPE_KEY + c.ToString(), m.FileType.ToString()));
                    temp_param.Add(new SqlParameter("@" + FILE_NAME_KEY + c.ToString(), m.FileLocalPath));
                }
            }

            SqlParameter[] sqlparams = temp_param.ToArray();

            DataSet ds = null;

            //
            try
            {
                ds = xmlCommonUtil.ReturnDataSet_Common(proc_name, sqlparams, false, out out_msg);
            }
            catch (Exception ex)
            {
                //out_msg = xmlCommonUtil.returnErrorMSGXML("SaveMMSFiles", ex);
                xmlCommonUtil.ResponseWriteErrorMSG("SaveMMSFiles", ex);
                return;
            }

            if (!string.IsNullOrEmpty(out_msg))
            {
                xmlCommonUtil.ResponseWrite(out_msg);
                return;
            }

            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0 || !ds.Tables[0].Columns.Contains("mms_seq"))
            {
                xmlCommonUtil.ResponseWriteErrorMSG("SaveMMSFiles 리턴 데이터에 오류가 있습니다.");
                return;
            }

            if (!int.TryParse(ds.Tables[0].Rows[0]["mms_seq"].ToString(), out mms_seq))
            {
                mms_seq = -1;
            }
        }
Esempio n. 3
0
        private DataSet Attachment_CRD(
            CRUD crd,
            string attachment_key,
            string filename,
            string fileformat,
            long filesize,
            out string msg)
        {
            string out_msg = string.Empty;

            //
            string proc_name = this.ATTACHMENT_R_PROC;

            switch (crd)
            {
            case CRUD.C:
            case CRUD.U:
            case CRUD.D:
                proc_name = this.ATTACHMENT_CUD_PROC;
                break;

            case CRUD.R:
                proc_name = this.ATTACHMENT_R_PROC;
                break;
            }

            //
            List <SqlParameter> temp_param = new List <SqlParameter>();

            temp_param.Add(new SqlParameter("@" + XMLCommonUtil.GUBUN_KEY_STRING, crd.ToString()));
            //temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_IP_GUBUN, _httpContext.Request.ServerVariables["REMOTE_ADDR"]));
            temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_IP_GUBUN, _httpContext.Connection.RemoteIpAddress.ToString()));

            //temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_KEY_GUBUN, xmlCommonUtil.QueryString[XMLCommonUtil.OPERATOR_KEY_GUBUN]));
            temp_param.Add(new SqlParameter("@" + XMLCommonUtil.OPERATOR_KEY_GUBUN, xmlCommonUtil.RequestData.GetValue(XMLCommonUtil.OPERATOR_KEY_GUBUN)));

            //*
            bool include_organization_key = XMLCommonUtil.INCLUDE_ORGANIZATION_KEY;

            if (include_organization_key)
            {
                //temp_param.Add(new SqlParameter("@" + XMLCommonUtil.ORGANIZATION_KEY_GUBUN, xmlCommonUtil.QueryString[XMLCommonUtil.ORGANIZATION_KEY_GUBUN].ToString()));
                temp_param.Add(new SqlParameter("@" + XMLCommonUtil.ORGANIZATION_KEY_GUBUN, xmlCommonUtil.RequestData.GetValue(XMLCommonUtil.ORGANIZATION_KEY_GUBUN)));
            }
            //*/

            switch (crd)
            {
            case CRUD.R:
            case CRUD.D:
                temp_param.Add(new SqlParameter("@" + ATTACHMENT_KEY_key, attachment_key));
                break;

            case CRUD.C:
                temp_param.Add(new SqlParameter("@" + ATTACHMENT_GUBUN_key, this.ATTACHMENT_TYPE.ToString()));
                temp_param.Add(new SqlParameter("@" + ATTACHMENT_DETAIL_CODE_key, this.ATTACHMENT_DETAIL_CODE));
                temp_param.Add(new SqlParameter("@" + ATTACHMENT_FILENAME_key, filename));
                temp_param.Add(new SqlParameter("@" + ATTACHMENT_FILEFORMAT_key, fileformat));
                temp_param.Add(new SqlParameter("@" + ATTACHMENT_FILESIZE_key, filesize));
                break;
            }
            SqlParameter[] sqlparams = temp_param.ToArray();

            DataSet ds = null;

            //
            try
            {
                ds = xmlCommonUtil.ReturnDataSet_Common(proc_name, sqlparams, false, out out_msg);
            }
            catch (Exception ex)
            {
                //throw ex;
                //msg = xmlCommonUtil.returnErrorMSGXML("ReturnDataSet_Common", ex);
                msg = "ReturnDataSet_Common";

                return(null);
            }

            msg = out_msg;

            /*
             * if (ds == null || ds.Tables.Count ==0 || ds.Tables[0].Rows.Count == 0)
             * {
             *  return null;
             * }
             *
             * DataTable dt = ds.Tables[0];
             * //*/
            return(ds);//dt.Rows[0];
        }