Exemple #1
0
        public override String GetQuery(SECUserCompany 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.User != null && data.User.Id != 0)
                {
                    dml += "             AND a.User.Id = :User \n";
                }

                dml += " order by a.Id asc ";
            }
            return(dml);
        }
Exemple #2
0
 public override SECUserCompany Execute(SECUserCompany 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.Find && option == Options.Me)
             {
             }
             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();
     }
 }
Exemple #3
0
        public override void SetQueryParameters(IQuery query, SECUserCompany 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.User != null && data.User.Id != 0)
                {
                    query.SetInt32("User", data.User.Id);
                }
            }
        }
Exemple #4
0
 public override void RemoveRules(SECUserCompany data)
 {
     base.RemoveRules(data);
 }
Exemple #5
0
 public override void ModifyRules(SECUserCompany data)
 {
     base.ModifyRules(data);
     data.LastUpdate = DateTime.Now;
 }
Exemple #6
0
 public override void CommonRules(SECUserCompany data)
 {
     base.CommonRules(data);
 }
Exemple #7
0
 public void AddDetails(SECUserCompany data)
 {
 }
Exemple #8
0
 public override void FindByIdRules(SECUserCompany data)
 {
     base.FindByIdRules(data);
 }
        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();
            }
        }
Exemple #10
0
 public override List <SECUserCompany> FindAll(SECUserCompany data, Options option)
 {
     return(base.FindAll(data, option));
 }
Exemple #11
0
 public override SECUserCompany FindById(SECUserCompany data)
 {
     return(base.FindById(data));
 }
Exemple #12
0
 public override void AddMoreDetailFindById(SECUserCompany data)
 {
 }
Exemple #13
0
 public override void SaveOrUpdateDetails(SECUserCompany data)
 {
     base.SaveOrUpdateDetails(data);
 }