Esempio n. 1
0
                public static long AddTag(VM_Tag Tag)
                {
                    using (var exodusDB = new exodusEntities())
                    {
                        var tagID = new ObjectParameter("TagID", 0);
                        exodusDB.stp_Tag_Add(tagOwnerID: Tag.Owner_UserID,
                                             tagTypeID: (long)Tag.Type,
                                             tagAccessTypeID: (int)Tag.AccessType,
                                             tagNameEng: Tag.NameEng,
                                             tagNameRus: Tag.NameRus,
                                             tagDescription: Tag.Description,
                                             tagID: tagID,
                                             tagApplicationID: Tag.ApplicationID,
                                             tagDayOfMonth: Tag.DayOfMonth,
                                             tagDayOfWeek: Tag.DayOfWeek,
                                             tagEndDate: Tag.EndDate,
                                             tagMinIntentionAmount: Tag.MinIntentionAmount,
                                             tagPeriod: (int)Tag.Period,
                                             tagTotalAmount: Tag.TotalAmount,
                                             tagMinIntentionCurrencyID: Tag.MinIntentionCurrencyID,
                                             tagTotalAmountCurrencyID: Tag.TotalAmountCurrencyID,
                                             defaultIntentionOwnerID: Tag.DefaultIntentionOwner.UserID);

                        long TagID = Convert.ToInt64(tagID.Value);
                        //
                        Global.Cache.AddTagId(TagID);
                        //
                        return(TagID);
                    }
                }
Esempio n. 2
0
        public PartialViewResult AppDetail(long TagID)
        {
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            if (tag == null)
            {
                throw new TagNotFoundException();
            }
            return(PartialView(tag));
        }
Esempio n. 3
0
        public PartialViewResult TagInfo(long TagID, bool?AllowCopyLink = true)
        {
            if (!Global.Cache.CheckTagExists(TagID))
            {
                throw new TagNotFoundException();
            }
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            return(PartialView($"~/Views/Partial/Tag/TagInfo.cshtml", new Tuple <VM_Tag, bool?>(tag, AllowCopyLink)));
        }
Esempio n. 4
0
        public PartialViewResult PaymentDetails(long TagID)
        {
            if (!Global.Cache.CheckTagExists(TagID))
            {
                throw new TagNotFoundException();
            }
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            return(PartialView($"~/Views/Partial/Tag/PaymentDetails.cshtml", tag));
        }
Esempio n. 5
0
 public static VM_Tag ByID(long TagID)
 {
     using (var exodusDB = new exodusEntities())
     {
         var result = exodusDB.stp_Tag_ByID(TagID).FirstOrDefault();
         //
         if (result != null)
         {
             var tag = new VM_Tag()
             {
                 TagID                    = result.TagID,
                 NameSystem               = result.TagNameSystem,
                 NameEng                  = result.TagNameEng,
                 NameRus                  = result.TagNameRus,
                 Description              = result.TagDescription,
                 Owner_UserID             = result.TagOwner_UserID,
                 Created                  = result.TagCreated,
                 OwnerFirstName           = result.TagOwnerFirstName,
                 OwnerLastName            = result.TagOwnerLastName,
                 Type                     = (EN_TagType)result.TagTypeID,
                 TypeNameEng              = result.TagTypeNameEng,
                 TypeNameRus              = result.TagTypeNameRus,
                 TypeCommentEng           = result.TagTypeCommentEng,
                 TypeCommentRus           = result.TagTypeCommentRus,
                 IsTypePredefined         = result.IsTagTypePredefined,
                 AccessType               = (EN_TagAccessType)result.TagAccessTypeID,
                 AccessTypeNameEng        = result.TagAccessTypeNameEng,
                 AccessTypeNameRus        = result.TagAccessTypeNameRus,
                 UsersCount               = result.TagUsersCount.Value,
                 Period                   = (EN_TagPeriod)result.PeriodID,
                 PeriodNameEng            = result.PeriodNameEng,
                 PeriodNameRus            = result.PeriodNameRus,
                 ApplicationID            = result.ApplicationID,
                 ApplicationNameEng       = result.ApplicationNameEng,
                 ApplicationNameRus       = result.ApplicationNameRus,
                 EndDate                  = result.EndDate.HasValue ? result.EndDate.Value : new DateTime(),
                 DayOfMonth               = result.DayOfMonth.HasValue ? result.DayOfMonth.Value : -1,
                 DayOfWeek                = result.DayOfWeek.HasValue ? result.DayOfWeek.Value : -1,
                 TotalAmount              = result.TotalAmount,
                 TotalAmountCurrencyCode  = result.TotalAmountCurrencyCode,
                 TotalAmountCurrencyID    = result.TotalAmountCurrencyID,
                 MinIntentionAmount       = result.MinIntentionAmount,
                 MinIntentionCurrencyID   = result.MinIntentionCurrencyID,
                 MinIntentionCurrencyCode = result.MinIntentionCurrencyCode,
                 DefaultIntentionOwner    = _DL.User.Get.ByID(result.DefaultIntentionOwnerID) // Get Default Owner
             };
             //
             return(tag);
         }
         else
         {
             return(null);
         }
     }
 }
