예제 #1
0
 public HttpResponseBase GetZipAddress()
 {
     List<Zip> store = new List<Zip>();
     string json = string.Empty;
     try
     {
         _imrMgr = new InvoiceMasterRecordMgr(connectionString);
         Zip zip = new Zip();
         store = _imrMgr.GetZipAddress(zip);
         zip = new Zip();
         zip.zipcode = "";
         zip.middle = "請選擇";
         store.Insert(0, zip);
         json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented) + "}";
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
예제 #2
0
 /// <summary>
 /// 獲取地址下拉列表
 /// </summary>
 /// <param name="zip"></param>
 /// <returns></returns>
 public List<Zip> GetZipAddress(Zip zip)
 {
     try
     {
         return _imrDao.GetZipAddress(zip);
     }
     catch (Exception ex)
     {
         throw new Exception("InvoiceMasterRecordMgr-->GetZipAddress" + ex.Message, ex);
     }
 }
예제 #3
0
        /// <summary>
        /// 獲取地址下拉列表
        /// </summary>
        /// <param name="zip"></param>
        /// <returns></returns>
        public List<Zip> GetZipAddress(Zip zip)
        {
            StringBuilder sql = new StringBuilder();
            sql.AppendFormat(@"SELECT zipcode,CONCAT_WS(' ',zipcode,middle,small) as middle from t_zip_code WHERE 1=1");
            if (!string.IsNullOrEmpty(zip.zipcode))
            {
                sql.AppendFormat(@" AND zipcode='{0}' ", zip.zipcode);
            }
            try
            {
                return _access.getDataTableForObj<Zip>(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("InvoiceMasterRecordDao-->GetZipAddress" + ex.Message + sql, ex);
            }

        }
예제 #4
0
        /*****************chaojie1124j********************/
        public HttpResponseBase GetZip()
        {
            Zip zip = new Zip();
            List<Zip> zipList = new List<Zip>();
            int resultzip = 0;
            if (!string.IsNullOrEmpty(Request.Params["big_code"]))
            {
                zip.bigcode = Request.Params["big_code"];
                resultzip = 1;
            }
            if (!string.IsNullOrEmpty(Request.Params["c_midcode"]))
            {
                zip.middlecode = Request.Params["c_midcode"];
                resultzip = 1;
            }
            if (!string.IsNullOrEmpty(Request.Params["c_zipcode"]))
            {
                zip.zipcode = Request.Params["c_zipcode"];
                resultzip = 1;
            }

            string jsonStr = string.Empty;
            try
            {
                zMgr = new ZipMgr(connectionString);
                zipList = zMgr.GetZipList(zip);
                if (zipList.Count > 0 && resultzip > 0)
                {
                    jsonStr = "{success:true,msg:\"" + zipList[0].big + "  " + zipList[0].middle + "  " + zipList[0].zipcode + "/" + zipList[0].small.Trim() + "\"}";
                }
                else
                {
                    jsonStr = "{success:true,msg:\"" + 100 + "\"}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                jsonStr = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(jsonStr);
            this.Response.End();
            return this.Response;
        }
예제 #5
0
 public HttpResponseBase GetTZipCodeList()
 {
     List<Zip> stores = new List<Zip>();
     string json = string.Empty;
     try
     {
         Zip zip = new Zip();
         zip.bigcode = "0";
         zip.big = "不分";
         IZImplMgr = new ZipMgr(connectionString);
         stores = IZImplMgr.GetZipList();
         if (string.IsNullOrEmpty(Request.Params["type"]))
         {
             stores.Insert(0, zip);
         }
         json = "{success:true,data:" + JsonConvert.SerializeObject(stores) + "}";
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:true,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
예제 #6
0
 /// <summary>
 /// 查詢所有,匯成DataTable好篩選
 /// </summary>
 /// <param name="zip">通過實體追加查詢條件,方便複用</param>
 /// <param name="appendSql">追加的sql語句</param>
 /// <returns></returns>
 public DataTable ZipTable(Zip zip,String appendSql=null)
 {
     StringBuilder sqlClomn = new StringBuilder();
     StringBuilder sqlCondition = new StringBuilder();
     StringBuilder sqlTable = new StringBuilder();
     try
     {
         sqlClomn .AppendLine(@"select big,bigcode,middle,middlecode, zipcode, small  ");
         sqlTable.Append(" from t_zip_code");
         sqlCondition.Append(" where 1=1 ");
         return _accessMySql.getDataTable(sqlClomn.ToString() + sqlTable.ToString() + sqlCondition.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ZipDao-->ZipTable-->" + ex.Message + strSql.ToString(), ex);
     }
 }
예제 #7
0
 /// <summary>
 /// chaojie1124j add 搬移2015/09/29實現供應商細項的公司地址和發票地址
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public List<Zip> GetZipList(Zip query)
 {
     StringBuilder strSql = new StringBuilder();
     try
     {
         strSql.AppendFormat("select big,middle,middlecode,zipcode,small from t_zip_code where 1=1");
         if (!string.IsNullOrEmpty(query.bigcode))
         {
             strSql.AppendFormat(" and bigcode='{0}' ", query.bigcode);
         }
         if (!string.IsNullOrEmpty(query.middlecode))
         {
             strSql.AppendFormat(" and middlecode='{0}' ", query.middlecode);
         }
         if (!string.IsNullOrEmpty(query.zipcode))
         {
             strSql.AppendFormat(" and zipcode='{0}' ", query.zipcode);
         }
         return _accessMySql.getDataTableForObj<Zip>(strSql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ZipDao-->GetZipList-->" + ex.Message + strSql.ToString(), ex);
     }
 }
예제 #8
0
 public List<Zip> GetZipList(Zip query)
 {
     try
     {
         return _zipDao.GetZipList(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ZipMgr-->GetZipList-->" + ex.Message, ex);
     }
 }
예제 #9
0
 public DataTable ZipTable(Zip zip, String appendSql)
 {
     try
     {
         return _zipDao.ZipTable(zip, appendSql);
     }
     catch (Exception ex)
     {
         throw new Exception("ZipMgr-->ZipTable-->" + ex.Message, ex);
     }
 }