public override async void DeleteAction()
 {
     try
     {
         if (Model.IsValid)
         {
             Model.UpdatedBy = EasyApp.Current.User.Login;
             SECConnection data = null;
             if (Permisions.FirstOrDefault(x => x.Id == 3).Active)
             {
                 data = ((SECConnection)await EasyApp.Current.eToolsServer().ExecuteAsync(Model.Entity, Actions.Remove, Options.Me, EasyApp.Current.DefaultDatabaseSettingName, ""));
             }
             else
             {
                 throw new Exception(GetLocalizedMessage(Language.ApplicationValidateSaveModified, GetLocalizedMessage(Language.ApplicationDelete)));
             }
             if (data != null)
             {
                 Model.Details.Remove(data);
                 PostDeleteAction();
             }
         }
         else
         {
             PostDeleteAction(errorTitle: GetLocalizedMessage(Language.ApplicationInformation), errorMessage: GetLocalizedMessage(Language.ApplicationPendingValidations), showMessageError: true, image: MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         PostDeleteAction(errorTitle: GetLocalizedMessage(Language.ApplicationError), errorMessage: new BusinessException(ex).GetExceptionMessage(), showMessageError: true, image: MessageBoxImage.Error);
     }
 }
Exemplo n.º 2
0
        public override String GetQuery(SECConnection data, Boolean byId)
        {
            String dml = base.GetQuery(data, byId);

            if (byId)
            {
                //add more parameters to method for query by id
            }
            else
            {
                //Determine if the boolean values ​​are taken included as part of the consultation
                //dml += "             AND a.Active = :Active \n" ;

                //add more parameters to method for query by any field

                if (data.Company != null && data.Company.Id != 0)
                {
                    dml += "             AND a.Company.Id = :Company \n";
                }
                //if (  data.DbType != null && data.DbType.Id != 0 )
                //           dml += "             AND a.DbType.Id = :DbType \n" ;

                dml += " order by a.Id asc ";
            }
            return(dml);
        }
Exemplo n.º 3
0
 public override SECConnection Execute(SECConnection data, Actions action, Options option, string token)
 {
     try
     {
         if (action == Actions.Add || action == Actions.Modify || action == Actions.Remove || (action == Actions.Find && (option == Options.Me || option == Options.Exist)))
         {
             if ((action == Actions.Add || action == Actions.Modify) && option == Options.All)
             {
                 BenginTransaction();
             }
             data = base.Execute(data, action, option, token);
             if ((action == Actions.Add || action == Actions.Modify) && option == Options.All)
             {
                 AddDetails(data);
             }
             //if (option == Options.All)
             //    Work.Commit();
             return(data);
         }
         else if (action == Actions.Find && (option == Options.All || option == Options.Light))
         {
             if (option == Options.All)
             {
                 data.Entities = FindAll(data, Options.All);
             }
             else if (option == Options.Light)
             {
                 data.Entities = FindAll(data, Options.Light);
             }
             return(data);
         }
         else
         {
             throw new NotImplementedException(GetLocalizedMessage(Language.DLACTIONNOTIMPLEMENT, action.ToString(), option.ToString()));
         }
     }
     catch (FaultException <BusinessException> f)
     {
         Rollback();
         throw f;
     }
     catch (Exception e)
     {
         Rollback();
         throw new BusinessException(e).GetFaultException();
     }
     finally
     {
         Commit();
     }
 }
Exemplo n.º 4
0
        public static String GetConnectionString(SECConnection conn)
        {
            string sPassword = Crypto.DecrytedString(conn.Password);

            string connectionString = "";

            if (conn.DbType == DBType.SQLServer.ToString())
            {
                string AdditionalOptions = "; Integrated Security = False; Persist Security Info = False; Enlist=False; Pooling=True; Min Pool Size=1; Max Pool Size=1000; MultipleActiveResultSets=True; Connect Timeout=15; User Instance=False";
                connectionString  = "Data Source =" + conn.Service + "; Initial Catalog=" + conn.DB + "; User ID=" + conn.Login + "; Password="******"Data Source=" + conn.Service + ";User ID=" + conn.Login + "; Password="******" ";
            }
            return(connectionString);
        }
 public override async void SaveAction(bool createNew)
 {
     try
     {
         if (Model.IsValid)
         {
             Model.UpdatedBy = EasyApp.Current.User.Login;
             SECConnection data = null;
             if (Model.Id == 0 && Permisions.FirstOrDefault(x => x.Id == 1).Active)
             {
                 data = ((SECConnection)await EasyApp.Current.eToolsServer().ExecuteAsync(Model.Entity, Actions.Add, Options.Me, EasyApp.Current.DefaultDatabaseSettingName, ""));
             }
             else if (Model.Id != 0 && Permisions.FirstOrDefault(x => x.Id == 2).Active)
             {
                 data = ((SECConnection)await EasyApp.Current.eToolsServer().ExecuteAsync(Model.Entity, Actions.Modify, Options.Me, EasyApp.Current.DefaultDatabaseSettingName, ""));
             }
             else
             {
                 throw new Exception(GetLocalizedMessage(Language.ApplicationValidateSaveModified, ((Model.Id == 0) ? GetLocalizedMessage(Language.ApplicationAdd) : GetLocalizedMessage(Language.ApplicationModified))));
             }
             if (data != null)
             {
                 if (Model.Details.IndexOf(data) != -1)
                 {
                     Model.Details[Model.Details.IndexOf(data)] = data;
                 }
                 else
                 {
                     Model.Details.Add(data);
                 }
                 Model.Entity = data;
                 PostSaveAction(createNew: true);
             }
         }
         else
         {
             PostSaveAction(errorTitle: GetLocalizedMessage(Language.ApplicationInformation), errorMessage: GetLocalizedMessage(Language.ApplicationPendingValidations), showMessageError: true, createNew: false, image: MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         PostSaveAction(errorTitle: GetLocalizedMessage(Language.ApplicationError), errorMessage: new BusinessException(ex).GetExceptionMessage(), showMessageError: true, createNew: false, image: MessageBoxImage.Error);
     }
 }
 public override async void FindAction()
 {
     try
     {
         SECConnection data = ((SECConnection)await EasyApp.Current.eToolsServer().ExecuteAsync(Model.Entity, Actions.Find, Options.All, EasyApp.Current.DefaultDatabaseSettingName, ""));
         if (data.Entities != null && data.Entities.Count > 0)
         {
             Model.Details = new BindingList <SECConnection>(data.Entities);
         }
         else
         {
             Model.Details = new BindingList <SECConnection>();
         }
         PostFindAction(queryName: "SECConnections", recordNumber: Model.Details.Count, errorMessage: "");
     }
     catch (Exception ex)
     {
         PostFindAction("", 0, new BusinessException(ex).GetExceptionMessage());
     }
 }
Exemplo n.º 7
0
        public override void SetQueryParameters(IQuery query, SECConnection data, Boolean byId)
        {
            base.SetQueryParameters(query, data, byId);
            if (byId)
            {
                //add more parameters to method for query by id
            }
            else
            {
                //Determine if the boolean values ​​are taken included as part of the consultation
                //query.SetBoolean("Active",  data.Active);

                //add more parameters to method for query by any field

                if (data.Company != null && data.Company.Id != 0)
                {
                    query.SetInt32("Company", data.Company.Id);
                }
                //if (  data.DbType != null && data.DbType.Id != 0 )
                //   query.SetInt32("DbType", data.DbType.Id);
            }
        }
Exemplo n.º 8
0
 public override void RemoveRules(SECConnection data)
 {
     base.RemoveRules(data);
 }
Exemplo n.º 9
0
 public override void ModifyRules(SECConnection data)
 {
     base.ModifyRules(data);
     data.LastUpdate = DateTime.Now;
 }
Exemplo n.º 10
0
 public override void CommonRules(SECConnection data)
 {
     base.CommonRules(data);
 }
Exemplo n.º 11
0
 public void AddDetails(SECConnection data)
 {
 }
Exemplo n.º 12
0
 public override void FindByIdRules(SECConnection data)
 {
     base.FindByIdRules(data);
 }
Exemplo n.º 13
0
 public override List <SECConnection> FindAll(SECConnection data, Options option)
 {
     return(base.FindAll(data, option));
 }
Exemplo n.º 14
0
 public override SECConnection FindById(SECConnection data)
 {
     return(base.FindById(data));
 }
Exemplo n.º 15
0
 public override void AddMoreDetailFindById(SECConnection data)
 {
 }
Exemplo n.º 16
0
 public override void SaveOrUpdateDetails(SECConnection data)
 {
     base.SaveOrUpdateDetails(data);
 }