예제 #1
0
        public virtual ActionResult EditDetail(MemberDetailModel model)
        {
            var detail = new MemberDetails {
                Id = (long)model.Id, PersonName = model.PersonName, PostName = model.PostName, RowNumber = model.RowNumber
            };
            var result = _memberManagementService.AddOrUpdateDetail(detail, StateOperation.ویرایش);

            return(Json(new { IsError = !result.Item1, Message = result.Item2 }));
        }
        // Gets details from a specific member
        public IActionResult Detail(int id)
        {
            var model  = new MemberDetailModel();
            var member = _memberService.GetFromID(id);

            model.ID       = id;
            model.Loans    = _loanService.GetLoansFromMemberID(id);
            model.Name     = member.Name;
            model.PersonNr = member.PersonNr;

            return(View(model));
        }
예제 #3
0
        public virtual ActionResult CreateDetail(MemberDetailModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { IsError = true, Message = "ورودی نامعتبر" }));
            }

            var detail = new MemberDetails {
                PersonName = model.PersonName, MemberMasterId = model.MemberMasterId, RowNumber = model.RowNumber, PostName = model.PostName
            };
            var result = _memberManagementService.AddOrUpdateDetail(detail, StateOperation.درج);

            return(Json(new { IsError = !result.Item1, Message = result.Item2, detail.Id }));
        }
예제 #4
0
        public IActionResult Detail(int id)
        {
            var member = _member.Get(id);
            var model  = new MemberDetailModel
            {
                LastName         = member.LastName,
                FirstName        = member.FirstName,
                Address          = member.Address,
                HomeLibrary      = member.HonmeLibraryBranch.Name,
                MemberSince      = member.LibraryCard.Created,
                OverdueFees      = member.LibraryCard.Fees,
                LibraryCardId    = member.LibraryCard.Id,
                Telephone        = member.PhoneNumber,
                AssetsCheckedOut = _member.GetCheckOuts(id).ToList() ?? new List <CheckOut>(),
                CheckoutHistory  = _member.GetCheckoutHistory(id),
                Holds            = _member.GetHolds(id)
            };

            return(View(model));
        }
