public IList <sp_GetAuthorizers_Result> GetAdminUsersToAuthorize(string userrole, int userid) { try { IGenericDataRepository <sp_GetAuthorizers_Result> repository = new GenericDataRepository <sp_GetAuthorizers_Result>(); return(repository.ExecuteStoredProcedure("EXEC sp_GetAuthorizers @RoleName, @UserID ", new SqlParameter("RoleName", SqlDbType.VarChar) { Value = userrole }, new SqlParameter("UserID", SqlDbType.Int) { Value = userid }).ToList()); } catch (Exception) { throw; } }
public ActionResult AddQuestion(AddQuestionsToExamViewModel vm, String ExamId) { if (String.IsNullOrEmpty(ExamId)) { ViewBag.Error = "Exam parameter missing."; return(View("Error")); } var exam = new GenericDataRepository <Exam>().GetSingle(e => e.Id == vm.ExamId); Question question = new Question() { QuestionText = vm.QuestionText, Id = Guid.NewGuid().ToString(), Exam = exam }; var QuestionRepository = new GenericDataRepository <Question>(); QuestionRepository.Add(question); return(RedirectToAction(actionName: nameof(ListQuestions), routeValues: new { @ExamId = vm.ExamId })); }
public MemoryStream GetReporteDinamico(DTOReporteDinamico reporteDinamico, string fileName) { MemoryStream memoryStream = null; try { GenericDataRepository <CatMotivosViaje> motivosViajeRepository = new GenericDataRepository <CatMotivosViaje>(); IList <DTOReporteDinamico> reporteDinamicoList = (from encuesta in _encuestaRepository.GetList(x => x.FechaAplicacion >= reporteDinamico.FechaInicio.Date && x.FechaAplicacion.Date <= reporteDinamico.FechaFin.Date) from derechohabiente in _derechohabienteRepository.GetList(x => x.IdDerechohabiente == encuesta.IdDerechohabiente).Take(1).DefaultIfEmpty() from tipoDestino in _tiposDestinoRepository.GetList(x => x.IdTipoDestino == encuesta.IdTipoDestino).Take(1).DefaultIfEmpty() from temporada in _temporadasRepository.GetList(x => x.IdTemporada == encuesta.IdTemporada).Take(1).DefaultIfEmpty() from viaje in _tiposViajeRepository.GetList(x => x.IdTipoViaje == encuesta.IdTipoViaje).Take(1).DefaultIfEmpty() from motivo in motivosViajeRepository.GetList(x => x.IdMotivoViaje == encuesta.IdMotivoViaje).Take(1).DefaultIfEmpty() from genero in _generoRepository.GetList(x => x.IdGenero == derechohabiente.IdGenero).Take(1).DefaultIfEmpty() from estado in _estadoRepository.GetList(x => x.IdEstado == derechohabiente.IdEstado).Take(1).DefaultIfEmpty() select new DTOReporteDinamico { Destino = tipoDestino.Nombre, TemporadaVacacional = temporada.Nombre, Viaje = viaje.Nombre, Motivo = motivo.Nombre, Nombre = derechohabiente.Nombre + " " + derechohabiente.ApellidoPaterno + " " + derechohabiente.ApellidoMaterno, Genero = genero.Genero, Edad = DateTime.Now.Year - derechohabiente.FechaNacimiento.Year, Estado = estado.Nombre, Derechohabiente = derechohabiente.TipoDerechohabiente, Afiliacion = derechohabiente.Afiliacion }) .ToList(); DataTable reporteDinamicoDataTable = ToDataTable.IListToDataTable(new List <DTOReporteDinamico>(reporteDinamicoList)); memoryStream = ToExcel.ExportToExcel(reporteDinamicoDataTable, fileName); } catch (Exception ex) { throw ex; } return(memoryStream); }
/// <summary> /// Load an entity from the current element of BindingSource loaded with a DataTable /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="dataRepository"></param> /// <param name="bindingSource"></param> /// <param name="fieldNames"></param> /// <returns></returns> public static object LoadEntityFromCurrentBindingSource <T, M>(GenericDataRepository <T, M> dataRepository, BindingSource bindingSource, string[] fieldNames) where T : class where M : class { object ret = null; if (bindingSource.Current != null) { object[] keyvalues = new object[] { }; foreach (string fieldName in fieldNames) { //find the key value from a field object fieldId = (((DataRowView)bindingSource.Current).Row).Field <object>(fieldName); keyvalues = keyvalues.Concat(new object[] { fieldId }).ToArray(); } //find the repository item ret = dataRepository.Find(keyvalues); } return(ret); }
public ApiResponse <CatPaquetesTuristicos> GetPaqueteTuristicoPorDerechohabiente(long idDerechohabiente) { ApiResponse <CatPaquetesTuristicos> apiResponse = new ApiResponse <CatPaquetesTuristicos>(); try { GenericDataRepository <Encuesta> encuestaRepository = new GenericDataRepository <Encuesta>(); Encuesta encuesta = encuestaRepository.GetSingle(x => x.IdDerechohabiente == idDerechohabiente && x.FechaAplicacion.Year == DateTime.Now.Year); apiResponse.Data = _repository.GetSingle(x => x.IdTipoDestino == encuesta.IdTipoDestino && x.Promocionado == false); if (apiResponse.Data != null) { apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.ConsultaExitosa; } else if (apiResponse.Data == null) { apiResponse.Result = (int)ApiResult.Initial; apiResponse.Message = Resources.ConsultaSinResultados; } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.ConsultaFallida; } } catch (Exception ex) { apiResponse.Result = (int)ApiResult.Exception; apiResponse.Message = ex.Message; } return(apiResponse); }
public async Task <IHttpActionResult> Get(int id = 0) { string methodNameStr = $"StudentController().Get({id})"; try { logger.Log(LogLevel.Info, $"{MakeLogStr4Entry(methodNameStr)}."); using (var context = new SampDB()) { var repos = new GenericDataRepository(context); var res = await repos.GetAsync <Student>(id); if (res != null) { var reslist = new List <StudentDTO>(); foreach (var record in res) { List <dynamic[]> tmpCourseIds = (List <dynamic[]>) await repos.GetPKs4EntityManyAsync <Student, Course>(record); var CourseIds = Convert2DTo1D(tmpCourseIds); reslist.Add(MakeStudentDTO(record, CourseIds)); } logger.Log(LogLevel.Info, $"{MakeLogStr4Exit(methodNameStr)} {reslist}"); return(Content(HttpStatusCode.OK, reslist)); } else { logger.Log(LogLevel.Info, $"{MakeLogStr4Exit(methodNameStr)} No content returned by repository."); return(Content(HttpStatusCode.NotFound, HttpStatusCode.NotFound)); } } } catch (Exception e) { logger.Log(LogLevel.Error, $"{MakeLogStr4Exit(methodNameStr)}:\r\n{e}"); return(Content(HttpStatusCode.InternalServerError, HttpStatusCode.InternalServerError.ToString())); } }
public int SaveChannelAlertDataMapping(IList <tbl_ChannelAlertAttrMapping> tblChannelAlertAttrMapping) { try { IGenericDataRepository <tbl_ChannelAlertAttrMapping> repository = new GenericDataRepository <tbl_ChannelAlertAttrMapping>(); //if(tblChannelAlertAttrMapping.Count > 0) //{ foreach (var item in tblChannelAlertAttrMapping) { repository.Add(item); } return(1); //} //else //{ // return 0; //} } catch (Exception) { return(0); } }
/// <summary> /// Set the BindingSource position selecting the key pairs from an entity /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="dataRepository"></param> /// <param name="item"></param> /// <param name="bindingSource"></param> public static bool SetBindingSourcePosition <T, M>(GenericDataRepository <T, M> dataRepository, object item, BindingSource bindingSource) where T : class where M : class { bool ret = false; if (item != null) { //get key for the item IDictionary <string, object> keypairs = dataRepository.Helper.GetKeyPairs((T)item); if (keypairs != null) { //consider just the first key if (keypairs.Count > 0) { //set the bindingsource position bindingSource.Position = bindingSource.Find(keypairs.FirstOrDefault().Key, keypairs.FirstOrDefault().Value); ret = true; } } } return(ret); }
public HttpResponseMessage DumCart(string id) { var jsonString = @"{ ""items"":[ {""name"":""360 Chicago General Admission"",""sku"":""15721"",""ProductDimensionUID"":""4ABCEC20-DF14-4942-BD74-820271AEDDA9"",""qty"":2,""price"":29.99,""discount"":0,""total"":59.98,""city"":""chicago"",""type"":""adult""}, {""name"":""Art Institute General Admission"",""sku"":""15722"",""ProductDimensionUID"":""76EB57C6-DE0D-455F-9FBE-342D87ADEF6D"",""qty"":1,""price"":23.59,""discount"":3.5,""total"":20.09,""city"":""chicago"",""type"":""adult"",""coupon"":""Coupe-coupe""}], ""subtotal"":83.57,""discount"":3.5,""total"":80.07,""coupon"":""TEST-COUPON1"",""currency"":""EUR"",""language"":""eng"" }"; if (!string.IsNullOrEmpty(id)) { var dumpRepos = new GenericDataRepository <BornBasketDump>(); var basketDump = dumpRepos.GetSingle(x => x.ExternalCookieValue != null && x.ExternalCookieValue.Equals(id, StringComparison.CurrentCultureIgnoreCase)); jsonString = basketDump.BasketJsonDump; } JToken json = JObject.Parse(jsonString); return(new HttpResponseMessage() { Content = new JsonContent(json) }); }
/// <summary> /// Validate and Update a record /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="dataRepository"></param> /// <param name="item"></param> public static void Update <T, M>(GenericDataRepository <T, M> dataRepository, object item) where T : class where M : class { //update with validation string[] errors = new string[] { }; string exceptionTrace = ""; if (!dataRepository.Update(ref errors, ref exceptionTrace, (T)item)) { if (errors.Length > 0) { throw new ArgumentException(String.Join("\r\n", errors)); } else if (!String.IsNullOrEmpty(exceptionTrace)) { throw new DataException(exceptionTrace); } else { throw new ArgumentException("Unknown error happened.\n"); } } }
/// <summary> /// Validate and Remove a record /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="checkForeingKeys"></param> /// <param name="excludedForeingKeys"></param> /// <param name="dataRepository"></param> /// <param name="item"></param> public static void Remove <T, M>(bool checkForeingKeys, string[] excludedForeingKeys, GenericDataRepository <T, M> dataRepository, object item) where T : class where M : class { //remove with validation string[] errors = new string[] { }; string exceptionTrace = ""; if (!dataRepository.Remove(checkForeingKeys, excludedForeingKeys, ref errors, ref exceptionTrace, (T)item)) { if (errors.Length > 0) { throw new ArgumentException(String.Join("\r\n", errors)); } else if (!String.IsNullOrEmpty(exceptionTrace)) { throw new DataException(exceptionTrace); } else { throw new ArgumentException("Unknown error happened.\n"); } } }
public void DeleteBuzrulattrmap(int id) { try { tbl_BusinessRule objBusinessRule = new tbl_BusinessRule(); tbl_BuzRulesAttrMapping objtblBuzRuleAttrMap = new tbl_BuzRulesAttrMapping(); IGenericDataRepository <tbl_BusinessRule> repository = new GenericDataRepository <tbl_BusinessRule>(); IGenericDataRepository <tbl_BuzRulesAttrMapping> repository1 = new GenericDataRepository <tbl_BuzRulesAttrMapping>(); IList <tbl_BusinessRule> lstBusinessRule = repository.GetList(q => q.BuzRuleID == id); if (lstBusinessRule != null) { foreach (var item in lstBusinessRule) { objBusinessRule.BuzRuleID = item.BuzRuleID; objBusinessRule.BuzRuleAttrMapID = item.BuzRuleAttrMapID; objBusinessRule.daId = item.daId; objBusinessRule.TransactionSeq = item.TransactionSeq; objBusinessRule.EntityState = EntityState.Deleted; var buzruleId = item.BuzRuleAttrMapID; IList <tbl_BuzRulesAttrMapping> lstBuzRuleMapId = repository1.GetList(q => q.BuzRulesAttrMapID.Equals(item.BuzRuleAttrMapID)); if (lstBuzRuleMapId != null) { foreach (var item1 in lstBuzRuleMapId) { objtblBuzRuleAttrMap.AttrID1 = item1.AttrID1; objtblBuzRuleAttrMap.AttrID2 = item1.AttrID2; objtblBuzRuleAttrMap.AttrID3 = item1.AttrID3; objtblBuzRuleAttrMap.AttrID4 = item1.AttrID4; objtblBuzRuleAttrMap.AttrID5 = item1.AttrID5; objtblBuzRuleAttrMap.AttrID6 = item1.AttrID6; objtblBuzRuleAttrMap.AttrID7 = item1.AttrID7; objtblBuzRuleAttrMap.AttrID8 = item1.AttrID8; objtblBuzRuleAttrMap.AttrID9 = item1.AttrID9; objtblBuzRuleAttrMap.AttrID10 = item1.AttrID10; objtblBuzRuleAttrMap.AttrValueID1 = item1.AttrValueID1; objtblBuzRuleAttrMap.AttrValueID2 = item1.AttrValueID2; objtblBuzRuleAttrMap.AttrValueID3 = item1.AttrValueID3; objtblBuzRuleAttrMap.AttrValueID4 = item1.AttrValueID4; objtblBuzRuleAttrMap.AttrValueID5 = item1.AttrValueID5; objtblBuzRuleAttrMap.AttrValueID6 = item1.AttrValueID6; objtblBuzRuleAttrMap.AttrValueID7 = item1.AttrValueID7; objtblBuzRuleAttrMap.AttrValueID8 = item1.AttrValueID8; objtblBuzRuleAttrMap.AttrValueID9 = item1.AttrValueID9; objtblBuzRuleAttrMap.AttrValueID10 = item1.AttrValueID10; objtblBuzRuleAttrMap.BuzRuleDesc = item1.BuzRuleDesc; objtblBuzRuleAttrMap.BuzRulesAttrMapID = item1.BuzRulesAttrMapID; objtblBuzRuleAttrMap.Remarks = item1.Remarks; objtblBuzRuleAttrMap.ReqReference = item1.ReqReference; objtblBuzRuleAttrMap.EntityState = EntityState.Deleted; repository1.Remove(objtblBuzRuleAttrMap); } } repository.Remove(objBusinessRule); } } } catch (Exception) { throw; } }
public GenericBl(GenericDataRepository <T> _repo) { _repository = _repo; }
/// <summary> /// Load a property values for an entity loaded by the current element of BindingSource loaded with a DataTable /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="dataRepository"></param> /// <param name="bindingSource"></param> /// <param name="fieldNames"></param> /// <returns></returns> public static IDictionary <string, object> LoadPropertyValuesFromCurrentBindingSource <T, M>(GenericDataRepository <T, M> dataRepository, BindingSource bindingSource, string[] fieldNames) where T : class where M : class { IDictionary <string, object> ret = null; if (bindingSource.Current != null) { object[] keyvalues = new object[] { }; foreach (string fieldName in fieldNames) { //find the key value from a field object fieldId = (((DataRowView)bindingSource.Current).Row).Field <object>(fieldName); keyvalues = keyvalues.Concat(new object[] { fieldId }).ToArray(); } //find the repository item T item = dataRepository.Find(keyvalues); if (item != null) { //get property values ret = dataRepository.Helper.GetPropertyValues(item); } } return(ret); }
//public int SaveDataInterface(IList<tbl_Interface> tblInterface) //{ // try // { // IGenericDataRepository<tbl_Interface> repository = new GenericDataRepository<tbl_Interface>(); // foreach (var item in tblInterface) // repository.Add(item); // return 1; // } // catch (Exception ex) // { // return 0; // } //} public void DeleteInterfaceAttr(int id) { try { tbl_Interface objtblinterface = new tbl_Interface(); tbl_InterfaceAttrMapping objinterfaceMapping = new tbl_InterfaceAttrMapping(); IGenericDataRepository <tbl_Interface> repository = new GenericDataRepository <tbl_Interface>(); IList <tbl_Interface> lstInterfaceid = repository.GetList(q => q.InterfaceID.Equals(id)); IGenericDataRepository <tbl_InterfaceAttrMapping> repository1 = new GenericDataRepository <tbl_InterfaceAttrMapping>(); if (lstInterfaceid != null) { foreach (var item in lstInterfaceid) { objtblinterface.daId = item.daId; objtblinterface.InterfaceAttrMapID = item.InterfaceAttrMapID; objtblinterface.InterfaceID = item.InterfaceID; objtblinterface.TransactionSeq = item.TransactionSeq; objtblinterface.EntityState = EntityState.Deleted; IList <tbl_InterfaceAttrMapping> lstInterfaceMapId = repository1.GetList(q => q.InterfaceAttrMapID.Equals(item.InterfaceAttrMapID)); if (lstInterfaceMapId != null) { foreach (var item1 in lstInterfaceMapId) { objinterfaceMapping.AttrID1 = item1.AttrID1; objinterfaceMapping.AttrID2 = item1.AttrID2; objinterfaceMapping.AttrID3 = item1.AttrID3; objinterfaceMapping.AttrID4 = item1.AttrID4; objinterfaceMapping.AttrID5 = item1.AttrID5; objinterfaceMapping.AttrID6 = item1.AttrID6; objinterfaceMapping.AttrID7 = item1.AttrID7; objinterfaceMapping.AttrID8 = item1.AttrID8; objinterfaceMapping.AttrID9 = item1.AttrID9; objinterfaceMapping.AttrID10 = item1.AttrID10; objinterfaceMapping.AttrValueID1 = item1.AttrValueID1; objinterfaceMapping.AttrValueID2 = item1.AttrValueID2; objinterfaceMapping.AttrValueID3 = item1.AttrValueID3; objinterfaceMapping.AttrValueID4 = item1.AttrValueID4; objinterfaceMapping.AttrValueID5 = item1.AttrValueID5; objinterfaceMapping.AttrValueID6 = item1.AttrValueID6; objinterfaceMapping.AttrValueID7 = item1.AttrValueID7; objinterfaceMapping.AttrValueID8 = item1.AttrValueID8; objinterfaceMapping.AttrValueID9 = item1.AttrValueID9; objinterfaceMapping.AttrValueID10 = item1.AttrValueID10; objinterfaceMapping.InterfaceAttrMapID = item1.InterfaceAttrMapID; objinterfaceMapping.InterfaceDesc = item1.InterfaceDesc; objinterfaceMapping.ModeTypeId = item1.ModeTypeId; objinterfaceMapping.ReqReference = item1.ReqReference; objinterfaceMapping.SourceId = item1.SourceId; objinterfaceMapping.DestinationId = item1.DestinationId; objinterfaceMapping.EntityState = EntityState.Deleted; repository1.Remove(objinterfaceMapping); } } repository.Remove(objtblinterface); } } } catch (Exception) { throw; } }
public void UpdateChangePassword(tbl_ChangePassword tblChangePassword) { IGenericDataRepository <tbl_ChangePassword> repository = new GenericDataRepository <tbl_ChangePassword>(); repository.Update(tblChangePassword); }
public void AddChangePassword(tbl_ChangePassword tblChangePassword) { IGenericDataRepository <tbl_ChangePassword> repository = new GenericDataRepository <tbl_ChangePassword>(); repository.Add(tblChangePassword); }
public CursoImp(GenericDataRepository <Curso> _repository) : base(_repository) { }
public DONDATHANGBUS() { dao = new DONDATHANGDAO(); ctdh_dao = new GenericDataRepository <CT_DONDATHANG>(); }
public async Task <ApiResponse <DTODerechohabiente> > GetDerechohabienteService(string noIssste) { ApiResponse <DTODerechohabiente> apiResponse = new ApiResponse <DTODerechohabiente>(); try { string result = string.Empty; string aVBaseUrl = ConfigurationManager.AppSettings["InformixWSBaseUrl"]; string aVService = string.Format(ConfigurationManager.AppSettings["InformixWSEntitle"], noIssste); using (var client = new HttpClient()) { client.BaseAddress = new Uri(aVBaseUrl); HttpResponseMessage response = await client.GetAsync(aVService); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsStringAsync(); } } if (result.Length >= 3) { DTODerechohabienteService derechohabienteService = JsonConvert.DeserializeObject <IList <DTODerechohabienteService> >(result).FirstOrDefault(); GenericDataRepository <CatEstados> estadosRepository = new GenericDataRepository <CatEstados>(); CatEstados estadoDerechohabiente = estadosRepository.GetSingle(x => x.Clave == derechohabienteService.EntityBirth); apiResponse.Data = new DTODerechohabiente() { Nombre = derechohabienteService.Name, ApellidoPaterno = derechohabienteService.FirstSurname, ApellidoMaterno = derechohabienteService.SecondSurname, NombreCompleto = string.Join(" ", new[] { derechohabienteService.Name, derechohabienteService.FirstSurname, derechohabienteService.SecondSurname }), FechaNacimiento = derechohabienteService.BirthDate, Edad = DateTime.Now.Year - derechohabienteService.BirthDate.Year, Rfc = derechohabienteService.Rfc, Curp = derechohabienteService.Curp, NoIssste = derechohabienteService.NumIssste, Delegacion = derechohabienteService.DelegationCode, Afiliacion = derechohabienteService.State, IdGenero = derechohabienteService.Genger == "M" ? 1 : 2, Genero = derechohabienteService.Genger == "M" ? "MUJER" : "HOMBRE", IdEstado = estadoDerechohabiente.IdEstado, TipoDerechohabiente = derechohabienteService.DirectType == "T" ? "TRABAJADOR" : "PENSIONADO", Estado = estadoDerechohabiente.Nombre.ToUpper() }; if (apiResponse.Data != null) { apiResponse.Result = (int)ApiResult.Success; apiResponse.Message = Resources.ConsultaExitosa; } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.ConsultaFallida; } } else { apiResponse.Result = (int)ApiResult.Failure; apiResponse.Message = Resources.ConsultaFallida; } } catch (Exception ex) { apiResponse.Result = (int)ApiResult.Exception; apiResponse.Message = ex.Message; } return(apiResponse); }
public NHACCBUS() { dao = new GenericDataRepository <NHACC>(); }
public void DeleteChannelAttrMapId(int id) { try { tbl_ChannelAlert tblchannelAlert = new tbl_ChannelAlert(); IGenericDataRepository <tbl_ChannelAlert> repository = new GenericDataRepository <tbl_ChannelAlert>(); tbl_ChannelAlertAttrMapping objtblChannelAlertMapping = new tbl_ChannelAlertAttrMapping(); IGenericDataRepository <tbl_ChannelAlertAttrMapping> repository1 = new GenericDataRepository <tbl_ChannelAlertAttrMapping>(); IList <tbl_ChannelAlert> lstChannelalert = repository.GetList(q => q.ChannelAlertID.Equals(id)); if (lstChannelalert != null) { foreach (var item in lstChannelalert) { tblchannelAlert.ChannelAlertID = item.ChannelAlertID; tblchannelAlert.ChannelAlertAttrMapID = item.ChannelAlertAttrMapID; tblchannelAlert.daId = item.daId; tblchannelAlert.TransactionSeq = item.TransactionSeq; tblchannelAlert.EntityState = EntityState.Deleted; IList <tbl_ChannelAlertAttrMapping> lstChannelAlertMappingid = repository1.GetList(q => q.ChannelAlertAttrMapID.Equals(item.ChannelAlertAttrMapID)); if (lstChannelAlertMappingid != null) { foreach (var item1 in lstChannelAlertMappingid) { objtblChannelAlertMapping.AttrID1 = item1.AttrID1; objtblChannelAlertMapping.AttrID2 = item1.AttrID2; objtblChannelAlertMapping.AttrID3 = item1.AttrID3; objtblChannelAlertMapping.AttrID4 = item1.AttrID4; objtblChannelAlertMapping.AttrID5 = item1.AttrID5; objtblChannelAlertMapping.AttrID6 = item1.AttrID6; objtblChannelAlertMapping.AttrID7 = item1.AttrID7; objtblChannelAlertMapping.AttrID8 = item1.AttrID8; objtblChannelAlertMapping.AttrID9 = item1.AttrID9; objtblChannelAlertMapping.AttrID10 = item1.AttrID10; objtblChannelAlertMapping.AttrValueID1 = item1.AttrValueID1; objtblChannelAlertMapping.AttrValueID2 = item1.AttrValueID2; objtblChannelAlertMapping.AttrValueID3 = item1.AttrValueID3; objtblChannelAlertMapping.AttrValueID4 = item1.AttrValueID4; objtblChannelAlertMapping.AttrValueID5 = item1.AttrValueID5; objtblChannelAlertMapping.AttrValueID6 = item1.AttrValueID6; objtblChannelAlertMapping.AttrValueID7 = item1.AttrValueID7; objtblChannelAlertMapping.AttrValueID8 = item1.AttrValueID8; objtblChannelAlertMapping.AttrValueID9 = item1.AttrValueID9; objtblChannelAlertMapping.AttrValueID10 = item1.AttrValueID10; objtblChannelAlertMapping.ChannelAlertAttrMapID = item1.ChannelAlertAttrMapID; objtblChannelAlertMapping.DestnID = item1.DestnID; objtblChannelAlertMapping.DistributionTypeID = item1.DistributionTypeID; objtblChannelAlertMapping.FreqID = item1.FreqID; objtblChannelAlertMapping.IsManual = item1.IsManual; objtblChannelAlertMapping.MessageDesc = item1.MessageDesc; objtblChannelAlertMapping.ModeTypeID = item1.ModeTypeID; objtblChannelAlertMapping.SourceID = item1.SourceID; objtblChannelAlertMapping.ReqReference = item1.ReqReference; objtblChannelAlertMapping.EntityState = EntityState.Deleted; repository1.Remove(objtblChannelAlertMapping); } } repository.Remove(tblchannelAlert); } } } catch (Exception) { throw; } }
/// <summary> /// Validate and Remove a record /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="checkForeingKeys"></param> /// <param name="dataRepository"></param> /// <param name="item"></param> public static void Remove <T, M>(bool checkForeingKeys, GenericDataRepository <T, M> dataRepository, object item) where T : class where M : class { Remove(checkForeingKeys, null, dataRepository, item); }
public void DeleteChangePassword(tbl_ChangePassword tblChangePassword) { IGenericDataRepository <tbl_ChangePassword> repository = new GenericDataRepository <tbl_ChangePassword>(); repository.Remove(tblChangePassword); }
/// <summary> /// Validate and Remove a record, check for foreing keys /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="dataRepository"></param> /// <param name="item"></param> public static void Remove <T, M>(GenericDataRepository <T, M> dataRepository, object item) where T : class where M : class { Remove(true, null, dataRepository, item); }
/// <summary> /// Get a ConcurrencyHelperRecord from a repository /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="M"></typeparam> /// <param name="dataRepository"></param> /// <param name="item"></param> /// <returns></returns> public static Nullable <DGUIGHFForm.ConcurrencyHelperRecord> GetConcurrencyHelperRecord <T, M>(GenericDataRepository <T, M> dataRepository, object item) where T : class where M : class { Nullable <DGUIGHFForm.ConcurrencyHelperRecord> ret = null; if (item != null) { //get database name string database = GetDatabaseName <T, M>(dataRepository); //get database table name string table = GetTableName <T, M>(dataRepository); //get record id, i.e. serialized keys string recordId = GetKeyPairsToJson <T, M>(dataRepository, item); if (!String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(table) && !String.IsNullOrEmpty(recordId)) { //build the concurrencyhelperrecord ret = new DGUIGHFForm.ConcurrencyHelperRecord(database, table, recordId); } } return(ret); }
public TranslationOps(TranslationContext translationContext, IMapper mapper) { _trnsCtx = translationContext; _mapper = mapper; _translationRepo = new GenericDataRepository <Translation>(translationContext); }