Beispiel #1
0
        /// <summary>
        /// 显示作者信息详情
        /// </summary>
        /// <returns></returns>
        public AuthorInfo GetAllAuthor(string aname)
        {
            var        list = auth.GetAll();
            AuthorInfo aut  = list.Where(m => m.Aname.Contains(aname)).FirstOrDefault();

            return(aut);
        }
Beispiel #2
0
 public AsciiAuthorInfoTestCase(string input, AuthorInfo expected)
 {
     Input    = DocumentTitle + "\n" + input;
     Expected = new List <AuthorInfo> {
         expected
     };
 }
Beispiel #3
0
        public bool Update(AuthorInfo authorInfo)
        {
            Parameters cmdParams = GetParameters(authorInfo);

            cmdParams.AddInParameter("@ID", DbType.Int32, authorInfo.Id);
            return(DBHelper.ExecuteProc("PR_Accessories_Author_Update", cmdParams));
        }
Beispiel #4
0
        private static AuthorInfo AuthorFromrdr(NullableDataReader rdr)
        {
            AuthorInfo info = new AuthorInfo();

            info.Id          = rdr.GetInt32("ID");
            info.UserId      = rdr.GetInt32("UserID");
            info.Type        = rdr.GetString("Type");
            info.Name        = rdr.GetString("Name");
            info.Passed      = rdr.GetBoolean("Passed");
            info.OnTop       = rdr.GetBoolean("onTop");
            info.Elite       = rdr.GetBoolean("IsElite");
            info.Hits        = rdr.GetInt32("Hits");
            info.LastUseTime = rdr.GetDateTime("LastUseTime");
            info.TemplateId  = rdr.GetInt32("TemplateID");
            info.Photo       = rdr.GetString("Photo");
            info.Intro       = rdr.GetString("Intro");
            info.Address     = rdr.GetString("Address");
            info.Tel         = rdr.GetString("Tel");
            info.Fax         = rdr.GetString("Fax");
            info.Mail        = rdr.GetString("Mail");
            info.Email       = rdr.GetString("Email");
            info.ZipCode     = rdr.GetInt32("ZipCode");
            info.HomePage    = rdr.GetString("HomePage");
            info.Imeeting    = rdr.GetString("Im");
            info.Sex         = rdr.GetInt16("Sex");
            info.BirthDay    = rdr.GetDateTime("BirthDay");
            info.Company     = rdr.GetString("Company");
            info.Department  = rdr.GetString("Department");
            return(info);
        }
        private async Task <string> PutTemplate(long id, AuthorInfo authorInfo, ITemplateDescriptor templateDescriptor, int?prevVersionIndex = null)
        {
            await VerifyElementDescriptorsConsistency(templateDescriptor.Elements);

            var versionIndex = prevVersionIndex + 1 ?? 0;
            var json         = JsonConvert.SerializeObject(templateDescriptor, SerializerSettings.Default);
            var template     = new Template
            {
                Id           = id,
                VersionIndex = versionIndex,
                Data         = json,
                Author       = authorInfo.Author,
                AuthorLogin  = authorInfo.AuthorLogin,
                AuthorName   = authorInfo.AuthorName,
                LastModified = DateTime.UtcNow
            };

            using (var scope = await _context.Database.BeginTransactionAsync(IsolationLevel.RepeatableRead))
            {
                await _context.Templates.AddAsync(template);

                await _context.SaveChangesAsync();

                scope.Commit();
            }

            return(template.VersionId);
        }
