public Document(SqlTransaction trans, int id, string userName) : this(userName) { Init(trans, id); if (ExternalSource.IsExist(trans, id)) { ExternalSource = new ExternalSource(trans, id, userName); } if (Source.IsExist(trans, id)) { Source = new Source(trans, id, userName); } if (Destination.IsExist(trans, id)) { Destination = new Destination(trans, id, userName); } Department = new Department(trans, DepartmentID, userName); DocumentCode dc = new DocumentCode(trans, CodeID, userName); CodeName = dc.Name; Code = dc.Code; Files = DocumentFile.GetList(trans, id); Labels = DocumentLabel.GetDocumentLabelIds(trans, id); }
public static DocumentLabel[] GetDocumentLabels(SqlTransaction trans, int documentId, int departmentId) { DataTable dtLabels = GetList(trans, documentId, departmentId); DocumentLabel[] labels = new DocumentLabel[dtLabels.Rows.Count]; int i = 0; foreach (DataRow rowBranchType in dtLabels.Rows) { DocumentLabel label = new DocumentLabel(); label.ID = (int)rowBranchType["DocumentLabelID"]; label.LabelID = (int)rowBranchType["LabelID"]; label.DocumentID = documentId; label.DepartmentID = departmentId; label.WorkerID = (int)rowBranchType["WorkerID"]; label.CreateDate = (DateTime)rowBranchType["CreateDate"]; labels[i] = label; i++; } return(labels); }