示例#1
0
    public void LoadClientsTable()
    {
        string     connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"];
        DataBlock  dataBlock        = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);
        int        orgId            = Convert.ToInt32(Session["CURRENT_ORG_ID"]);
        List <int> clientsIds       = new List <int>();

        dataBlock.OpenConnection();
        int orgTypeId = dataBlock.organizationTable.GetOrgTypeId(orgId);

        clientsIds = dataBlock.organizationTable.Get_AllOrganizationsId(orgId);

        Session["ClientsTab_UserControl_ClientsIds"] = clientsIds;

        DataTable dt = new DataTable();
        DataRow   dr;

        dt.Columns.Add(new DataColumn("CLIENTNAME", typeof(string)));
        dt.Columns.Add(new DataColumn("REG_DATE", typeof(string)));
        dt.Columns.Add(new DataColumn("ENDREG_DATE", typeof(string)));
        dt.Columns.Add(new DataColumn("COUNTRY", typeof(string)));
        dt.Columns.Add(new DataColumn("CITY", typeof(string)));

        int      clientInfoId = 0;
        DateTime date         = new DateTime();
        int      userId       = 1;

        foreach (int id in clientsIds)
        {
            userId = 0;

            dr = dt.NewRow();
            dr["CLIENTNAME"] = dataBlock.organizationTable.GetOrganizationName(id);
            //REG_DATE
            if (DateTime.TryParse(dataBlock.organizationTable.GetAdditionalOrgInfo(id, DataBaseReference.OrgInfo_RegistrationDate), out date))
            {
                dr["REG_DATE"] = date.ToLongDateString() + " " + date.ToShortTimeString();
            }
            //END_REG_DATE
            if (DateTime.TryParse(dataBlock.organizationTable.GetAdditionalOrgInfo(id, DataBaseReference.OrgInfo_EndOfRegistrationDate), out date))
            {
                dr["ENDREG_DATE"] = date.ToLongDateString();
            }
            //COUNTRY
            dr["COUNTRY"] = dataBlock.organizationTable.GetOrgCountryName(id);
            //CITY
            dr["CITY"] = dataBlock.organizationTable.GetAdditionalOrgInfo(id, DataBaseReference.OrgInfo_City);
            //
            dt.Rows.Add(dr);
        }
        ClientsDataGrid.DataSource = dt;
        ClientsDataGrid.DataBind();
        dataBlock.CloseConnection();
    }
        private void OnlinerTimer_Tick(object sender, EventArgs e)
        {
            AdminClientsJournalDetail.FillClients(DateFromPicker.Value, DateToPicker.Value);
            AdminClientsJournalDetail.CheckOnline();
            AdminClientsJournalDetail.ClearTopMostAndTopModuleAndIdle();
            ClientsDataGrid.SuspendLayout();
            ClientsDataGrid.Refresh();
            ClientsDataGrid.ResumeLayout();

            TotalUsersLabel.Text = "Всего: " + AdminClientsJournalDetail.ClientsBindingSource.Count;
            OnlineLabel.Text     = "Онлайн: " + AdminClientsJournalDetail.GetOnlineUsersCount();
        }
        private void BtnPdf_Client_Click(object sender, RoutedEventArgs e)
        {
            var document = ClientsDataGrid.ExportToPdf(new PdfExportingOptions()
            {
                AutoColumnWidth = true, AutoRowHeight = true, ExcludeColumns = new List <string>()
                {
                    "Id", "Password"
                }
            });

            GeneratePDF(document);
        }
        private void Initialize()
        {
            AdminClientsJournalDetail = new AdminClientsJournalDetail(ref ClientsDataGrid, ref LoginJournalDataGrid, ref ComputerParamsDataGrid,
                                                                      ref ModulesJornalDataGrid, ref MessagesDataGrid, ref ClientEventsJournalDataGrid);

            DateFromPicker.Value = DateTime.Now;
            DateToPicker.Value   = DateTime.Now;

            Filter();
            AdminClientsJournalDetail.FillMessages(MessagesFromDateTimePicker.Value, MessagesToDateTimePicker.Value);
            ClientsDataGrid.AddColumns();
            AdminClientsJournalDetail.SetGrid();
        }
 private void ClientsDataGrid_RowValidating(object sender, RowValidatingEventArgs args)
 {
     if (ClientsDataGrid.IsAddNewIndex(args.RowIndex))
     {
         var client = args.RowData as Client;
         var error  = getManager.Client.Validate(client);
         if (error.Count > 0)
         {
             args.IsValid = false;
             foreach (var item in error)
             {
                 args.ErrorMessages.Add(item.Key, item.Value);
             }
         }
     }
 }
示例#6
0
        public ConnectClientMessage(ref ClientsMessagesDataGrid tSelectedUsersGrid, ref ClientsDataGrid tUsersListDataGrid)
        {
            UsersDataTable = new DataTable();

            using (SqlDataAdapter DA = new SqlDataAdapter("SELECT ClientID, ClientName FROM Clients ORDER BY ClientName ASC", ConnectionStrings.MarketingReferenceConnectionString))
            {
                DA.Fill(UsersDataTable);
            }

            CreateAndFill();
            Binding();

            ClientDataTable.Columns.Add(new DataColumn("OnlineStatus", Type.GetType("System.Boolean")));

            CurrentUserName = Security.GetUserNameByID(CurrentUserID);

            MessagesDataTable = new DataTable();

            SelectedUsersDataTable = new DataTable();
            SelectedUsersDataTable = ClientDataTable.Clone();
            SelectedUsersDataTable.Columns.Add(new DataColumn("UpdatesCount", Type.GetType("System.Int32")));

            SelectedUsersGrid = tSelectedUsersGrid;
            UsersListDataGrid = tUsersListDataGrid;

            SelectedUsersBindingSource = new BindingSource()
            {
                DataSource = SelectedUsersDataTable
            };
            SelectedUsersGrid.DataSource = SelectedUsersBindingSource;

            UsersListDataGrid.DataSource = ClientBindingSource;

            SetSelectedUsersGrid();
            SetUsersGrid();
        }