Example #1
0
 public EquipmentListReport(EquipmentList reportedList)
 {
     InitializeComponent();
     _dataSet=new ReportDataSet();
     _reportedList = reportedList;
     _reportParameters = new List<ReportParameter>()
     {
         new ReportParameter("ListType", _reportedList.ListType.ToString()),
         new ReportParameter("ListState", _reportedList.ListState ? @"" : @"Архивный"),
         new ReportParameter("ListName", _reportedList.Description),
         new ReportParameter("UserName", _reportedList.Access_Users.Description),
         new ReportParameter("CreationDate", _reportedList.CreationDate.ToShortDateString()),
         new ReportParameter("SortBy", 0.ToString())
     };
 }
Example #2
0
 private void btnCreateList_Click(object sender, EventArgs e)
 {
     string lt = _formListType == EquipmentListTypes.toReceive ? @"на получение" : @"на демонтаж";
     List<string> namesList = new List<string>
     {
         string.Format("{0} - {1}", DateTime.Now.ToShortDateString(), lt),
         string.Format("{0} - {1} - {2}", _managedEquipment.Area.Description, DateTime.Now.ToShortDateString(), lt)
     };
     if (_managedEquipment.SideLink != null)
     {
         if (_managedEquipment.SideLink.LinkType == (int) SideLinkType.toCustomData)
         {
             namesList.Add(string.Format("{0} - {1} - {2}", _managedEquipment.SideLink.CustomData, DateTime.Now.ToShortDateString(),lt));
         }
         else if (_managedEquipment.SideLink.LinkType == (int) SideLinkType.toCustomerSide)
         {
             namesList.Add(string.Format("{0}, {1} - {2} - {3}", 
                 _managedEquipment.SideLink.CustomerSide.CustomerId,
                 _dataContext.GetSideLinkDescription2(_managedEquipment.SideLink, titleOnly: true),
                 DateTime.Now.ToShortDateString(),
                 lt));
             namesList.Add(string.Format("{0} - {1} - {2}", 
                 _dataContext.GetSideLinkDescription2(_managedEquipment.SideLink),
                 DateTime.Now.ToShortDateString(),
                 lt));
         }
     }
     CreateListNameForm cln=new CreateListNameForm() {comboBox1 = {DataSource = namesList}};
     if (cln.ShowDialog(this) == DialogResult.OK)
     {
         EquipmentList list=new EquipmentList
         {
             CreationDate = DateTime.Now,
             Description = cln.comboBox1.Text,
             ListState = true,
             ListType = (int)_formListType,
             Id = Guid.NewGuid(),
             Access_Users = SharedAppData.LoggedUser
         };
         Cursor = Cursors.WaitCursor;
         _dataContext.AccEquipmentV2Entities.EquipmentLists.Add(list);
         _dataContext.AccEquipmentV2Entities.SaveChanges();
         cbLists.DataSource = _dataContext.AccEquipmentV2Entities.EquipmentLists.Where(l => l.ListState & l.ListType == (int)_formListType).OrderBy(o => o.Description).ThenByDescending(o => o.CreationDate).ToList();
         cbLists.SelectedItem = list;
         SharedAppData.HistoryStore.AddHistoryEvent("Create EquipmentList",string.Format("{0} {1}",_formListType.ToString(),list.Description));
         Cursor = Cursors.Default;
     }
 }