Esempio n. 6
0
        public PartialViewResult TagDetail(long TagID)
        {
            if (!Global.Cache.CheckTagExists(TagID))
            {
                throw new TagNotFoundException();
            }
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            tag.DefaultIntentionOwner = _DL.User.Get.ByID(tag.DefaultIntentionOwner.UserID);
            return(PartialView(tag));
        }
Esempio n. 7
0
 public static bool CheckTagExistsAndGet(long ID, out VM_Tag tag)
 {
     tag = null;
     if (!hsTagIdList.Contains(ID))
     {
         return(false);
     }
     // get tag
     tag = _DL.Tag.Get.ByID(ID);
     //
     return(true);
 }
Esempio n. 8
0
        public JsonResult Add(VM_Tag tag)
        {
            // check names
            if (String.IsNullOrEmpty(tag.Name))
            {
                return(GetJson(EN_ErrorCodes.TagNameIsEmpty));
            }
            // access type
            if (tag.AccessType == EN_TagAccessType.None)
            {
                return(GetJson(EN_ErrorCodes.TagAccessTypeIsNone));
            }
            // tag type
            if (tag.Type == EN_TagType.None)
            {
                return(GetJson(EN_ErrorCodes.TagTypeIsNone));
            }
            if (tag.EndDate < DateTime.Now)
            {
                return(GetJson(EN_ErrorCodes.EndDateNotValid));
            }
            // Create
            tag.Owner_UserID = CurrentUser.UserID;
            if (tag.DefaultIntentionOwner == null)
            {
                tag.DefaultIntentionOwner = CurrentUser;
            }
            if (tag.ApplicationType == EN_ApplicationType.H20)
            {
                tag.TotalAmount = 0;
            }
            if (tag.ApplicationType == EN_ApplicationType.Own_Initiative && tag.TotalAmount < tag.MinIntentionAmount)
            {
                return(GetJson("Total Amount Less Then MinIntention", EN_ErrorCodes.TagException));
            }
            //
            var returnVal = _DL.Tag.Add.AddTag(tag);

            // return
            return(GetJson(new { TagID = returnVal }));
        }
        public PartialViewResult AppInfo(long TagID)
        {
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            return(PartialView(tag));
        }
        public PartialViewResult Dashboard(long TagID, EN_TagRole TagRole)
        {
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            return(PartialView("~/Views/OwnInitiative/Dashboard.cshtml", new Tuple <VM_Tag, EN_TagRole>(tag, TagRole)));
        }
        public PartialViewResult Settings(long TagID)
        {
            VM_Tag tag = _DL.Tag.Get.ByID(TagID);

            return(PartialView("~/Views/OwnInitiative/Settings.cshtml", tag));
        }