public ConceptsManagement() { BSecondaryConceptUserDefined = new BSecondaryConceptUserDefined(); StringBuilder = new StringGenerator(); LangProv = new BLanguage(); ExceptionHandler = new ExceptionHandler(); }
private void Fill_cmbConcept_Concepts(LoadState Ls, int pageSize, int pageIndex, string searchTerm) { var retMessage = new string[4]; IList <SecondaryConcept> ConceptsList = null; try { this.InitializeCulture(); switch (Ls) { case LoadState.Normal: ConceptsList = BSecondaryConceptUserDefined.GetAllNonPeriodicByPageBySearch(pageIndex, pageSize, string.Empty); break; case LoadState.Search: ConceptsList = BSecondaryConceptUserDefined.GetAllNonPeriodicByPageBySearch(pageIndex, pageSize, searchTerm); break; } foreach (SecondaryConcept secondaryConcept in ConceptsList) { ComboBoxItem personCmbItem = new ComboBoxItem(secondaryConcept.Name + " " + secondaryConcept.IdentifierCode); personCmbItem["Name"] = secondaryConcept.Name; personCmbItem["Code"] = secondaryConcept.IdentifierCode; personCmbItem.Id = secondaryConcept.ID.ToString(); this.cmbConcept_Concepts.Items.Add(personCmbItem); } } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (OutOfExpectedRangeException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
private void Fill_GridConcepts_Concepts(LoadState Ls, int pageSize, int pageIndex, string searchTerm) { var retMessage = new string[4]; IList <SecondaryConcept> ConceptsList = null; try { this.InitializeCulture(); switch (Ls) { case LoadState.Normal: ConceptsList = BSecondaryConceptUserDefined.GetAllByPageBySearch(pageIndex, pageSize, string.Empty); break; case LoadState.Search: ConceptsList = BSecondaryConceptUserDefined.GetAllByPageBySearch(pageIndex, pageSize, searchTerm); break; } this.GridConcepts_Concepts.DataSource = ConceptsList; this.GridConcepts_Concepts.DataBind(); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (OutOfExpectedRangeException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_Concepts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
public string[] UpdateConcept_ConceptsPage( string ID, string IdentifierCode, string Name, string Color, string KeyColumnName, string CSharpCode, string Script, string UserDefined, string PeriodicType, string Type, string CalcSituationType, string PersistSituationType, string CustomeCategoryCode, string JsonObject, string PageState ) { this.InitializeCulture(); UIValidationExceptions uiValidationExceptions = new UIValidationExceptions(); string[] retMessage = new string[4]; decimal iID = 0; SecondaryConcept ConceptRecived = new SecondaryConcept(); ConceptRecived.ID = Convert.ToDecimal(StringBuilder.CreateString(ID)); PageState = StringBuilder.CreateString(PageState); if (PageState != "Delete") { uiValidationExceptions = BSecondaryConceptUserDefined.SecondaryConceptEnumJsonObjectsValidation( StringBuilder.CreateString(PeriodicType), StringBuilder.CreateString(Type), StringBuilder.CreateString(CalcSituationType), StringBuilder.CreateString(PersistSituationType) ); if (uiValidationExceptions.ExceptionList.Count > 0) { retMessage = this.exceptionHandler.HandleException( this.Page, ExceptionTypes.UIValidationExceptions, uiValidationExceptions, retMessage); return(retMessage); } ConceptRecived.IdentifierCode = Convert.ToDecimal(StringBuilder.CreateString(IdentifierCode)); ConceptRecived.Name = StringBuilder.CreateString(Name); ConceptRecived.Color = StringBuilder.CreateString(Color); ConceptRecived.KeyColumnName = StringBuilder.CreateString(KeyColumnName); ConceptRecived.CSharpCode = StringBuilder.CreateString(CSharpCode, StringGeneratorExceptionType.ConceptRuleManagement); ConceptRecived.Script = StringBuilder.CreateString(Script, StringGeneratorExceptionType.ConceptRuleManagement); ConceptRecived.UserDefined = bool.Parse(StringBuilder.CreateString(UserDefined)); ConceptRecived.PeriodicType = (ScndCnpPeriodicType)Enum.Parse(typeof(ScndCnpPeriodicType), StringBuilder.CreateString(PeriodicType)); ConceptRecived.Type = (ScndCnpPairableType)Enum.Parse(typeof(ScndCnpPairableType), StringBuilder.CreateString(Type)); ConceptRecived.CalcSituationType = (ScndCnpCalcSituationType)Enum.Parse(typeof(ScndCnpCalcSituationType), StringBuilder.CreateString(CalcSituationType)); ConceptRecived.PersistSituationType = (ScndCnpPersistSituationType)Enum.Parse(typeof(ScndCnpPersistSituationType), StringBuilder.CreateString(PersistSituationType)); ConceptRecived.CustomCategoryCode = ((ScndCnpCustomeCategoryCode)Enum.Parse(typeof(ScndCnpCustomeCategoryCode), StringBuilder.CreateString(CustomeCategoryCode))).ToString("D"); ConceptRecived.JsonObject = StringBuilder.CreateString(JsonObject, StringGeneratorExceptionType.ConceptRuleManagement); } #region Effect on DB try { #region Set UIActionType Enum UIActionType uiActionType = UIActionType.ADD; switch (PageState.ToUpper()) { #region Add case "ADD": uiActionType = UIActionType.ADD; iID = BSecondaryConceptUserDefined.InsertConcept(ConceptRecived); break; #endregion #region Edit case "EDIT": uiActionType = UIActionType.EDIT; if (ConceptRecived.ID == 0) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoConceptSelectedforEdit").ToString()), retMessage); return(retMessage); } var concept = BSecondaryConceptUserDefined.GetByID(ConceptRecived.ID); BSecondaryConceptUserDefined.Copy(ConceptRecived, ref concept); iID = BSecondaryConceptUserDefined.UpdateConcept(concept); break; #endregion #region Delete case "DELETE": uiActionType = UIActionType.DELETE; if (ConceptRecived.ID == 0) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoConceptSelectedforDelete").ToString()), retMessage); return(retMessage); } iID = BSecondaryConceptUserDefined.DeleteConcept(ConceptRecived); break; #endregion } #endregion retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString(); string SuccessMessageBody = string.Empty; switch (uiActionType) { case UIActionType.ADD: SuccessMessageBody = GetLocalResourceObject("AddComplete").ToString(); break; case UIActionType.EDIT: SuccessMessageBody = GetLocalResourceObject("EditComplete").ToString(); break; case UIActionType.DELETE: SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString(); break; } retMessage[1] = SuccessMessageBody; retMessage[2] = "success"; retMessage[3] = iID.ToString(CultureInfo.InvariantCulture); return(retMessage); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); return(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); return(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); return(retMessage); } #endregion }