示例#1
0
        public object GetData()
        {
            var data = new RowsInvoiceData();

            using (var connection = SqlConnections.NewFor <RowsRow>())
            {
                var o          = RowsRow.Fields;
                var row        = connection.TryById <RowsRow>(this.RowId, r => r.SelectTableFields());
                var rowForeign = connection.TryById <RowsRow>(this.RowId, r => r.SelectForeignFields(row));
                data.Phase       = rowForeign.PhaseName;
                data.Part        = rowForeign.PartName;
                data.Client      = rowForeign.ClientName;
                data.Object      = row.Object;
                data.InvoiceDate = row.Date ?? DateTime.Now;
                data.InvoiceCode = row.InvoiceCode;
                data.UserGive    = row.PersonDelivered;
                var qrCode = QRCodeGeneratorExtend.GenerateQRCode(row.InvoiceCode);
                data.QrCodeBase64 = Convert.ToBase64String(qrCode, 0, qrCode.Length);

                data.UserTake      = row.PersonTook;
                data.ProjectCounts = row.ProjectsCount;
                data.FoldersCount  = row.FoldersCount;
                data.TotalCount    = row.FoldersTotalCount;
            }
            return(data);
        }
示例#2
0
        public object GetData()
        {
            var data = new RowsInvoiceData();

            using (var connection = SqlConnections.NewFor <RowsRow>())
            {
                var o          = RowsRow.Fields;
                var row        = connection.TryById <RowsRow>(this.RowId, r => r.SelectTableFields());
                var rowForeign = connection.TryById <RowsRow>(this.RowId, r => r.SelectForeignFields(row));
                data.Phase       = rowForeign.PhaseName;
                data.Part        = rowForeign.PartName;
                data.Client      = rowForeign.ClientName;
                data.Object      = row.Object;
                data.InvoiceDate = row.Date ?? DateTime.Now;
                data.InvoiceCode = row.InvoiceCode;
                data.UserGive    = row.PersonDelivered;
                var qrCode = QRCodeGeneratorExtend.GenerateQRCode(row.InvoiceCode);
                data.QrCodeBase64 = Convert.ToBase64String(qrCode, 0, qrCode.Length);

                data.UserTake      = row.PersonTook;
                data.ProjectCounts = row.ProjectsCount;
                data.FoldersCount  = row.FoldersCount;
                data.TotalCount    = row.FoldersTotalCount;

                // var details = connection.List<RowDetailsRow>(s => s.Select("*").Where(new Criteria(RowDetailsRow.Fields.RowId.Name) == this.RowId));

                var details = new RowDetailsRepository().List(connection,
                                                              new ListRequest {
                    Criteria = new Criteria(RowDetailsRow.Fields.RowId.Name) == this.RowId
                }).Entities;
                foreach (var rowDetailsRow in details)
                {
                    data.Details.Add(new RowsInvoiceData.RowDetails
                    {
                        Description = rowDetailsRow.Description,
                        PartName    = rowDetailsRow.PartName,
                        Quantity    = rowDetailsRow.Quantity ?? 0
                    });
                }
            }
            return(data);
        }