public static SysConfig[] Get_SysConfigListByProjectIDList(int MinProjectID = 0, int MaxProjectID = 0, SysConfigNameDefine?ConfigName = null) { SysConfig[] list = new SysConfig[] { }; if (ConfigName == null) { list = SysConfig.GetSysConfigs().ToArray(); } else if (ConfigName == SysConfigNameDefine.WechatFeeNotify) { list = SysConfig.GetSysConfigs().Where(p => p.Name.Equals(SysConfigNameDefine.WechatFeeNotify.ToString()) || p.Name.Equals(SysConfigNameDefine.WechatFeeNotifyTime.ToString())).ToArray(); } else { list = SysConfig.GetSysConfigs().Where(p => p.Name.Equals(ConfigName.ToString())).ToArray(); } if (MaxProjectID > 0) { var config_project_list = SysConfig_ProjectDetail.Get_SysConfig_ProjectListByProjectIDList(MinProjectID, MaxProjectID); foreach (var item in list) { var my_config = config_project_list.Where(p => p.ConfigID == item.ID).OrderByDescending(p => p.IconID).FirstOrDefault(); if (my_config != null) { item.Value = my_config.ConfigValue; item.ProjectID = my_config.ProjectID; } } } 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 ViewRoomFee[] GetNotifyViewRoomFee(ViewRoomFee[] list) { var RoomIDList = list.Select(p => p.RoomID).Distinct().ToArray(); int MinProjectID = 0; int MaxProjectID = 0; if (list.Length > 0) { MinProjectID = list.Min(p => p.RoomID); MaxProjectID = list.Max(p => p.RoomID); } var sysConfigList = SysConfig.GetSysConfigListByName(SysConfigNameDefine.WechatFeeNotify.ToString()); SysConfig_ProjectDetail[] configProjectList = new SysConfig_ProjectDetail[] { }; if (sysConfigList.Length > 0) { configProjectList = SysConfig_ProjectDetail.Get_SysConfig_ProjectListByProjectIDList(MinProjectID, MaxProjectID).Where(p => sysConfigList.Select(q => q.ID).ToArray().Contains(p.ConfigID)).ToArray(); } var newList = new List <ViewRoomFee>(); foreach (var item in list) { var myConfigProjectList = configProjectList.Where(p => item.AllParentID.Contains("," + p.ProjectID + ",") || item.RoomID == p.ProjectID).ToArray(); var mySysConfigList = new List <SysConfig>(); foreach (var item2 in sysConfigList) { var mySysConfig = new SysConfig(); mySysConfig.ID = item2.ID; mySysConfig.Name = item2.Name; mySysConfig.Value = item2.Value; mySysConfig.ProjectID = 0; var my_config = myConfigProjectList.Where(p => p.ConfigID == item2.ID).OrderByDescending(p => p.IconID).FirstOrDefault(); if (my_config != null) { mySysConfig.Value = my_config.ConfigValue; mySysConfig.ProjectID = my_config.ProjectID; } mySysConfigList.Add(mySysConfig); } DateTime WechatNotifyTime = DateTime.MinValue; bool isOwnFee = IsRoomFeeOwn(item.StartTime, item.EndTime, mySysConfigList.ToArray(), out WechatNotifyTime); if (isOwnFee) { item.WechatNotifyTime = WechatNotifyTime; newList.Add(item); } } return(newList.ToArray()); }
public static void SetContractWarningCount(ContractDetail[] list) { if (list.Length == 0) { return; } var sysConfig = SysConfig.GetSysConfigByName(SysConfigNameDefine.ContractWarning.ToString()); if (sysConfig != null) { var contractRoomList = Contract_RoomDetail.GetContract_RoomDetailListByMinMaxContractID(list.Min(p => p.ID), list.Max(p => p.ID)); int MinProjectID = 0; int MaxProjectID = 0; if (contractRoomList.Length > 0) { MinProjectID = contractRoomList.Min(p => p.RoomID); MaxProjectID = contractRoomList.Max(p => p.RoomID); } var configProjectList = SysConfig_ProjectDetail.Get_SysConfig_ProjectListByProjectIDList(MinProjectID, MaxProjectID).Where(p => p.ConfigID == sysConfig.ID).ToArray(); foreach (var item in list) { var myContractRoomList = contractRoomList.Where(p => p.ContractID == item.ID).ToArray(); foreach (var item2 in myContractRoomList) { var myConfig = SysConfig_ProjectDetail.GetSysConfig_ProjectDetailByAllParentID(configProjectList, item2.AllParentID, item2.RoomID); int myConfigValue = 0; if (myConfig != null) { int.TryParse(myConfig.ConfigValue, out myConfigValue); } else { int.TryParse(sysConfig.Value, out myConfigValue); } if (item.ContractWarningDayCount <= myConfigValue) { item.ContractWarningDayCount = myConfigValue; } } } } }