Beispiel #6
0
        private static Parameters GetParameters(AuthorInfo authorInfo)
        {
            Parameters parameters = new Parameters();

            parameters.AddInParameter("@UserId", DbType.Int32, authorInfo.UserId);
            parameters.AddInParameter("@Name", DbType.String, authorInfo.Name);
            parameters.AddInParameter("@Type", DbType.String, authorInfo.Type);
            parameters.AddInParameter("@Passed", DbType.Boolean, authorInfo.Passed);
            parameters.AddInParameter("@onTop", DbType.Boolean, authorInfo.OnTop);
            parameters.AddInParameter("@IsElite", DbType.Boolean, authorInfo.Elite);
            parameters.AddInParameter("@Hits", DbType.Int32, authorInfo.Hits);
            parameters.AddInParameter("@LastUseTime", DbType.DateTime, authorInfo.LastUseTime);
            parameters.AddInParameter("@TemplateID", DbType.Int32, authorInfo.TemplateId);
            parameters.AddInParameter("@Photo", DbType.String, authorInfo.Photo);
            parameters.AddInParameter("@Intro", DbType.String, authorInfo.Intro);
            parameters.AddInParameter("@Address", DbType.String, authorInfo.Address);
            parameters.AddInParameter("@Tel", DbType.String, authorInfo.Tel);
            parameters.AddInParameter("@Fax", DbType.String, authorInfo.Fax);
            parameters.AddInParameter("@Mail", DbType.String, authorInfo.Mail);
            parameters.AddInParameter("@Email", DbType.String, authorInfo.Email);
            parameters.AddInParameter("@ZipCode", DbType.Int32, authorInfo.ZipCode);
            parameters.AddInParameter("@HomePage", DbType.String, authorInfo.HomePage);
            parameters.AddInParameter("@Im", DbType.String, authorInfo.Imeeting);
            parameters.AddInParameter("@Sex", DbType.Int16, authorInfo.Sex);
            parameters.AddInParameter("@BirthDay", DbType.DateTime, authorInfo.BirthDay);
            parameters.AddInParameter("@Company", DbType.String, authorInfo.Company);
            parameters.AddInParameter("@Department", DbType.String, authorInfo.Department);
            return(parameters);
        }
        public async Task <string> ModifyTemplate(long id, string versionId, AuthorInfo authorInfo, ITemplateDescriptor templateDescriptor)
        {
            if (id == 0)
            {
                throw new ArgumentException("Template Id must be set", nameof(id));
            }

            if (string.IsNullOrEmpty(versionId))
            {
                throw new ArgumentException("VersionId must be set", nameof(versionId));
            }

            using (await _distributedLockManager.AcquireLockAsync(id))
            {
                if (!await _templatesStorageReader.IsTemplateExists(id))
                {
                    throw new ObjectNotFoundException($"Template '{id}' does not exist");
                }

                var latestVersionId = await _templatesStorageReader.GetTemplateLatestVersion(id);

                if (!versionId.Equals(latestVersionId, StringComparison.Ordinal))
                {
                    throw new ConcurrencyException(id, versionId, latestVersionId);
                }

                await PutTemplate(id, authorInfo, templateDescriptor);

                // ceph does not return version-id response header, so we need to do another request to get version
                return(await _templatesStorageReader.GetTemplateLatestVersion(id));
            }
        }
        /// <summary>
        /// 作者信息添加
        /// </summary>
        /// <param name="mode"></param>
        /// <returns></returns>
        public int AddAuthorInfo(string obj)
        {
            AuthorInfo mode = JsonConvert.DeserializeObject <AuthorInfo>(obj);


            return(dal.AddAuthorInfo(mode));
        }
