Beispiel #1
0
 public BSOBaseInfoModel(BSOInfo bsoInfo)
 {
     this.BSO_ID = bsoInfo.Id;
     this.TemporaryPolicyNumber = bsoInfo.TemporaryPolicyNumber;
     this.PolicyPartyNumber     = bsoInfo.PolicyPartyNumber;
     this.Status           = bsoInfo.Status;
     this.StatusDate       = bsoInfo.StatusDate;
     this.Comment          = bsoInfo.Comment;
     this.DeliveryCenterId = bsoInfo.DeliveryCenterId;
     this.DeliveryCenter   = bsoInfo.DeliveryCenter;
     this.DeliveryPointId  = bsoInfo.DeliveryPointId;
     this.DeliveryPoint    = bsoInfo.DeliveryPoint;
     this.ResponsibleID    = bsoInfo.ResponsibleID;
     this.ResponsibleName  = bsoInfo.ResponsibleName;
     this.ChangeDate       = bsoInfo.ChangeDate;
 }
Beispiel #2
0
        public BSOInfo GetBSOBaseInfo()
        {
            BSOInfo bsoInfo = new BSOInfo();

            bsoInfo.Id = this.BSO_ID;
            bsoInfo.TemporaryPolicyNumber = this.TemporaryPolicyNumber;
            bsoInfo.PolicyPartyNumber     = this.PolicyPartyNumber;
            bsoInfo.Status           = this.Status;
            bsoInfo.StatusDate       = this.StatusDate;
            bsoInfo.Comment          = this.Comment;
            bsoInfo.DeliveryCenterId = this.DeliveryCenterId;
            bsoInfo.DeliveryCenter   = this.DeliveryCenter;
            bsoInfo.DeliveryPointId  = this.DeliveryPointId;
            bsoInfo.DeliveryPoint    = this.DeliveryPoint;
            bsoInfo.ResponsibleID    = this.ResponsibleID;
            bsoInfo.ResponsibleName  = this.ResponsibleName;
            bsoInfo.ChangeDate       = this.ChangeDate;
            return(bsoInfo);
        }