예제 #5
0
        public ActionResult MemberDetail(int id, string sortOrder, int mdPage = 1)
        {
            ViewBag.Members = "active";

            var user = db.Users.Where(x => x.Email == User.Identity.Name).FirstOrDefault();


            var Users        = db.Users.Where(x => x.IsActive == true && x.ID == id).FirstOrDefault();
            var UsersProfile = db.UserProfiles.Where(x => x.UserID == Users.ID).FirstOrDefault();
            int c            = Convert.ToInt32(UsersProfile.Country);
            var Country      = db.Countries.Where(x => x.ID == c && x.IsActive == true).FirstOrDefault();

            var Notes = db.SellerNotes.Where(x => x.IsActive == true && x.SellerID == Users.ID && (x.Status != 1)).ToList();

            List <MemberNotes> list = new List <MemberNotes>();

            foreach (var item in Notes)
            {
                int dn = db.Downloads.Where(x => x.NoteID == item.ID && x.IsSellerHasAllowedDownload == true && x.Seller == Users.ID).Count();
                int te;
                var teList = db.Downloads.Where(x => x.NoteID == item.ID && x.IsSellerHasAllowedDownload == true && x.Seller == Users.ID).ToList();
                if (teList == null)
                {
                    te = 0;
                }
                else
                {
                    te = (int)teList.Sum(x => x.PurchasedPrice);
                }

                MemberNotes members = new MemberNotes()
                {
                    SellerNote      = item,
                    DownloadedNotes = dn,
                    TotalEarning    = te
                };
                list.Add(members);
            }

            ViewBag.TitleSortParm    = sortOrder == "Title" ? "Title_desc" : "Title";
            ViewBag.CategorySortParm = sortOrder == "Category" ? "Category_desc" : "Category";
            ViewBag.StatusSortParm   = sortOrder == "Status" ? "Status_desc" : "Status";
            ViewBag.DnSortParm       = sortOrder == "Dn" ? "Dn_desc" : "Dn";
            ViewBag.TeSortParm       = sortOrder == "Te" ? "Te_desc" : "Te";
            ViewBag.ADateSortParm    = sortOrder == "ADate" ? "ADate_desc" : "ADate";
            ViewBag.PDateSortParm    = sortOrder == "PDate" ? "PDate_desc" : "pDate";


            switch (sortOrder)
            {
            case "Title_desc":
                list = list.OrderByDescending(s => s.SellerNote.Title).ToList();
                break;

            case "Title":
                list = list.OrderBy(s => s.SellerNote.Title).ToList();
                break;

            case "Category_desc":
                list = list.OrderByDescending(s => s.SellerNote.NoteCategory.Name).ToList();
                break;

            case "Category":
                list = list.OrderBy(s => s.SellerNote.NoteCategory.Name).ToList();
                break;

            case "Status_desc":
                list = list.OrderByDescending(s => s.SellerNote.ReferenceData.Value).ToList();
                break;

            case "Status":
                list = list.OrderBy(s => s.SellerNote.ReferenceData.Value).ToList();
                break;

            case "Dn_desc":
                list = list.OrderByDescending(s => s.DownloadedNotes).ToList();
                break;

            case "Dn":
                list = list.OrderBy(s => s.DownloadedNotes).ToList();
                break;

            case "Te_desc":
                list = list.OrderByDescending(s => s.TotalEarning).ToList();
                break;

            case "Te":
                list = list.OrderBy(s => s.TotalEarning).ToList();
                break;

            case "ADate_desc":
                list = list.OrderByDescending(s => s.SellerNote.CreatedDate).ToList();
                break;

            case "ADate":
                list = list.OrderBy(s => s.SellerNote.CreatedDate).ToList();
                break;

            case "PDate_desc":
                list = list.OrderByDescending(s => s.SellerNote.PublishedDate).ToList();
                break;

            case "PDate":
                list = list.OrderBy(s => s.SellerNote.PublishedDate).ToList();
                break;

            default:
                list = list.OrderBy(s => s.SellerNote.CreatedDate).ToList();
                break;
            }

            var pager = new ADPager(list.Count(), mdPage);

            ViewBag.currentPage = pager.CurrentPage;
            ViewBag.endPage     = pager.EndPage;
            ViewBag.startpage   = pager.StartPage;
            ViewBag.pageNumber  = mdPage;

            ViewBag.srno = mdPage;
            ViewBag.TotalMemberDetailPage = Math.Ceiling(list.Count() / 5.0);
            list = list.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize).ToList();


            MemberDetailModel member = new MemberDetailModel();

            member.User        = Users;
            member.UserProfile = UsersProfile;
            member.Notes       = list;
            member.CountryName = Country == null ? "" :Country.Name;


            return(View(member));
        }
예제 #6
0
        public object getMemberDetail(Dictionary <string, object> dicParas)
        {
            try
            {
                string mobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string memberId    = dicParas.ContainsKey("memberId") ? dicParas["memberId"].ToString() : string.Empty;

                if (mobileToken == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌不能为空"));
                }
                Base_MerchInfo merch = MerchBusiness.GetMerchModel(mobileToken);
                if (merch.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户令牌无效"));
                }

                if (string.IsNullOrWhiteSpace(memberId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "参数错误"));
                }

                MemberDetailModel model = new MemberDetailModel();

                DataTable table = AccountBusiness.GetMemberDetail(memberId);

                if (table.Rows.Count == 0)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "无数据"));
                }

                DataRow row = table.Rows[0];
                model.ICCardID     = row["ICCardID"].ToString();
                model.MemberName   = row["MemberName"].ToString();
                model.Mobile       = row["Mobile"].ToString();
                model.Birthday     = row["Birthday"].ToString();
                model.CertificalID = row["CertificalID"].ToString();
                model.Balance      = string.IsNullOrWhiteSpace(row["Balance"].ToString()) ? "0" : row["Balance"].ToString();
                model.Lottery      = string.IsNullOrWhiteSpace(row["Lottery"].ToString()) ? "0" : row["Lottery"].ToString();
                model.Point        = string.IsNullOrWhiteSpace(row["Point"].ToString()) ? "0" : row["Point"].ToString();
                switch (row["Type"].ToString())
                {
                case "0": model.Type = "会员卡"; break;

                case "1": model.Type = "数字币"; break;

                case "2": model.Type = "临时卡"; break;

                case "3": model.Type = "返分卡"; break;

                default: model.Type = "会员卡"; break;
                }
                model.JoinTime       = row["JoinTime"].IsNull() ? "" : Convert.ToDateTime(row["JoinTime"]).ToString("yyyy-MM-dd HH:mm:ss");
                model.EndDate        = string.IsNullOrWhiteSpace(row["EndDate"].ToString()) ? "" : Convert.ToDateTime(row["EndDate"]).ToString("yyyy-MM-dd");
                model.MemberPassword = row["MemberPassword"].ToString();
                model.Note           = row["Note"].ToString();
                model.Lock           = string.IsNullOrWhiteSpace(row["EndDate"].ToString()) || row["EndDate"].ToString() == "0" ? "未锁定" : "已锁定";
                model.LockDate       = "";
                if (model.Lock == "已锁定")
                {
                    model.LockDate = string.IsNullOrWhiteSpace(row["LockDate"].ToString()) ? "" : Convert.ToDateTime(row["EndDate"]).ToString("yyyy-MM-dd");
                }

                return(ResponseModelFactory <MemberDetailModel> .CreateModel(isSignKeyReturn, model));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