Beispiel #9
0
 protected bool Equals(AuthorInfo other)
 {
     return(string.Equals(FirstName, other.FirstName) &&
            string.Equals(MiddleName, other.MiddleName) &&
            string.Equals(LastName, other.LastName) &&
            string.Equals(Email, other.Email));
 }
 // PUT: api/author/5
 public HttpResponseMessage Put(int id, AuthorInfo b)
 {
     try
     {
         using (PracticeEntities x = new PracticeEntities())
         {
             var y = x.AuthorInfoes.FirstOrDefault(e => e.AID == id);
             if (y == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Author with Id=" + id.ToString() + " not found"));
             }
             else
             {
                 y.AuthorName = b.AuthorName;
                 y.City       = b.City;
                 x.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, y));
             }
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Beispiel #11
0
        public static AuthorInfo GetAuthor(int memberid)
        {
            var        member = GetMember(memberid);
            AuthorInfo author = new AuthorInfo(member);

            return(author);
        }
        public ActionResult Edit(string id, string editable)
        {
            ViewBag.title = "Chỉnh sửa số trích dẫn";
            var pagesTree = new List <PageTree>
            {
                new PageTree("Chỉnh sửa số trích dẫn", "/Citation/Edit"),
            };

            ViewBag.pagesTree = pagesTree;
            ViewBag.ckEdit    = editable;

            AuthorInfo author = cr.getAuthor(id);

            ViewBag.author = author;

            List <ENTITIES.Citation> listCitation = cr.getCitation(id);

            ViewBag.citation = listCitation;

            List <DetailComment> listCmt = crr.getComment(Int32.Parse(id));

            ViewBag.cmt = listCmt;

            return(View());
        }
Beispiel #13
0
        public EmrNote(AuthorInfo authorInfo, XmlElement emrNote, NoteEditMode editMode,
                       string registryID, MainForm etp)
        {
            emrTaskPane    = etp;
            this.editModes = editMode;
            merge          = emrNote.Attributes[AttributeNames.Merge].Value;
            if (emrNote.Attributes[AttributeNames.StartTime] != null)
            {
                startTime = emrNote.Attributes[AttributeNames.StartTime].Value;
            }

            noteInfo = new NoteInfo(authorInfo, registryID, false,
                                    emrNote.Attributes[AttributeNames.Header].Value,
                                    emrNote.Attributes[AttributeNames.Unique].Value);
            noteInfo.sexOption = (emrNote.Attributes[AttributeNames.Sex].Value == StringGeneral.Yes);
            sexOption          = emrNote.Attributes[AttributeNames.Sex].Value;
            author             = new UCAuthor(authorInfo, false, emrTaskPane);

            if (emrNote.Attributes[AttributeNames.Header].Value == StringGeneral.None)
            {
                XmlNode theader = emrNote.SelectSingleNode(ElementNames.Header);
                if (theader != null)
                {
                    header = theader.Clone();
                }
            }

            noteInfo.SetEditMode(editMode);
            // SetEditModes();
        }
Beispiel #14
0
        /// <summary>
        /// Remove author.
        /// </summary>
        /// <param name="author"></param>
        /// <returns></returns>
        public Task <Result> DeleteAsync(AuthorInfo author)
        {
            var authorDb = _mapper.Map <AuthorInfo, AuthorDb>(author);

            _authorRepository.RemoveAsync(authorDb);
            return(Task.FromResult(Result.Ok()));
        }
        public async Task <string> CreateTemplate(long id, AuthorInfo authorInfo, ITemplateDescriptor templateDescriptor)
        {
            if (id == 0)
            {
                throw new ArgumentException("Template Id must be set", nameof(id));
            }

            var redLock = await _distributedLockManager.CreateLockAsync(id);

            try
            {
                if (await _templatesStorageReader.IsTemplateExists(id))
                {
                    throw new ObjectAlreadyExistsException(id);
                }

                await PutTemplate(id, authorInfo, templateDescriptor);

                // ceph does not return version-id response header, so we need to do another request to get version
                return(await _templatesStorageReader.GetTemplateLatestVersion(id));
            }
            finally
            {
                redLock?.Dispose();
            }
        }
Beispiel #16
0
        private void button3_Click(object sender, EventArgs e)
        {
            AuthorInfo author = new AuthorInfo();

            author.Show();
            this.Hide();
        }
Beispiel #17
0
        public async Task <string> Modify(long id, string versionId, AuthorInfo authorInfo, IObjectDescriptor modifiedObjectDescriptor)
        {
            CheckRequredProperties(id, modifiedObjectDescriptor);

            if (string.IsNullOrEmpty(versionId))
            {
                throw new ArgumentException("Object version must be set", nameof(versionId));
            }

            using (await _distributedLockManager.AcquireLockAsync(id))
            {
                var objectDescriptor = await _objectsStorageReader.GetObjectDescriptor(id, null, CancellationToken.None);

                if (objectDescriptor == null)
                {
                    throw new ObjectNotFoundException($"Object '{id}' not found.");
                }

                if (!versionId.Equals(objectDescriptor.VersionId, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ConcurrencyException(id, versionId, objectDescriptor.VersionId);
                }

                var currentTemplateIds  = new HashSet <long>(objectDescriptor.Elements.Select(x => x.Id));
                var modifiedTemplateIds = new HashSet <long>(modifiedObjectDescriptor.Elements.Select(x => x.Id));
                if (!modifiedTemplateIds.IsSubsetOf(currentTemplateIds))
                {
                    throw new ObjectInconsistentException(id, "Modified object contains non-existing elements.");
                }

                EnsureObjectElementsState(id, objectDescriptor.Elements, modifiedObjectDescriptor.Elements);

                return(await PutObject(id, versionId, authorInfo, objectDescriptor.Elements, modifiedObjectDescriptor));
            }
        }
Beispiel #18
0
        public async Task <string> Create(long id, AuthorInfo authorInfo, IObjectDescriptor objectDescriptor)
        {
            CheckRequiredProperties(id, objectDescriptor);

            using (await _distributedLockManager.AcquireLockAsync(id))
            {
                if (await _objectsStorageReader.IsObjectExists(id))
                {
                    throw new ObjectAlreadyExistsException(id);
                }

                var templateDescriptor = await _templatesStorageReader.GetTemplateDescriptor(objectDescriptor.TemplateId, objectDescriptor.TemplateVersionId);

                if (templateDescriptor.Elements.Count != objectDescriptor.Elements.Count)
                {
                    throw new ObjectInconsistentException(
                              id,
                              $"Quantity of elements in the object doesn't match to the quantity of elements in the corresponding template with Id '{objectDescriptor.TemplateId}' and versionId '{objectDescriptor.TemplateVersionId}'.");
                }

                var elementIds = new HashSet <long>(objectDescriptor.Elements.Select(x => x.Id));
                if (elementIds.Count != objectDescriptor.Elements.Count)
                {
                    throw new ObjectInconsistentException(id, "Some elements have non-unique identifiers.");
                }

                EnsureObjectElementsState(id, templateDescriptor.Elements, objectDescriptor.Elements);

                return(await PutObject(id, null, null, authorInfo, Enumerable.Empty <IObjectElementDescriptor>(), objectDescriptor));
            }
        }
Beispiel #19
0
        private AuthorInfo GetLastPostAuthor(int authorId)
        {
            var        member = new Member().GetById(authorId);
            AuthorInfo author = new AuthorInfo(member);

            return(author);
        }
Beispiel #20
0
        private void EmrPattern(AuthorInfo authorInfo, string registryID)
        {
            XmlNode emrNote = Globals.emrPattern.GetEmrNote(authorInfo.NoteID);

            if (emrNote == null)
            {
                return;
            }
            if (emrNote.Attributes[AttributeNames.ShowName] != null)
            {
                if (emrNote.Attributes[AttributeNames.ShowName].Value != "")
                {
                    authorInfo.NoteName = emrNote.Attributes[AttributeNames.ShowName].Value;
                }
            }


            emrTaskPane.wordApp.ScreenUpdating = false;
            if (emrNote.Attributes[AttributeNames.Sign3] != null)
            {
                authorInfo.WriterLable = emrNote.Attributes[AttributeNames.Sign3].Value;
            }
            if (emrNote.Attributes[AttributeNames.Sign2] != null)
            {
                authorInfo.CheckerLable = emrNote.Attributes[AttributeNames.Sign2].Value;
            }
            if (emrNote.Attributes[AttributeNames.Sign1] != null)
            {
                authorInfo.FinalCheckerLable = emrNote.Attributes[AttributeNames.Sign1].Value;
            }
            startTime = emrNote.Attributes[AttributeNames.StartTime].Value;
            merge     = emrNote.Attributes[AttributeNames.Merge].Value;

            noteInfo = new NoteInfo(authorInfo, registryID, true,
                                    emrNote.Attributes[AttributeNames.Header].Value,
                                    emrNote.Attributes[AttributeNames.Unique].Value);


            //if (startTime == StartTime.Consult)
            //{
            //    /* private property lastConsult has the result. */
            //    if (Globals.PatientConsultSequence != null && Globals.PatientConsultSequence != "")
            //    {
            //        GetLastConsultFiled(noteID.GetNoteID(), Globals.PatientConsultSequence, patientInfo.RegistryID);
            //    }
            //}
            //else if (startTime == StartTime.Operation)
            //{
            //    /* private property lastConsult has the result. */


            //    GetLastOperationInfo(noteID.GetNoteID(), patientInfo.RegistryID);
            //}

            author = new UCAuthor(authorInfo, true, emrTaskPane);
            emrTaskPane.wordApp.ScreenRefresh();
            emrTaskPane.wordApp.ScreenUpdating = true;
            return;
        }
Beispiel #21
0
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            var library = new Library
            {
                Name  = "Prosveta",
                Books = new List <Book>()
            };

            for (int i = 0; i < n; i++)
            {
                var input = Console.ReadLine().Split();

                var book = new Book
                {
                    Title       = input[0],
                    Author      = input[1],
                    Publisher   = input[2],
                    ReleaseDate = DateTime.ParseExact(input[3], "dd.MM.yyyy", CultureInfo.InvariantCulture),
                    Isbn        = input[4],
                    Price       = double.Parse(input[5])
                };
                library.Books.Add(book);
            }
            var authors = library.Books
                          .Select(a => a.Author)
                          .Distinct()
                          .ToArray();

            var authorSales = new List <AuthorInfo>();

            foreach (var author in authors)
            {
                var authorBooks = library.Books
                                  .Where(a => a.Author == author)
                                  .Sum(a => a.Price);

                AuthorInfo authorInfo = new AuthorInfo
                {
                    Author = author,
                    Sales  = authorBooks
                };
                authorSales.Add
                    (authorInfo);
            }
            authorSales = authorSales
                          .OrderByDescending(x => x.Sales)
                          .ThenBy(a => a.Author)
                          .ToList();

            foreach (var authorSale in authorSales)
            {
                var author = authorSale.Author;
                var sales  = authorSale.Sales;

                Console.WriteLine($"{author} -> {sales:F2}");
            }
        }
Beispiel #22
0
 public static bool Update(AuthorInfo ainfo)
 {
     if (string.IsNullOrEmpty(ainfo.Name))
     {
         return(false);
     }
     return(dal.Update(ainfo));
 }
Beispiel #23
0
        public override global::System.Data.DataSet Clone()
        {
            AuthorInfo cln = ((AuthorInfo)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Beispiel #24
0
 /* Display emrNote foot */
 public UCAuthor(AuthorInfo authorInfo, bool newNote, MainForm etp)
 {
     writerLable       = authorInfo.WriterLable;
     checkerLable      = authorInfo.CheckerLable;
     finalCheckerLable = authorInfo.FinalCheckerLable;
     //if (newNote) DrawAuthor(authorInfo);
     emrTaskPane = etp;
 }
 // POST: api/books
 public void Post(AuthorInfo b)
 {
     using (PracticeEntities x = new PracticeEntities())
     {
         x.AuthorInfoes.Add(b);
         x.SaveChanges();
     }
 }
Beispiel #26
0
 public static bool Add(AuthorInfo ainfo)
 {
     if (dal.Exists(ainfo.Name))
     {
         return(false);
     }
     return(dal.Add(ainfo));
 }
Beispiel #27
0
 public Comment(long id, string body, AuthorInfo author, DateTime date, long newsId, string title)
 {
     Id     = id;
     Body   = body;
     Author = author;
     Date   = date;
     NewsId = newsId;
     Title  = title;
 }
Beispiel #28
0
 private void label3_Click(object sender, EventArgs e)
 {
     using (AuthorInfo info = new AuthorInfo())
     {
         info.KeyDown += OnEscape_KeyDown;
         //info.
         info.ShowDialog();
     }
 }
Beispiel #29
0
        public async Task <string> Modify(long id, string versionId, AuthorInfo authorInfo, IObjectDescriptor modifiedObjectDescriptor)
        {
            CheckRequiredProperties(id, modifiedObjectDescriptor);

            if (string.IsNullOrEmpty(versionId))
            {
                throw new InputDataValidationException("Object version must be set");
            }

            using (await _distributedLockManager.AcquireLockAsync(id))
            {
                var objectDescriptor = await _objectsStorageReader.GetObjectDescriptor(id, null, CancellationToken.None);

                if (!versionId.Equals(objectDescriptor.VersionId, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ConcurrencyException(id, versionId, objectDescriptor.VersionId);
                }

                if (modifiedObjectDescriptor.TemplateId != objectDescriptor.TemplateId)
                {
                    throw new ObjectInconsistentException(
                              id,
                              $"Modified and latest objects templates do not match ({modifiedObjectDescriptor.TemplateId} and {objectDescriptor.TemplateId}).");
                }

                if (!string.Equals(modifiedObjectDescriptor.TemplateVersionId, objectDescriptor.TemplateVersionId, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ObjectInconsistentException(
                              id,
                              $"Modified and latest objects template versions do not match ({modifiedObjectDescriptor.TemplateVersionId} and {objectDescriptor.TemplateVersionId}).");
                }

                if (modifiedObjectDescriptor.Language != objectDescriptor.Language)
                {
                    throw new ObjectInconsistentException(
                              id,
                              $"Modified and latest objects languages do not match ({modifiedObjectDescriptor.Language} and {objectDescriptor.Language}).");
                }

                var modifiedElementsIds = new HashSet <long>(modifiedObjectDescriptor.Elements.Select(x => x.Id));
                if (modifiedElementsIds.Count != modifiedObjectDescriptor.Elements.Count)
                {
                    throw new ObjectInconsistentException(id, "Some elements have non-unique identifiers.");
                }

                var currentElementsIds = new HashSet <long>(objectDescriptor.Elements.Select(x => x.Id));
                if (!modifiedElementsIds.IsSubsetOf(currentElementsIds))
                {
                    throw new ObjectInconsistentException(id, "Modified object contains non-existing elements.");
                }

                EnsureObjectElementsState(id, objectDescriptor.Elements, modifiedObjectDescriptor.Elements);

                return(await PutObject(id, versionId, objectDescriptor.VersionIndex, authorInfo, objectDescriptor.Elements, modifiedObjectDescriptor, currentElementsIds));
            }
        }
Beispiel #30
0
        public static string LinkTarget(AuthorInfo author)
        {
            ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username);

            if (String.IsNullOrEmpty(prof.LinkTarget))
            {
                return("_blank");
            }
            return(prof.LinkTarget);
        }
        private void LoadAuthorList()
        {
            List<AuthorInfo> author = AuthorController.ListByPortal(PortalId);
            AuthorInfo objAuthor = new AuthorInfo();
            objAuthor.UserId = -1;
            objAuthor.UserName = Localization.GetString("SelectAuthor.Text", this.LocalResourceFile);
            author.Add(objAuthor);
            ddlAuthor.DataSource = author;
            ddlAuthor.DataBind();
            ddlAuthor.SelectedValue = "-1";

        }
Beispiel #32
0
 public DocumentEntry()
 {
     Author = new AuthorInfo();
     LastModifiedBy = new AuthorInfo();
     Labels = new List<string>();
 }
Beispiel #33
0
 public Feed()
 {
     DocumentEntries = new Dictionary<string, DocumentEntry>();
     Author = new AuthorInfo();
 }
Beispiel #34
0
 public static extern UInt32 LPR_SetAuthorInfo( IntPtr pHandle ,ref  AuthorInfo pInfo);