public static returnFilePath GetExcelPath(string from = "", string to = "", string pointno = "", string type = "") { returnFilePath package = new returnFilePath(); if (HttpContext.Current.Session["user"] == null) { package.isOk = false; package.Message = "尚未登入或連線逾時"; return(package); } User user = (User)HttpContext.Current.Session["user"]; List <Project> projectList = user.ProjectList; string projectName = HttpContext.Current.Session["showProjects"].ToString(); DownLoadADO DownFile; try { foreach (Project item in projectList) { if (item.ProjectName.Equals(projectName)) { DownFile = new DownLoadADO(item.GetPorjectDB()); package.Path = DownFile.getExcelPathByTypeArea(type, pointno, from, to); package.isOk = true; } } } catch (Exception ex) { package.Message = ex.Message.ToString(); package.Message += "資料處理錯誤,請重新登入"; package.isOk = false; } return(package); }
public static returnFilePath GetDownloadPath(string GageType, int DataType, string FromDate, string ToDate) { returnFilePath package = new returnFilePath(); if (HttpContext.Current.Session["user"] == null) { package.isOk = false; package.Message = "尚未登入或連線逾時"; return(package); } User user = (User)HttpContext.Current.Session["user"]; List <Project> projectList = user.ProjectList; string projectName = HttpContext.Current.Session["showProjects"].ToString(); DownLoadADO DownFile; System.Diagnostics.Debug.WriteLine(GageType); System.Diagnostics.Debug.WriteLine(DataType); System.Diagnostics.Debug.WriteLine(FromDate); System.Diagnostics.Debug.WriteLine(ToDate); try { foreach (Project item in projectList) { if (item.ProjectName.Equals(projectName)) { DownFile = new DownLoadADO(item.GetPorjectDB()); switch (item.DataBaseStyle) { //Auto case 0: switch (GageType.Equals(0)) { case true: break; case false: package.Path = DownFile.getGeoAutoOneTypeDownPath(DataType, GageType, FromDate, ToDate); break; } break; //MRT case 1: switch (GageType.Equals(0)) { case true: //package.Path = DownFile.getGeoAutoAllTypeDownPath(DataType, GageType, FromDate, ToDate); break; case false: package.Path = DownFile.getGeoMrtOneTypeDownPath(DataType, GageType, FromDate, ToDate); break; } break; } package.isOk = true; } } } catch (Exception ex) { package.Message = ex.Message.ToString(); package.Message += "資料處理錯誤,請重新登入"; package.isOk = false; } return(package); }