public IEnumerable <string> Search(FormStructure formStructure) { try { var outlist = new List <string>(); if (formStructure == null) { return(outlist); } var list = new FormDataBO().Where(this.ConnectionHandler, x => x.StructureId == formStructure.Id); var dictionary = formStructure.GetFormControl; foreach (var model in list) { var deSerialize = Extentions.GetControlData(model.Data); foreach (var key in dictionary.Keys) { if (!deSerialize.ContainsKey(key)) { continue; } var value = dictionary[key]; var sourcevalue = deSerialize[key]; if (string.IsNullOrEmpty(sourcevalue.ToString()) || string.IsNullOrEmpty(value.ToString())) { continue; } if (key.Contains("TextBox")) { if (sourcevalue.ToString().ToLower().Contains(value.ToString().ToLower())) { if (outlist.Any(x => x == model.RefId)) { continue; } outlist.Add(model.RefId); } } else if (sourcevalue.ToString() == value.ToString()) { if (outlist.Any(x => x == model.RefId)) { continue; } outlist.Add(model.RefId); } } } return(outlist); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public bool ModifyFormData(FormStructure formStructure) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); var formDataBo = new FormDataBO(); var frm = formDataBo.GetFormData(this.ConnectionHandler, formStructure.Id, formStructure.RefId, formStructure.ObjectName); if (frm == null) { if (formStructure.Id == Guid.Empty) { return(true); } if (!formDataBo.Insert(this.ConnectionHandler, this.FileManagerConnection, formStructure)) { return(false); } } else { if (!formDataBo.Update(this.ConnectionHandler, this.FileManagerConnection, formStructure, frm)) { return(false); } } this.ConnectionHandler.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public DataTable ReportFormDataForExcel(Guid formId, string culture) { try { var result = new FormDataBO().ReportFormDataForExcel(this.ConnectionHandler, formId, culture); return(result); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }