Exemplo n.º 1
0
        public override void SetQueryParameters(IQuery query, SECCompany 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
            }
        }
Exemplo n.º 2
0
        public override String GetQuery(SECCompany 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


                dml += " order by a.Id asc ";
            }
            return(dml);
        }
        void ReadSEC()
        {
            string      secCompanies = Resources.SECCompanyList;
            XmlDocument doc          = new XmlDocument();

            doc.LoadXml(secCompanies);

            var companiesTags = doc.SelectNodes("/companies/company");

            if (companiesTags != null)
            {
                for (int i = 0; i < companiesTags.Count; ++i)
                {
                    SECCompany comp = new SECCompany();
                    comp.CIK    = companiesTags[i].Attributes["cik"].Value;
                    comp.Ticker = companiesTags[i].Attributes["ticker"].Value;
                    comp.Name   = companiesTags[i].Attributes["name"].Value;

                    _lookupSECCompanies.Add(comp.CIK, comp);
                    _lookupSECCompaniesByTicker.Add(comp.Ticker, comp);
                }
            }
        }
Exemplo n.º 4
0
 public override SECCompany Execute(SECCompany 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();
                 cONEquivalenceDl             = new CONEquivalenceBLL(Work);
                 cONIntegratorConfigurationDl = new CONIntegratorConfigurationBLL(Work);
                 cONSQLDl         = new CONSQLBLL(Work);
                 sECConnectionDl  = new SECConnectionBLL(Work);
                 sECUserCompanyDl = new SECUserCompanyBLL(Work);
             }
             data = base.Execute(data, action, option, token);
             if (action == Actions.Find && option == Options.Me)
             {
                 cONEquivalenceDl             = new CONEquivalenceBLL(this.Work.Settings);
                 cONIntegratorConfigurationDl = new CONIntegratorConfigurationBLL(this.Work.Settings);
                 cONSQLDl          = new CONSQLBLL(this.Work.Settings);
                 sECConnectionDl   = new SECConnectionBLL(this.Work.Settings);
                 sECUserCompanyDl  = new SECUserCompanyBLL(this.Work.Settings);
                 data.Equivalences = cONEquivalenceDl.FindAll(new CONEquivalence {
                     CompanyId = data.Id
                 }, Options.All);
                 data.IntegratorConfigurations = cONIntegratorConfigurationDl.FindAll(new CONIntegratorConfiguration {
                     CompanyId = data.Id
                 }, Options.All);
                 data.SQLs = cONSQLDl.FindAll(new CONSQL {
                     CompanyId = data.Id
                 }, Options.All);
                 data.Connections = sECConnectionDl.FindAll(new SECConnection {
                     CompanyId = data.Id
                 }, Options.All);
                 data.UserCompanies = sECUserCompanyDl.FindAll(new SECUserCompany {
                     CompanyId = data.Id
                 }, Options.All);
             }
             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.º 5
0
 public override void FindByIdRules(SECCompany data)
 {
     base.FindByIdRules(data);
 }
Exemplo n.º 6
0
 public override void RemoveRules(SECCompany data)
 {
     base.RemoveRules(data);
 }
Exemplo n.º 7
0
 public override void ModifyRules(SECCompany data)
 {
     base.ModifyRules(data);
     data.LastUpdate = DateTime.Now;
 }
Exemplo n.º 8
0
 public override void CommonRules(SECCompany data)
 {
     base.CommonRules(data);
 }
Exemplo n.º 9
0
 public void AddDetails(SECCompany data)
 {
     if (data.Equivalences != null && data.Equivalences.Count > 0)
     {
         for (int i = 0; i < data.Equivalences.Count; i++)
         {
             data.Equivalences[i].CompanyId  = data.Id;
             data.Equivalences[i].LastUpdate = DateTime.Now;
             data.Equivalences[i].UpdatedBy  = data.UpdatedBy;
             if (data.Equivalences[i].Id == 0)
             {
                 data.Equivalences[i] = cONEquivalenceDl.Add(data.Equivalences[i]);
             }
             else
             {
                 data.Equivalences[i] = cONEquivalenceDl.Modify(data.Equivalences[i]);
             }
         }
     }
     if (data.IntegratorConfigurations != null && data.IntegratorConfigurations.Count > 0)
     {
         for (int i = 0; i < data.IntegratorConfigurations.Count; i++)
         {
             data.IntegratorConfigurations[i].CompanyId  = data.Id;
             data.IntegratorConfigurations[i].LastUpdate = DateTime.Now;
             data.IntegratorConfigurations[i].UpdatedBy  = data.UpdatedBy;
             if (data.IntegratorConfigurations[i].Integrator != null)
             {
                 data.IntegratorConfigurations[i].IntegratorId = data.IntegratorConfigurations[i].Integrator.Id;
             }
             if (data.IntegratorConfigurations[i].Id == 0)
             {
                 data.IntegratorConfigurations[i] = cONIntegratorConfigurationDl.Add(data.IntegratorConfigurations[i]);
             }
             else
             {
                 data.IntegratorConfigurations[i] = cONIntegratorConfigurationDl.Modify(data.IntegratorConfigurations[i]);
             }
         }
     }
     if (data.SQLs != null && data.SQLs.Count > 0)
     {
         for (int i = 0; i < data.SQLs.Count; i++)
         {
             data.SQLs[i].CompanyId  = data.Id;
             data.SQLs[i].LastUpdate = DateTime.Now;
             data.SQLs[i].UpdatedBy  = data.UpdatedBy;
             if (data.SQLs[i].MainSQL != null)
             {
                 data.SQLs[i].MainSQLId = data.SQLs[i].MainSQL.Id;
             }
             if (data.SQLs[i].Structure != null)
             {
                 data.SQLs[i].StructureId = data.SQLs[i].Structure.Id;
             }
             if (data.SQLs[i].Id == 0)
             {
                 data.SQLs[i] = cONSQLDl.Add(data.SQLs[i]);
             }
             else
             {
                 data.SQLs[i] = cONSQLDl.Modify(data.SQLs[i]);
             }
         }
     }
     //if (data.Configurations != null && data.Configurations.Count > 0)
     //{
     //   for (int i = 0; i < data.Configurations.Count; i++)
     //   {
     //      data.Configurations[i].CompanyId = data.Id;
     //      data.Configurations[i].LastUpdate = DateTime.Now;
     //      data.Configurations[i].UpdatedBy = data.UpdatedBy;
     //      if (data.Configurations[i].Id == 0)
     //         data.Configurations[i] = sECConfigurationDl.Add(data.Configurations[i]);
     //      else
     //         data.Configurations[i] = sECConfigurationDl.Modify(data.Configurations[i]);
     //   }
     //}
     if (data.Connections != null && data.Connections.Count > 0)
     {
         for (int i = 0; i < data.Connections.Count; i++)
         {
             data.Connections[i].CompanyId  = data.Id;
             data.Connections[i].LastUpdate = DateTime.Now;
             data.Connections[i].UpdatedBy  = data.UpdatedBy;
             if (data.Connections[i].DbType != null)
             {
                 data.Connections[i].DbType = data.Connections[i].DbType;
             }
             if (data.Connections[i].Id == 0)
             {
                 data.Connections[i] = sECConnectionDl.Add(data.Connections[i]);
             }
             else
             {
                 data.Connections[i] = sECConnectionDl.Modify(data.Connections[i]);
             }
         }
     }
     if (data.UserCompanies != null && data.UserCompanies.Count > 0)
     {
         for (int i = 0; i < data.UserCompanies.Count; i++)
         {
             data.UserCompanies[i].CompanyId  = data.Id;
             data.UserCompanies[i].LastUpdate = DateTime.Now;
             data.UserCompanies[i].UpdatedBy  = data.UpdatedBy;
             if (data.UserCompanies[i].User != null)
             {
                 data.UserCompanies[i].UserId = data.UserCompanies[i].User.Id;
             }
             if (data.UserCompanies[i].Id == 0)
             {
                 data.UserCompanies[i] = sECUserCompanyDl.Add(data.UserCompanies[i]);
             }
             else
             {
                 data.UserCompanies[i] = sECUserCompanyDl.Modify(data.UserCompanies[i]);
             }
         }
     }
 }