예제 #7
0
        public ActionResult MemberDetail(int member, string sort, int?page)
        {
            // viewbag for searching, sorting and pagination
            ViewBag.Sort       = sort;
            ViewBag.PageNumber = page;
            ViewBag.Member     = member;

            // get id of note status draft
            var draftid = context.ReferenceData.Where(x => x.Value.ToLower() == "draft").Select(x => x.ID).FirstOrDefault();

            // get member
            Users users = context.Users.Where(x => x.ID == member).FirstOrDefault();
            // get member's profile
            UserProfile userprofiles = context.UserProfile.Where(x => x.User_ID == users.ID).FirstOrDefault();
            // get member's notes excluding note status draft
            var notes = context.SellerNotes.Where(x => x.SellerID == users.ID && x.Status != draftid).ToList();

            // create list of MemberDetailViewModel.MembersNote
            var notelist = new List <MemberDetailModel.MembersNote>();

            foreach (var note in notes)
            {
                // get data of downloaded notes for count how many people downloaded notes and get total earning
                var downloadednoteslist = context.Downloads.Where(x => x.NoteID == note.ID && x.IsSellerHasAllowedDownload == true && x.AttachmentPath != null);

                // create membernote object of MemberDetailViewModel.MembersNote
                var membernote = new MemberDetailModel.MembersNote();
                membernote.ID              = note.ID;
                membernote.Title           = note.Title;
                membernote.Category        = note.NoteCategories.Name;
                membernote.Status          = note.ReferenceData.Value;
                membernote.DownloadedNotes = downloadednoteslist.Count();
                membernote.TotalEarning    = downloadednoteslist.Select(x => x.PurchasedPrice).Sum();
                membernote.DateAdded       = note.CreatedDate;
                membernote.PublishedDate   = note.PublishedDate;

                // add membernote object to notelist
                notelist.Add(membernote);
            }

            // create object of MemberDetailViewModel
            MemberDetailModel members = new MemberDetailModel();

            members.FirstName = users.FirstName;
            members.LastName  = users.LastName;
            members.Email     = users.EmailID;
            if (userprofiles != null)
            {
                members.DOB = userprofiles.DOB;
                members.PhoneNumberCountryCode = userprofiles.Phone_number_Country_Code;
                members.PhoneNumber            = userprofiles.Phone_number;
                members.College        = userprofiles.University;
                members.Address1       = userprofiles.Address_Line_1;
                members.Address2       = userprofiles.Address_Line_2;
                members.City           = userprofiles.City;
                members.State          = userprofiles.State;
                members.ZipCode        = userprofiles.Zip_Code;
                members.Country        = userprofiles.Country;
                members.ProfilePicture = userprofiles.Profile_Picture;
            }

            // create IENumerable List of MemberDetailModel
            IEnumerable <MemberDetailModel.MembersNote> Note_List = notelist.AsEnumerable();

            //      members.Notes = notelist.AsEnumerable();

            // sorting member notes result
            Note_List = SortTableMemberNotes(sort, Note_List);

            members.Notes = Note_List.ToList().AsQueryable().ToPagedList(page ?? 1, 5);

            return(View(members));
        }