public static bool IsShowCustomerCuiShouByAllParentID(SysConfig_ProjectDetail[] configProjectList, string AllParentID, int RoomID, SysConfig sysConfig) { string ConfigValue = GetSysConfigValueByAllParentID(configProjectList, AllParentID, RoomID, sysConfig); if (string.IsNullOrEmpty(ConfigValue) || ConfigValue.Equals("0")) { return(true); } return(false); }
public static Mall_BusinessDetail[] GetMall_BusinessDetailListByKeywords(string Keywords, int sortby, long startRowIndex, int pageSize, out long totalRows, int CategoryID = 0, double lon = 0, double lat = 0, int TagID = 0, bool issuggestion = false) { ResetParams(); Lon = lon; Lat = lat; List <SqlParameter> parameters = new List <SqlParameter>(); List <string> conditions = new List <string>(); conditions.Add("1=1"); if (issuggestion) { conditions.Add("[IsSuggestion]=1"); } conditions.Add(" [Status]=1"); if (TagID > 0) { conditions.Add("[ID] in (select [BusinessID] from [Mall_Product] where [ID] in (select [ProductID] from [Mall_ProductTag] where [TagID]=@TagID))"); parameters.Add(new SqlParameter("@TagID", TagID)); } if (CategoryID > 0) { conditions.Add("[ID] in (select [BusinessID] from [Mall_Business_Category] where [CategoryID]=@CategoryID)"); parameters.Add(new SqlParameter("@CategoryID", CategoryID)); } if (!string.IsNullOrEmpty(Keywords)) { conditions.Add("[BusinessName] like @Keywords"); parameters.Add(new SqlParameter("@Keywords", "%" + Keywords + "%")); } string OrderBy = " order by isnull([IsTopShow],0) desc, [AddTime] desc"; if (sortby == 1) { OrderBy = " order by isnull([IsTopShow],0) desc, A.SaleCount desc"; } else if (sortby == 2) { OrderBy = " order by isnull([IsTopShow],0) desc, [AddTime] desc"; } string fieldList = "A.*"; string Statement = " from (select *,(select sum(Quantity) from [Mall_OrderItem] where [OrderID] in (select ID from [Mall_Order] where [OrderStatus]=3) and [BusinessID]=[Mall_Business].ID) as SaleCount,(select count(1) from [Mall_OrderComment] where [BusinessID]=[Mall_Business].ID) as RateCount,(select sum(RateStar) from [Mall_OrderComment] where [BusinessID]=[Mall_Business].ID) as RateStar from [Mall_Business])A where " + string.Join(" and ", conditions.ToArray()); var list = GetList <Mall_BusinessDetail>(fieldList, Statement, parameters, OrderBy, startRowIndex, pageSize, out totalRows).ToArray(); if (sortby == 3) { list = list.OrderByDescending(p => { return(p.IsTopShow ? 1 : 0); }).ThenBy(p => { if (p.Distance == 0) { return(decimal.MaxValue); } return(p.Distance); }).ThenByDescending(p => p.AddTime).ToArray(); } if (Lon != 0 && Lat != 0) { decimal distance = 0; var config = SysConfig.GetSysConfigByName(SysConfigNameDefine.BusinessDistance.ToString()); if (config != null) { decimal.TryParse(config.Value, out distance); } if (distance > 0) { list = list.Where(p => p.Distance <= distance).ToArray(); } } return(list); }
public static string GetSysConfigValueByAllParentID(SysConfig_ProjectDetail[] configProjectList, string AllParentID, int RoomID, SysConfig sysConfig) { var myConfig = SysConfig_ProjectDetail.GetSysConfig_ProjectDetailByAllParentID(configProjectList, AllParentID, RoomID); if (myConfig != null) { return(myConfig.ConfigValue); } if (sysConfig != null) { return(sysConfig.Value); } return(string.Empty); }
public static ServiceType GetImportServiceType() { var list = SysConfig.GetSysConfigListByType("ServiceType"); if (list.Length == 0) { return(null); } var data = new ServiceType(); decimal decimalValue = 0; var name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypePaiDanTime; var value = SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.PaiDanTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeCheckTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.CheckTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeBanJieTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.BanJieTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeResponseTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.ResponseTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeChuliTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.ChuliTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeGuanDanTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.GuanDanTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeHuiFangTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { decimal.TryParse(value, out decimalValue); data.HuiFangTime = decimalValue; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeDisableHolidayTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { int intValue = 0; int.TryParse(value, out intValue); data.DisableHolidayTime = intValue == 1; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeDisableWorkOffTime; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); if (!string.IsNullOrEmpty(value)) { int intValue = 0; int.TryParse(value, out intValue); data.DisableWorkOffTime = intValue == 1; } name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeStartHour; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); data.StartHour = value; name = Foresight.DataAccess.SysConfigNameDefine.ServiceTypeEndHour; value = Foresight.DataAccess.SysConfig.GetSysConfigValueByName(list, name); data.EndHour = value; return(data); }