Esempio n. 1
0
        public int DeleteUser(Guid id, IBll objectBll)
        {
            if (Guid.Empty == id || objectBll == null)
            {
                return(1);
            }

            foreach (var bonusId in _usersDao.GetUser(id).BonusList)
            {
                objectBll.DeleteDependUserAndBonuses(id, bonusId);
            }
            if (_usersDao.DeleteUser(id))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 2
0
        public int ChangeAward(Award award, IBll objectBll)
        {
            var oldAward = objectBll.Awards.GetAward(award.Id);

            foreach (var item in oldAward.OwnerList)
            {
                objectBll.RemoveDependUserAndAwards(item, award.Id);
            }

            ChangeAward(award);

            foreach (var item in award.OwnerList)
            {
                var user = objectBll.Users.GetUser(item);
                user.AwardList.Add(award.Id);
                objectBll.Users.ChangeUser(user);
                objectBll.AddDependUserAndAwards(item, award.Id);
            }

            return(1);
        }
Esempio n. 3
0
        public int RemoveAward(Guid id, IBll objectBll)
        {
            if (Guid.Empty == id || objectBll == null)
            {
                return(-1);
            }

            foreach (var userId in _awardsDao.GetAward(id).OwnerList)
            {
                objectBll.RemoveDependUserAndAwards(userId, id);
            }

            if (_awardsDao.RemoveAward(id))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 4
0
        public int ChangeUser(User user, IBll objectBll)
        {
            var oldUser = objectBll.Users.GetUser(user.Id);

            foreach (var item in oldUser.BonusList)
            {
                objectBll.DeleteDependUserAndBonuses(user.Id, item);
            }

            ChangeUser(user);

            foreach (var item in user.BonusList)
            {
                var bonus = objectBll.Bonus.GetBonus(item);
                bonus.OwnerList.Add(user.Id);
                objectBll.Bonus.ChangeBonus(bonus);
                objectBll.AddDependUserAndBonuses(user.Id, item);
            }

            return(1);
        }
Esempio n. 5
0
        public int RemoveUser(Guid id, IBll objectBll)
        {
            if (Guid.Empty == id || objectBll == null)
            {
                return(-1);
            }

            foreach (var awardId in _usersDao.GetUser(id).AwardList)
            {
                objectBll.RemoveDependUserAndAwards(id, awardId);
            }

            if (_usersDao.RemoveUser(id))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 6
0
        public int DeleteBonus(Guid id, IBll objectBll)
        {
            if (Guid.Empty == id || objectBll == null)
            {
                return(-1);
            }

            foreach (var userId in _bonusDao.GetBonus(id).OwnerList)
            {
                objectBll.DeleteDependUserAndBonuses(userId, id);
            }

            if (_bonusDao.DeleteBonus(id))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 7
0
        public T GetBean <T>() where T : IBll
        {
            IBll e = null;

            if (typeof(T).Equals(typeof(IExt)))
            {
                e = new ExtBiz();
            }
            else if (typeof(T).Equals(typeof(IPermission)))
            {
            }
            else if (typeof(T).Equals(typeof(ISystemMenu)))
            {
                e = new MenuBiz();
            }
            else if (typeof(T).Equals(typeof(IRecord)))
            {
                e = new RecordBiz();
            }
            else if (typeof(T).Equals(typeof(ISystemMenu)))
            {
            }
            else if (typeof(T).Equals(typeof(IUser)))
            {
                e = new UserBiz();
            }
            else if (typeof(T).Equals(typeof(IReport)))
            {
                e = new ReportBiz();
            }
            if (e != null)
            {
                e.SetConfig(c);
            }
            return((T)e);
        }
 public HomeController(IBll bll)
 {
     _myBll = bll;
 }
Esempio n. 9
0
 public StudentsController(IBll bll)
 {
     this.bll = bll;
 }
Esempio n. 10
0
 public PersonPresentation(IBll bll)
 {
     _bll = bll;
 }
 public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IBll bll)
 {
     UserManager   = userManager;
     SignInManager = signInManager;
     _mybll        = bll;
 }
 public ManageController(IBll bll)
 {
     _mybll = bll;
 }
Esempio n. 13
0
        public MainModule(ILora lora, IBll bll)
        {
            Get["/", true] = async(_, ct) =>
            {
                return("Hello World!");
            };
            Get["/hasappeui/{appeui}", true] = async(parameters, ct) =>
            {
                return(Response.AsJson(true));
                //return HttpStatusCode.NoResponse;
            };
            Post["/message", true] = async(parameters, ct) =>
            {
                ReturnMessage returnmessage = null;
                try {
                    var message = JsonConvert.DeserializeObject <Message>(Request.Body.AsString());
                    var data    = Convert.FromBase64String(message.Rxpk.Data);
                    switch (lora.GetMType(data[0]))
                    {
                    case MType.JoinRequest:
                        log.Info("JoinRequest");
                        var joinaccept = await bll.ProcessJoinRequest(data);

                        returnmessage = new ReturnMessage()
                        {
                            TxResult = true,
                            Txpk     = new Txpk()
                            {
                                Tmst         = message.Rxpk.Tmst + 5000000,
                                Freq         = message.Rxpk.Freq,
                                RfCh         = message.Rxpk.RfCh,
                                Power        = 14,
                                Modulation   = message.Rxpk.Modulation,
                                DataRate     = message.Rxpk.DataRate,
                                CodingRate   = message.Rxpk.CodingRate,
                                Polarization = true,
                                Size         = Convert.ToUInt16(joinaccept.Length - 4),
                                Data         = Convert.ToBase64String(joinaccept)
                            }
                        };
                        return(Response.AsText(JsonConvert.SerializeObject(returnmessage), "application/json"));

                    case MType.ConfirmedDataUp:
                        log.Info("ConfirmedDataUp");
                        return(Response.AsText(JsonConvert.SerializeObject(new ReturnMessage()
                        {
                            TxResult = false
                        }), "application/json"));

                    case MType.UnconfirmedDataUp:
                        log.Info("UnconfirmedDataUp");
                        var unconfirmeddataup = await bll.ProcessUnconfirmedDataUp(data);

                        return(Response.AsText(JsonConvert.SerializeObject(new ReturnMessage()
                        {
                            TxResult = false
                        }), "application/json"));
                    }
                    log.Info("Unknown MType: " + lora.GetMType(data[0]));
                    return(Response.AsText(JsonConvert.SerializeObject(new ReturnMessage()
                    {
                        TxResult = false
                    }), "application/json"));
                }
                catch (Exception e)
                {
                    log.Error(e.Message, e);
                    return(Response.AsText(JsonConvert.SerializeObject(new ReturnMessage()
                    {
                        TxResult = false
                    }), "application/json"));
                }
            };
        }
Esempio n. 14
0
 public ApplicationController(IBll cont)
 {
     _myBll = cont;
 }
 public ApartmentsController(IBll cont)
 {
     _myBll = cont;
 }