Beispiel #3
0
        protected override void Process(ISheet table)
        {
            int rowNumber     = 16;
            int rowNumberDown = 27;

            string dateTime = string.Format("за отчетный период с {0} г. по {1} г.", DateTimeFrom.ToShortDateString(), DateTimeTo.ToShortDateString());

            table.FindCellByMacros(dateTimeConst).SetValue(dateTime);
            table.FindCellByMacros(deliveryPointConst).SetValue(DeliveryPoint);

            var ListHistoryGroupByBSO_IDs = ListHistory.GroupBy(a => a.Id);

            foreach (var item in ListHistoryGroupByBSO_IDs)
            {
                BSOHistoryItem temp = item.OrderBy(a => a.StatusDate).Where(b => b.Status.Id == (long)ListBSOStatusID.OnDelivery || b.Status.Id == (long)ListBSOStatusID.OnResponsible).LastOrDefault();

                if (temp != null)
                {
                    if (temp.StatusDate < DateTimeFrom)
                    {
                        BSOInfo bsoInfo = new BSOInfo()
                        {
                            TemporaryPolicyNumber = ListBSOinRangeDate.Where(a => a.Id == temp.Id).Select(b => b.TemporaryPolicyNumber).LastOrDefault(),
                            //TemporaryPolicyNumber = ListBSOAllDate.Where(a => a.Id == temp.Id).Select(b => b.TemporaryPolicyNumber).LastOrDefault(),
                            Status = new BSOStatusRef()
                            {
                                Id = temp.Status.Id
                            }
                        };
                        if (!string.IsNullOrEmpty(bsoInfo.TemporaryPolicyNumber))
                        {
                            ListBSOBeforeDate.Add(bsoInfo);
                        }
                    }
                    else
                    {
                        BSOInfo bsoInfo = new BSOInfo()
                        {
                            TemporaryPolicyNumber = ListBSOinRangeDate.Where(a => a.Id == temp.Id).Select(b => b.TemporaryPolicyNumber).LastOrDefault(),
                            //TemporaryPolicyNumber = ListBSOAllDate.Where(a => a.Id == temp.Id).Select(b => b.TemporaryPolicyNumber).LastOrDefault(),
                            Status = new BSOStatusRef()
                            {
                                Id = temp.Status.Id
                            }
                        };
                        if (!string.IsNullOrEmpty(bsoInfo.TemporaryPolicyNumber))
                        {
                            ListBSOGet.Add(bsoInfo);
                        }
                    }
                }
            }

            Dictionary <string, long> dicBefore = SortingAndGroup(ListBSOBeforeDate, new List <long>()
            {
                (long)ListBSOStatusID.OnDelivery, (long)ListBSOStatusID.OnResponsible
            });
            Dictionary <string, long> dicRange = SortingAndGroup(ListBSOGet, new List <long>()
            {
                (long)ListBSOStatusID.OnDelivery, (long)ListBSOStatusID.OnResponsible
            });
            Dictionary <string, long> dicAll = SortingAndGroup(ListBSOAllDate, new List <long>()
            {
                (long)ListBSOStatusID.OnDelivery, (long)ListBSOStatusID.OnResponsible
            });
            Dictionary <string, long> dicOnClient = SortingAndGroup(ListBSOinRangeDate, new List <long>()
            {
                (long)ListBSOStatusID.OnClient
            });
            Dictionary <string, long> dicFail = SortingAndGroup(ListBSOinRangeDate, new List <long>()
            {
                (long)ListBSOStatusID.FailOnStorage, (long)ListBSOStatusID.FailOnResponsible, (long)ListBSOStatusID.FailGotoStorage
            });

            //определяем в каком словаре максимальное кол-во элементов, для того чтоб насоздавать строки
            List <int> countDictionary = new List <int>();

            countDictionary.Add(dicBefore == null ? 0 : dicBefore.Count);
            countDictionary.Add(dicRange == null ? 0 : dicRange.Count);
            countDictionary.Add(dicAll == null ? 0 : dicAll.Count);
            countDictionary.Add(dicOnClient == null ? 0 : dicOnClient.Count);
            countDictionary.Add(dicFail == null ? 0 : dicFail.Count);
            var max = countDictionary.Max() / 2;

            //если много данных - двигаем последние строчки еще ниже
            if (max > 10)
            {
                for (int i = 0; i < 10; i++)
                {
                    table.CopyRow(i + rowNumberDown, i + rowNumberDown + max);
                }
            }

            ICellStyle style = table.Workbook.CreateCellStyle();

            style.BorderRight  = BorderStyle.Thin;
            style.BorderBottom = BorderStyle.Thin;
            style.BorderTop    = BorderStyle.Thin;
            style.BorderLeft   = BorderStyle.Thin;

            List <IRow> rows = new List <IRow>();

            for (int i = 0; i < countDictionary.Max() / 2; i++)
            {
                IRow row = table.CreateRow(i + rowNumber);
                for (int j = 0; j <= 14; j++)
                {
                    row.CreateCell(j).CellStyle = style;
                }
                rows.Add(row);
            }

            Output(dicBefore, rows, 0);
            Output(dicRange, rows, 3);
            Output(dicOnClient, rows, 6);
            Output(dicFail, rows, 9);
            Output(dicAll, rows, 12);

            //Итого:
            IRow rowSum = table.CreateRow(max + rowNumber);

            rowSum.CreateCell(0).SetValue("Итого:");
            rowSum.CreateCell(2).SetCellFormula(string.Format("SUM(C{0}:C{1})", rowNumber + 1, rowNumber + max));
            rowSum.CreateCell(5).SetCellFormula(string.Format("SUM(F{0}:F{1})", rowNumber + 1, rowNumber + max));
            rowSum.CreateCell(8).SetCellFormula(string.Format("SUM(I{0}:I{1})", rowNumber + 1, rowNumber + max));
            rowSum.CreateCell(11).SetCellFormula(string.Format("SUM(L{0}:L{1})", rowNumber + 1, rowNumber + max));
            rowSum.CreateCell(14).SetCellFormula(string.Format("SUM(O{0}:O{1})", rowNumber + 1, rowNumber + max));

            table.FindCellByMacros(FIOConst).SetValue(FIO);
            table.FindCellByMacros(PositionConst).SetValue(Position);
            table.FindCellByMacros(nowDateTimeConst).SetValue(DateTime.Now.ToShortDateString());
        }