Exemplo n.º 10
0
        public void InstallLocalData()
        {
            Configuration conf        = GetConfiguration();
            ENDefaultData defaultData = new ENDefaultData();

            try
            {
                DomainLogic dl = new DomainLogic(conf.DataBaseSettings[0]);
                if (defaultData.Roles() != null && defaultData.Roles().Count > 0)
                {
                    foreach (SECRole rol in defaultData.Roles())
                    {
                        SECRole data = dl.GetSECRoleBLL().Add(rol);
                        if (rol.Users != null && rol.Users.Count > 0)
                        {
                            foreach (SECUser user in rol.Users)
                            {
                                user.Role   = data;
                                user.RoleId = data.Id;
                                dl.GetSECUserBLL().Add(user);
                            }
                        }
                    }
                }
                //if (defaultData.Languages() != null && defaultData.Languages().Count > 0)
                //{
                //    foreach (SECLanguage language in defaultData.Languages())
                //    {
                //        SECLanguage data = dl.GetSECLanguageDL().Add(language);
                //    }
                //}
                //if (defaultData.Types() != null && defaultData.Types().Count > 0)
                //{
                //    foreach (SECType type in defaultData.Types())
                //    {
                //        SECType data = dl.GetSECTypeDL().Add(type);
                //        if (type.TypeValues != null && type.TypeValues.Count > 0)
                //            foreach (SECTypeValue typeValue in type.TypeValues)
                //            {
                //                typeValue.TypeId = type.Id;
                //                SECTypeValue data1 = dl.GetSECTypeValueDL().Add(typeValue);
                //                if (typeValue.TypeValueDetails != null && typeValue.TypeValueDetails.Count > 0)
                //                    foreach (SECTypeValueDetail typeValueDetail in typeValue.TypeValueDetails)
                //                    {
                //                        typeValueDetail.TypeValueId = typeValue.Id;
                //                        SECTypeValueDetail data2 = dl.GetSECTypeValueDetailDL().Add(typeValueDetail);
                //                    }
                //            }
                //    }
                //}
                if (defaultData.Companies() != null && defaultData.Companies().Count > 0)
                {
                    foreach (SECCompany company in defaultData.Companies())
                    {
                        SECCompany data = dl.GetSECCompanyBLL().Add(company);
                    }
                }
                List <SECCompany> companies = dl.GetSECCompanyBLL().FindAll(new SECCompany {
                    Active = true
                }, Options.All);

                List <SECUser> users = dl.GetSECUserBLL().FindAll(new SECUser {
                    Active = true
                }, Options.All);
                SECUserCompany useCompany = new SECUserCompany {
                    Active = true, CompanyId = companies[0].Id, UserId = users[0].Id, LastUpdate = DateTime.Now, UpdatedBy = "admin"
                };
                dl.GetSECUserCompanyBLL().Add(useCompany);
            }
            catch (Exception e)
            {
                throw new BusinessException(e).GetFaultException();
            }
        }
Exemplo n.º 11
0
 public override List <SECCompany> FindAll(SECCompany data, Options option)
 {
     return(base.FindAll(data, option));
 }
Exemplo n.º 12
0
 public override SECCompany FindById(SECCompany data)
 {
     return(base.FindById(data));
 }
Exemplo n.º 13
0
 public override void AddMoreDetailFindById(SECCompany data)
 {
 }
Exemplo n.º 14
0
 public override void SaveOrUpdateDetails(SECCompany data)
 {
     base.SaveOrUpdateDetails(data);
 }