Exemple #1
0
        //private function
        private bool IsTooOften(string messageID, string appUser)
        {
            EW_USER_APPLY_BLL aBLL  = new EW_USER_APPLY_BLL();
            EW_USER_APPLY     apply = aBLL.GetSpecifyUserApply(messageID, appUser);

            if (apply != null)
            {
                DateTime?lastDate = apply.SAMPLE_DATE;
                if (lastDate != null && lastDate.Value.AddMinutes(10) > DateTime.Now)
                {
                    return(true);
                }
            }
            else
            {
                EW_USER_APPLY model = new EW_USER_APPLY();
                model.MESSAGE_ID  = messageID;
                model.APP_USER    = appUser;
                model.APPLY       = CHubConstValues.IndN;
                apply.SAMPLE_DATE = DateTime.Now;
                aBLL.Add(model);
                return(false);
            }

            apply.SAMPLE_DATE = DateTime.Now;
            aBLL.update(apply);

            return(false);
        }
Exemple #2
0
        public void SaveApply(List <string> idList, string group, string appUser)
        {
            List <EW_USER_APPLY> applies = dal.GetUserApplyByGroup(group, appUser);

            foreach (var item in applies)
            {
                if (idList.Contains(item.MESSAGE_ID))
                {
                    item.APPLY      = CHubConstValues.IndY;
                    item.APPLY_DATE = DateTime.Now;
                    dal.Update(item, false);
                    idList.Remove(item.MESSAGE_ID);
                }
                else
                {
                    item.APPLY      = CHubConstValues.IndN;
                    item.APPLY_DATE = DateTime.Now;
                    dal.Update(item, false);
                }
            }
            if (idList.Count != 0)
            {
                foreach (var id in idList)
                {
                    EW_USER_APPLY apply = new EW_USER_APPLY();
                    apply.MESSAGE_ID  = id;
                    apply.APP_USER    = appUser;
                    apply.APPLY       = CHubConstValues.IndY;
                    apply.APPLY_DATE  = DateTime.Now;
                    apply.SAMPLE_DATE = DateTime.Now;
                    dal.Add(apply, false);
                }
            }

            dal.SaveChanges();
        }
Exemple #3
0
 public void Add(EW_USER_APPLY model)
 {
     dal.Add(model);
 }
Exemple #4
0
 public void update(EW_USER_APPLY model)
 {
     dal.Update(model);
 }