public override void RecreateExtendedProperties() { base.RecreateExtendedProperties(); ExtendedProperties.Add("InsurerId", InsurerId.ToString()); ExtendedProperties.Add("ProgramId", ProgramId.ToString()); ExtendedProperties.Add("BenefitPlanId", BenefitPlanId.ToString()); ExtendedProperties.Add("ContinuousEnrollment", ContinuousEnrollment.ToString()); ExtendedProperties.Add("ContinuousAllowedGaps", ContinuousAllowedGaps.ToString()); ExtendedProperties.Add("ContinuousAllowedGapDays", ContinuousAllowedGapDays.ToString()); foreach (String currentKey in DateCriteria.MapToExtendedProperties().Keys) { ExtendedProperties.Add(currentKey, DateCriteria.MapToExtendedProperties()[currentKey]); } return; }
public List <RoleModel> GetProgramRoles(int programId) { var db = new StoreProcdureManagement(); db.AddParameter("@ProgramId", ProgramId.ToString()); var roles = db.RunSp <RoleModel>(ConnectionString, "sp_ProgramRoles"); return(roles); }
public DataTable GetMenu(int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "UserId", userId.ToString() } }; return(db.GetFirstTableOfData("uspGetUserMenu", ConnectionString, parameters)); }
public ProgramModel GetProgram(int programId) { var db = new StoreProcdureManagement(); db.AddParameter("@ProgramId", ProgramId.ToString()); var program = db.RunSp <ProgramModel>(ConnectionString, "sp_Program"); if (program.Any()) { return(program[0]); } return(new ProgramModel()); }
public List <UserModel> GetProgramUsers(UserStatusEnum userStatusEnum = UserStatusEnum.All) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "Enable", ((int)userStatusEnum).ToString() } }; var dt = db.GetFirstTableOfData("uspGetProgramUsers", ConnectionString, parameters); var users = new DataTableToList().Convert <UserModel>(dt); return(users); }
public List <ProgramRoleModel> GetProgramRoles(int programId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() } }; try { var dt = db.GetFirstTableOfData("uspGetProgramRoles", ConnectionString, parameters); var roles = new DataTableToList().Convert <ProgramRoleModel>(dt); return(roles); } catch (Exception ex) { throw ex; } }
public string ConvertToSearch() { var cc = DbUtil.Db.ScratchPadCondition(); cc.Reset(); var c = cc.AddNewClause(QueryType.OrgSearchMember, CompareType.Equal, "1,True"); if (Name.HasValue()) { c.OrgName = Name; } if (ProgramId != 0) { c.Program = ProgramId.ToString(); } if (DivisionId != 0) { c.Division = DivisionId.ToString(); } if (StatusId != 0) { c.OrgStatus = StatusId.ToString(); } if (TypeId != 0) { c.OrgType2 = TypeId ?? 0; } if (CampusId != 0) { c.Campus = CampusId.ToString(); } if (ScheduleId != 0) { c.Schedule = ScheduleId.ToString(); } if (OnlineReg != 0) { c.OnlineReg = OnlineReg.ToString(); } cc.Save(DbUtil.Db); return("/Query/" + cc.Id); }
public DataTable GetFullElementWithSetting(ElementTypeEnum elementType, int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "ElementTypeId", ((int)elementType).ToStringVar() }, { "UserId", userId.ToString() } }; try { return(db.GetFirstTableOfData("uspVisibleElementDataForUser", ConnectionString, parameters)); } catch (Exception ex) { throw ex; } }
public UserModel Login(string userId, string password) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "UserId", userId }, { "Password", password } }; var dt = db.GetFirstTableOfData("uspLoginInProgram", ConnectionString, parameters); if (dt == null || dt.Rows.Count < 1) { return(null); } var user = new DataTableToList().Convert <UserModel>(dt); return(user[0]); }
public override void RecreateExtendedProperties() { base.RecreateExtendedProperties(); ExtendedProperties.Add("InsurerId", InsurerId.ToString()); ExtendedProperties.Add("ProgramId", ProgramId.ToString()); ExtendedProperties.Add("BenefitPlanId", BenefitPlanId.ToString()); ExtendedProperties.Add("ContinuousAllowedGaps", ContinuousAllowedGaps.ToString()); ExtendedProperties.Add("ContinuousAllowedGapDays", ContinuousAllowedGapDays.ToString()); ExtendedProperties.Add("ContinuousUntilAge", ContinuousUntilAge.ToString()); return; }
public List <ElementAccessModel> GetElementAccess(ElementTypeEnum elementType, int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "ElementTypeId", ((int)elementType).ToStringVar() }, { "UserId", userId.ToString() } }; try { var dt = db.GetFirstTableOfData("uspVisibleElementDataForUser", ConnectionString, parameters); var elements = new DataTableToList().Convert <ElementAccessModel>(dt); return(elements); } catch (Exception ex) { throw ex; } }
public ElementAccessModel GetElementAccess(int elementId, int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "ElementId", elementId.ToString() }, { "UserId", userId.ToString() } }; try { var dt = db.GetFirstTableOfData("[uspGetUserAccessForElement]", ConnectionString, parameters); var elements = new DataTableToList().Convert <ElementAccessModel>(dt); return(elements[0]); } catch (Exception ex) { throw ex; } }
public override NameValueCollection GetParameters() { NameValueCollection nvc = base.GetParameters(); if (RequiresApiToken) { if (!String.IsNullOrEmpty(GetApiToken())) { nvc.Add("token", GetApiToken()); } } if (RequiresServiceId) { if (!String.IsNullOrEmpty(GetServiceId())) { nvc.Add("serviceId", GetServiceId()); } } ParameterValidator.IsNotNull(CategoryId, "CategoryId"); nvc.Add("categoryId", CategoryId.ToString()); if (!ParameterValidator.IsNonEmptyInt(ProgramId)) { nvc.Add("programId", ProgramId.ToString()); } if (!ParameterValidator.IsNonEmptyInt(PaymentMethodId)) { nvc.Add("paymentMethodId", PaymentMethodId.ToString()); } if (!ParameterValidator.IsNull(ShowNotAllowedOnRegistration)) { nvc.Add("ShowNotAllowedOnRegistration", ((bool)ShowNotAllowedOnRegistration) ? "1" : "0"); } return(nvc); }
public override NameValueCollection GetParameters() { var nvc = base.GetParameters(); ParameterValidator.IsNotNull(CategoryId, "CategoryId"); nvc.Add("categoryId", CategoryId.ToString()); if (!ParameterValidator.IsNonEmptyInt(ProgramId)) { nvc.Add("programId", ProgramId.ToString()); } if (!ParameterValidator.IsNonEmptyInt(PaymentMethodId)) { nvc.Add("paymentMethodId", PaymentMethodId.ToString()); } if (!ParameterValidator.IsNull(ShowNotAllowedOnRegistration)) { nvc.Add("ShowNotAllowedOnRegistration", ((bool)ShowNotAllowedOnRegistration) ? "1" : "0"); } return(nvc); }
private void ExportProgramToCSV(ProgramId progId, StreamWriter sw, char separator, StringBuilder warnings, Dictionary <ProgramId, ProgramId> exportedProgramIds) { string deviceId = DeviceTypeToString(progId.device); int enLCID = Lang.ISONameToLCID("en"); int ruLCID = Lang.ISONameToLCID("ru"); StringBuilder sb = new StringBuilder(); var enName = DB.GetProgramName(progId, enLCID); var enNameStr = ""; if (enName != null) { enNameStr = enName.FullName; } sb.Append(string.Format("${1}{0}{2}{0}", separator, deviceId, PrepareString(string.Format("{0} [{1}]", enNameStr, progId.id), separator))); //если программа еще не экспортировалась, пишем ее имена и частоты if (!exportedProgramIds.ContainsKey(progId)) { //пишем имена на русском { var name = DB.GetProgramName(progId, ruLCID); if (name != null) { sb.AppendFormat("{1}{0}{2}{0}", separator, PrepareString(name.FullName + (string.IsNullOrEmpty(name.Description) ? "" : Environment.NewLine + name.Description), separator), PrepareString(name.ShortName, separator)); } else { sb.AppendFormat("{0}{0}"); } } //пишем имена на разных языках //ищем все языки foreach (var cult in CultureInfo.GetCultures(CultureTypes.NeutralCultures)) { if (cult.LCID == ruLCID) { continue;//русский уже записали } var name = DB.GetProgramName(progId, cult.LCID); if (name != null) { sb.AppendFormat("{1}{0}{2}{0}", separator, PrepareString("#" + Lang.LCIDtoISOName(cult.LCID).ToUpper() + " " + name.FullName + (string.IsNullOrEmpty(name.Description) ? "" : Environment.NewLine + name.Description), separator), PrepareString(name.ShortName, separator)); } } //пишем частоты var data = DB.GetProgramData(progId); if (data != null) { //если данные зашифрованы и есть ключ - расшифровываем var aesKey = AES.GetKeyByDevice(progId.device); if (data.HasEncodedFreq && aesKey != null && data.Count == 0) { try { data.Decode(progId.device); } catch (CryptographicException) { warnings.AppendLine( Lang.Phrase("Не удалось расшифровать частоты. Возможно, задан неверный ключ шифрования.") + string.Format("DeviceType={0} DbType={1} ProgId={2} Name={3}", progId.device, progId.dbType, progId.id, progId.ToString())); return; } } //пишем частоты и времена for (int i = 0; i < data.CountOfFrequencies; i++) { sb.AppendFormat("{1:0.##}{0}{2}{0}", separator, data[i].frequency, data[i].time); } } //запоминаем, что эту программу уже экспортировали exportedProgramIds.Add(progId, progId); } //завершение строки sb.Append(string.Format("/${0}" + Environment.NewLine, deviceId)); //сбрасываем в поток sw.Write(sb.ToString()); }
public override System.Xml.XmlDocument XmlSerialize() { System.Xml.XmlDocument document = base.XmlSerialize(); System.Xml.XmlNode propertiesNode = document.ChildNodes[1].ChildNodes[0]; #region Properties if (insurerId != 0) { CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "InsurerId", InsurerId.ToString()); CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "Insurer", InsurerName); } if (programId != 0) { CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "ProgramId", ProgramId.ToString()); CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "Program", ProgramName); } if (benefitPlanId != 0) { CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "BenefitPlanId", BenefitPlanId.ToString()); CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "BenefitPlan", BenefitPlanName); } #endregion return(document); }