public List <OrderCustomerInfo> GetList(TableObject table) { string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <OrderCustomerInfo>)obj); } string sqlStr = "select * from OrderCustomerInfo where SchoolID=@SchoolID and LastModified>@LastModified"; List <SqlParameter> pms = new List <SqlParameter>(); //pms.Add(new SqlParameter("BranchID", table.BranchID)); pms.Add(new SqlParameter("SchoolID", table.SchoolID)); pms.Add(new SqlParameter("LastModified", table.LastModified)); //if (!string.IsNullOrEmpty(table.StartDate)) //{ // sqlStr += " and OperateTime>@StartDate"; // pms.Add(new SqlParameter("StartDate", table.StartDate)); //} //if (!string.IsNullOrEmpty(table.EndDate)) //{ // sqlStr += " and OperateTime<@EndDate"; // pms.Add(new SqlParameter("EndDate", table.EndDate)); //} List <OrderCustomerInfo> list = OrderCustomerInfoBLL.Search(sqlStr, pms.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }
public SurveyInfoResponse GetSurveyInfo(SurveyInfoRequest pRequest) { try { string surveyKey = pRequest.Criteria.SurveyIdList[0].ToString(); SurveyInfoResponse surveyInfo = CacheUtility.Get(surveyKey) as SurveyInfoResponse; if (surveyInfo != null) { return(surveyInfo); } surveyInfo = (SurveyInfoResponse)_iDataService.GetSurveyInfo(pRequest); CacheUtility.Insert(surveyKey, surveyInfo); return(surveyInfo); } catch (FaultException <CustomFaultException> cfe) { throw cfe; } catch (FaultException fe) { throw fe; } catch (CommunicationException ce) { throw ce; } catch (TimeoutException te) { throw te; } catch (Exception ex) { throw ex; } }
public List <Period> GetList(TableObject table) { string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <Period>)obj); } string sqlStr = ""; string sqlAdd = ""; if (table.IsValid == 1) { sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) "; } byte[] TimeStamp = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(TimeStamp)) { sqlStr = @"select * from [CloudAsset].[dbo].[Period] where LastModified>@LastModified and AssetID in ( select AssetID from [CloudAsset].[dbo].[Asset] where [OwnerID] in( select CustomerID FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + "))"; // AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0) } else { sqlStr = @" select a.* from [CloudAsset].[dbo].[Period] a join [dbo].[Asset] b on a.AssetID=b.AssetID where b.SubCompanyID=@BranchID and b.SchoolID=@SchoolID and a.LastModified>@LastModified"; } List <SqlParameter> pms = new List <SqlParameter>(); pms.Add(new SqlParameter("BranchID", table.BranchID)); pms.Add(new SqlParameter("SchoolID", table.SchoolID)); pms.Add(new SqlParameter("LastModified", table.LastModified)); //if (!string.IsNullOrEmpty(table.StartDate)) //{ // sqlStr += " and AssetCreateDate>@StartDate"; // pms.Add(new SqlParameter("StartDate", table.StartDate)); //} //if (!string.IsNullOrEmpty(table.EndDate)) //{ // sqlStr += " and AssetCreateDate<@EndDate"; // pms.Add(new SqlParameter("EndDate", table.EndDate)); //} List <Period> list = PeriodBLL.Search(sqlStr, pms.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }
public List <Asset> GetList(TableObject table) { string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"]; string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <Asset>)obj); } string sqlStr = ""; string sqlAdd = ""; if (table.IsValid == 1) { sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) "; } byte[] TimeStamp = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(TimeStamp)) { sqlStr = @"select * from Asset where SubCompanyID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified and [OwnerID] in( select CustomerID FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + ")"; //AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0) } else { sqlStr = @"select * from Asset where SubCompanyID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified"; } //[CLOUDCUSTOMER]为链接服务器 // string sqlStr = @"select * from Asset where SubCompanyID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified //and [OwnerID] //in( //select CustomerID FROM [CLOUDCUSTOMER].[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID // AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0) // )"; List <SqlParameter> pms = new List <SqlParameter>(); pms.Add(new SqlParameter("BranchID", table.BranchID)); pms.Add(new SqlParameter("SchoolID", table.SchoolID)); pms.Add(new SqlParameter("LastModified", table.LastModified)); //if (!string.IsNullOrEmpty(table.StartDate)) //{ // sqlStr += " and OperateTime>@StartDate"; // pms.Add(new SqlParameter("StartDate", table.StartDate)); //} //if (!string.IsNullOrEmpty(table.EndDate)) //{ // sqlStr += " and OperateTime<@EndDate"; // pms.Add(new SqlParameter("EndDate", table.EndDate)); //} List <Asset> list = AssetBLL.Search(sqlStr, pms.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }
public List <OrderStatistics> GetList(TableObject table) { string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"]; string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <OrderStatistics>)obj); } string sqlStr = ""; string sqlAdd = ""; if (table.IsValid == 1) { sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) "; } sqlStr = @"select * from OrderStatistics where LastModified>@LastModified and CustomerID in( select CustomerID FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + ")"; // byte[] TimeStamp = new byte[8]; // if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(TimeStamp)) // { // sqlStr = @"select * from OrderStatistics where LastModified>@LastModified //and CustomerID //in( //select CustomerID FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID // // )"; // //AND (SS.TotalCourseAmount>0 OR SS.CommonCourseAmount>0 OR SS.SpecialCourseAmount>0) // } // else // { // sqlStr = @"select * from OrderStatistics where LastModified>@LastModified"; // } //string sqlStr = "select * from OrderStatistics where LastModified>@LastModified"; List <SqlParameter> pms = new List <SqlParameter>(); pms.Add(new SqlParameter("LastModified", table.LastModified)); pms.Add(new SqlParameter("SchoolID", table.SchoolID)); List <OrderStatistics> list = OrderStatisticsBLL.Search(sqlStr, pms.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }
public static Form GetForm(SurveyInfoDTO surveyInfo, int pageNumber, SurveyAnswerDTO surveyAnswer, bool isMobile = false, bool IsAndroid = false, List <SourceTableDTO> SourceTableList = null) { Form form = null; string surveyId = surveyInfo.SurveyId; string isMobileText = isMobile ? "true" : "false"; string cacheKey = surveyId + ",page:" + pageNumber.ToString() + ",mobile:" + isMobileText; bool enableFormCaching = false; if (enableFormCaching) { form = CacheUtility.Get(cacheKey) as Form; } if (form == null) { form = new Form(); form.IsAndroid = IsAndroid; if (isMobile) { form.IsMobile = isMobile; form.FormWrapperClass = "MvcDynamicMobileForm"; } form.SurveyInfo = surveyInfo; if (form.SurveyInfo.IsDraftMode) { form.IsDraftModeStyleClass = "draft"; } form.StatusId = surveyAnswer.Status; string xml = form.SurveyInfo.XML; form.CurrentPage = pageNumber; if (string.IsNullOrEmpty(xml)) { form.NumberOfPages = 1; } else { form.NumberOfPages = GetNumberOfPages(XDocument.Parse(xml)); } if (string.IsNullOrEmpty(xml) == false) { form.XDocMetadata = XDocument.Parse(xml); form.FieldsTypeIDs = from _FieldTypeID in form.XDocMetadata.Descendants("Field") select _FieldTypeID; double width, height; width = GetWidth(form.XDocMetadata); height = GetHeight(form.XDocMetadata); form.PageId = GetPageId(form.XDocMetadata, pageNumber); form.Width = width; form.Height = height; XElement ViewElement = form.XDocMetadata.XPathSelectElement("Template/Project/View"); string checkcode = ViewElement.Attribute("CheckCode").Value.ToString(); StringBuilder JavaScript = new StringBuilder(); StringBuilder VariableDefinitions = new StringBuilder(); XDocument xdocResponse = XDocument.Parse(surveyAnswer.XML); form.RequiredFieldsList = xdocResponse.Root.Attribute("RequiredFieldsList").Value; form.HiddenFieldsList = xdocResponse.Root.Attribute("HiddenFieldsList").Value; form.HighlightedFieldsList = xdocResponse.Root.Attribute("HighlightedFieldsList").Value; form.DisabledFieldsList = xdocResponse.Root.Attribute("DisabledFieldsList").Value; if (SurveyAnswerList != null) { form.FormCheckCodeObj = form.GetRelateCheckCodeObj(GetRelateFormObj(), checkcode); } else { form.FormCheckCodeObj = form.GetCheckCodeObj(form.XDocMetadata, xdocResponse, checkcode); } form.FormCheckCodeObj.GetVariableJavaScript(VariableDefinitions); form.FormCheckCodeObj.GetSubroutineJavaScript(VariableDefinitions); form.SourceTableList = SourceTableList; string pageName = GetPageName(form.XDocMetadata, pageNumber); JavaScript.Append(GetPageLevelJS(pageNumber, form, pageName, "Before")); JavaScript.Append(GetPageLevelJS(pageNumber, form, pageName, "After")); foreach (var fieldElement in form.FieldsTypeIDs) { string formJavaScript = GetFormJavaScript(checkcode, form, fieldElement.Attribute("Name").Value); JavaScript.Append(formJavaScript); } ///JavaScript POC start if (checkcode.Contains("Script-Start") && checkcode.Contains("Script-End")) { var startTag = "Script-Start"; int startIndex = checkcode.IndexOf(startTag) + startTag.Length; int endIndex = checkcode.IndexOf("Script-End", startIndex); var Script = checkcode.Substring(startIndex, endIndex - startIndex); JavaScript.Append(Script); } ///JavaScript POC End AddFormFields(pageNumber, form, surveyAnswer, SourceTableList, isMobile); form.FormJavaScript = VariableDefinitions.ToString() + "\n" + JavaScript.ToString(); } if (enableFormCaching) { CacheUtility.Insert(cacheKey, form, surveyId); } } else { form.Fields.Clear(); AddFormFields(pageNumber, form, surveyAnswer); } form.ResponseId = surveyAnswer.ResponseId; form.IsSaved = false; if (surveyAnswer.XML.Contains("ResponseDetail")) { SetStates(form, surveyAnswer); } return(form); }