Пример #1
0
        protected object RenderAppointment(Appointment appointment, List <User> users, List <Customer> customers, List <Contact> contacts, List <AppointmentContact> appointmentcontacts)
        {
            var appointmentcontact = appointmentcontacts.FirstOrDefault(t => t.IDAppointment == appointment.ID) ?? new AppointmentContact();
            var contact            = contacts.FirstOrDefault(t => t.ID == appointmentcontact.IDContact) ?? new Contact();

            return(new
            {
                ID = appointment.ID,
                Name = appointment.Name,
                Worked = CUtils.DateTimeToLong(appointment.Worked),
                IDCustomer = appointment.IDCustomer,
                Describe = appointment.Describe,
                Customer = (customers.FirstOrDefault(x => x.ID == appointment.IDCustomer) ?? new Customer()).Name,
                ResultSale = appointment.ResultSale,
                ResultSaleContent = appointment.ResultSaleContent,
                ResultBDH = appointment.ResultBDH,
                ResultBDHContent = appointment.ResultBDHContent,
                CreatedBy = (users.FirstOrDefault(x => x.ID == appointment.CreatedBy) ?? new User()).Name,
                ConactName = contact.Name,
                ContactEmail = contact.Email,
                ContactPhone = contact.Phone,
                ContactPosition = contact.Position,
                ContactAddress = contact.Address,
                IsBDH = GlobalConfig.IsAccess(CUser, IModule.QuanLyTatCaDanhBaKhachHang)
            });
        }
Пример #2
0
 protected object RenderStgDoc(StgDoc stgDoc, Dictionary <long, isPin> dicPin, List <User> users, StgDocPerm stgDocPerm, bool isQlk, List <StgDoc> folders, List <UserRecent> userrecents = null)
 {
     return(new
     {
         ID = stgDoc.ID,
         Path = GlobalConfig.StgSrcPath(stgDoc.Path),
         Size = Utils.SizeConvert(stgDoc.Size),
         Name = stgDoc.Name,
         Created = CUtils.DateTimeToLong(stgDoc.Created),
         CreateBy = (users.FirstOrDefault(t => t.ID == stgDoc.CreatedBy) ?? new User()).Name ?? "",
         Updated = userrecents == null?CUtils.DateTimeToLong(stgDoc.Updated) : CUtils.DateTimeToLong(userrecents.FirstOrDefault(t => t.IDDoc == stgDoc.ID).Created),
                       UpdateBy = (users.FirstOrDefault(t => t.ID == stgDoc.UpdatedBy) ?? new User()).Name ?? "",
                       IsFolder = stgDoc.IsFolder,
                       Icon = GlobalConfig.StgSrcPath((stgDoc.Extension ?? "").Replace(".", "") + ".png"),
                       IsView = isQlk || stgDocPerm.IsView(stgDoc),
                       IsUpdate = isQlk || stgDocPerm.IsUpdate(stgDoc),
                       IsDelete = isQlk || stgDocPerm.IsDelete(stgDoc),
                       IsCreate = isQlk || stgDocPerm.IsCreate(stgDoc),
                       IsCopy = isQlk || stgDocPerm.IsCopy(stgDoc),
                       IsDownload = isQlk || stgDocPerm.IsDownload(stgDoc),
                       IsMove = isQlk || stgDocPerm.IsMove(stgDoc),
                       IsShare = isQlk || stgDocPerm.IsShare(stgDoc),
                       IsNote = isQlk || stgDocPerm.IsNote(stgDoc),
                       IsPassword = !string.IsNullOrEmpty(stgDoc.Password),
                       IsSetPassword = isQlk,
                       IsChangePassword = isQlk,
                       TypeExtension = CUtils.GetTypebyExtension(stgDoc.Extension),
                       Parent = stgDoc.Parent,
                       IsPin = (int)dicPin[stgDoc.ID],
                       PasswordParentId = GetPasswordParent(folders, stgDoc)
     });
 }