Ejemplo n.º 1
0
        public List <RecordSearch> GetPartialRecordSearchesByCriteria(string criteria)
        {
            using (OleDbConnection connection = new OleDbConnection(ConnectionString))
            {
                using (OleDbCommand sqlCommand = connection.CreateCommand())
                {
                    sqlCommand.CommandText = @"SELECT ID, ICPrefix, ICYear, ICEnumeration, ICSuffix, ProjectName, Status, LastUpdated FROM tblRecordSearches " + criteria;
                    connection.Open();

                    OleDbDataReader reader = sqlCommand.ExecuteReader();

                    List <RecordSearch> returnCollection = new List <RecordSearch>();

                    while (reader.Read())
                    {
                        int          index       = 0;
                        RecordSearch returnValue = new RecordSearch()
                        {
                            ID            = reader.GetInt32Safe(index++),
                            ICTypePrefix  = reader.GetStringSafe(index++),
                            ICYear        = reader.GetStringSafe(index++),
                            ICEnumeration = reader.GetInt32Safe(index++),
                            ICSuffix      = reader.GetStringSafe(index++),
                            ProjectName   = reader.GetStringSafe(index++),
                            Status        = reader.GetStringSafe(index++),
                            LastUpdated   = reader.GetDateTimeSafe(index++)
                        };
                        returnCollection.Add(returnValue);
                    }

                    return(returnCollection);
                }
            }
        }
Ejemplo n.º 2
0
        public RecordSearch GetPartialRecordSearchesByCriteria(int id)
        {
            using (OleDbConnection connection = new OleDbConnection(ConnectionString))
            {
                using (OleDbCommand sqlCommand = connection.CreateCommand())
                {
                    sqlCommand.CommandText = @"SELECT ID, ICPrefix, ICYear, ICEnumeration, ICSuffix, ProjectName, Status, LastUpdated FROM tblRecordSearches WHERE ID = " + id;
                    connection.Open();

                    OleDbDataReader reader = sqlCommand.ExecuteReader();

                    int          index       = 0;
                    RecordSearch returnValue = new RecordSearch()
                    {
                        ID            = reader.GetInt32Safe(index++),
                        ICTypePrefix  = reader.GetStringSafe(index++),
                        ICYear        = reader.GetStringSafe(index++),
                        ICEnumeration = reader.GetInt32Safe(index++),
                        ICSuffix      = reader.GetStringSafe(index++),
                        ProjectName   = reader.GetStringSafe(index++),
                        Status        = reader.GetStringSafe(index++),
                        LastUpdated   = reader.GetDateTimeSafe(index++)
                    };

                    return(returnValue);
                }
            }
        }
Ejemplo n.º 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            switch (model)
            {
            case 1:

                if (operate == 1)
                {
                    if (RecordSearch.IsRecordExists("TcpIPConfig", "IPAddress", tempip, DataType.String))
                    {
                        //刷新
                        Control c1 = panel1.Parent;
                        Control c2 = c1.Controls["ipmain"];
                        panel1.Visible = false;
                        c2.Visible     = true;
                        Control      cc  = c2.Controls[1];
                        Control      cc1 = cc.Controls["splitContainer3"];
                        Control      cc2 = cc1.Controls[0];
                        DataGridView c3  = new DataGridView();
                        c3 = (DataGridView)cc2.Controls["dataGridViewKJ128_ip"];


                        Control      cc5 = cc1.Controls[1];
                        DataGridView c33 = new DataGridView();
                        c33 = (DataGridView)cc5.Controls["dataGridViewKJ128_station"];

                        c3.DataSource  = myipbal.iplist();
                        c33.DataSource = myipbal.Getstationlist();

                        //dataipbind();
                        //datastationbind();
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                    else
                    {
                        if (times < maxTimes)
                        {
                            times++;
                            timer1.Stop();
                            timer1.Start();
                        }
                        else
                        {
                            times = 0;
                            //关闭timer1
                            timer1.Stop();
                        }
                    }
                }
                break;
            }
        }
Ejemplo n.º 4
0
 private void AddEntry(int index, RecordSearch rs)
 {
     table.Rows[index].Cells[1].Range.Text = rs.DateReceived.Value.ToShortDateString();
     table.Rows[index].Cells[2].Range.Text = rs.GetFileNumberFormatted();
     table.Rows[index].Cells[3].Range.Text = rs.ProjectName;
     table.Rows[index].Cells[4].Range.Text = rs.TotalFee.ToString();
     table.Rows[index].Cells[4].Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
     table.Rows[index].Cells[5].Range.Text = rs.CheckNumber;
     table.Rows[index].Cells[5].Range.ParagraphFormat.Alignment   = Word.WdParagraphAlignment.wdAlignParagraphRight;
     table.Rows[index].Cells[5].Range.ParagraphFormat.LineSpacing = 16;
 }
Ejemplo n.º 5
0
        public async Task <IActionResult> Records(RecordSearch record)
        {
            ViewBag.user = HttpContext.User.IsInRole("Admin") ? "" : _user.Users.Where(x => x.Id == ObjectId.Parse(HttpContext.User.Identity.Name)).FirstOrDefault().UserName;

            var dlist = new List <MRecord>();

            if (!ModelState.IsValid)
            {
                ViewBag.mRecord = dlist;
            }
            else
            {
                ClientAccess client = new ClientAccess();
                var          res    = client.GetMedicalRecord(record.data);
                ViewBag.mRecord = await _clientKey.SwatoothRetriveData(res, record.data);
            }
            return(View());
        }
Ejemplo n.º 6
0
        public RecordSearchViewModel(RecordSearch search, IDataNavigator navigator, Action closeAction)
        {
            _Navigator = navigator;
            Search = search;

            Apply = new RelayCommand(() =>
            {
                Search.Apply();
                closeAction();
            });

            Cancel = new RelayCommand(closeAction);

            Clear = new RelayCommand(() =>
            {
                Search.Take = 0;
                _FilterGroups.Clear();
            });
        }
Ejemplo n.º 7
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _isLoaded = false;
            _journal  = navigationContext.NavigationService.Journal;
            int rsID = (int)navigationContext.Parameters["id"];

            if (rsID > 0)
            {
                _rss.GetRecordSearchByID(rsID, true);
                RecordSearch        = _rss.CurrentRecordSearch;
                RecordSearch.Status = RecordSearch.CalculateStatus();

                //Sets the Dropdown menu for requestor and client
                SelectedRequestor = RecordSearch.RequestorID;
                SelectedClient    = RecordSearch.ClientID;

                _isLoaded = true;
                _ea.GetEvent <RSEntryChangedEvent>().Publish();
            }
        }
Ejemplo n.º 8
0
        static RecordSearchViewModelDesign()
        {
            _Search = new RecordSearch(null, typeof(RecordSearchBaseItem))
            {
                IsAdvancedMode = true
            };

            _Search.FilterGroups.Add(new RecordFilterGroup()
            {
                Ordinal = 1
            });

            _Search.FilterGroups[0].Filters.Add(new RecordFilter()
            {
                Comparison = "=",
                Path = "Name",
                Filter = "Sprocket"
            });

            _Search.FilterGroups[0].Filters.Add(new RecordFilter()
            {
                Comparison = "!=",
                Path = "Units",
                Filter = "0"
            });

            _Search.FilterGroups.Add(new RecordFilterGroup()
            {
                Ordinal = 2
            });

            _Search.FilterGroups[1].Filters.Add(new RecordFilter()
            {
                Comparison = "=",
                Path = "Name",
                Filter = "Widget"
            });

            _Search.SortDescriptions.Add(new SortDescription(BindingHelper.Name((RecordSearchBaseItem bi) => bi.Units), ListSortDirection.Descending));
            _Search.Take = 15;
        }
Ejemplo n.º 9
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (address == "" || address == String.Empty)
            {
                return;
            }

            //增加
            if (operated == 1)
            {
                string value = address;

                if (RecordSearch.IsRecordExists("CodeSender_Info", "CodeSenderAddress", value, DataType.Int))
                {
                    //刷新

                    getInfo(1);

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1.Stop();
                        timer1.Start();
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //删除
            else if (operated == 2)
            {
                //string value = dgvCodeSenderInfo.CurrentRow.Cells["发码器编号"].Value.ToString();
                //if (!RecordSearch.IsRecordExists("CodeSender_Info", "CodeSenderAddress", value, DataType.Int))
                //{
                //    //刷新

                //    getInfo(int.Parse(txtPage.CaptionTitle));

                //    times = 0;
                //    //关闭timer1
                //    timer1.Stop();
                //}
                //else
                //{
                //    if (times < maxTimes)
                //    {
                //        times++;
                //        timer1_Tick(sender, e);
                //    }
                //    else
                //    {
                //        times = 0;
                //        //关闭timer1
                //        timer1.Stop();
                //    }
                //}

                if (times < maxTimes)
                {
                    getInfo(int.Parse(txtPage.CaptionTitle));

                    times++;

                    timer1.Interval = 1000;
                    timer1.Stop();
                    timer1.Start();
                }
                else
                {
                    times = 0;

                    timer1.Interval = 400;
                    //关闭timer1
                    timer1.Stop();
                }
            }
            //修改
            else
            {
                string add      = address;
                string strWhere = "CodeSenderStateID=" + cmdAddCodeSenderState.SelectedValue.ToString()
                                  + " and Remark='" + txtAddNewCodeSenderRemark.Text
                                  + "' and CodeSenderAddress=" + add;

                if (RecordSearch.IsRecordExists("CodeSender_Info", strWhere))
                {
                    //刷新

                    getInfo(int.Parse(txtPage.CaptionTitle));

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void timer1_Tick(object sender, EventArgs e)
        {
            switch (model)
            {
            //IP
            case 1:

                if (operate == 2)

                {
                    if (!RecordSearch.IsRecordExists("TcpIPConfig", "ipid", id.ToString(), DataType.Int))
                    {
                        //刷新

                        dataipbind();
                        datastationbind();
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                    else
                    {
                        if (times < maxTimes)
                        {
                            times++;
                            //timer1_Tick(sender, e);
                            timer1.Stop();
                            timer1.Start();
                        }
                        else
                        {
                            times = 0;
                            //关闭timer1
                            timer1.Stop();
                        }
                    }
                }

                break;

            //address
            case 2:

                if (operate == 2)
                {
                    if (!RecordSearch.IsRecordExists("Station_Info", "ipaddressid", statid.ToString(), DataType.Int))
                    {
                        //刷新

                        dataipbind();
                        datastationbind();
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                    else
                    {
                        if (times < maxTimes)
                        {
                            times++;
                            //timer1_Tick(sender, e);
                            timer1.Stop();
                            timer1.Start();
                        }
                        else
                        {
                            times = 0;
                            //关闭timer1
                            timer1.Stop();
                        }
                    }
                }



                break;

            default:
                break;
            }
        }
Ejemplo n.º 11
0
        public RecordSearch GetRecordSearchByID(int id, bool loadAsCurrentSearch = true)
        {
            using (OleDbConnection connection = new OleDbConnection(ConnectionString))
            {
                using (OleDbCommand sqlCommand = connection.CreateCommand())
                {
                    sqlCommand.CommandText = "SELECT ID, ICPrefix, ICYear, ICEnumeration, ICSuffix, " +
                                             "DateReceived, DateEntered, DateOfResponse, DateBilled, DatePaid, LastUpdated, " +
                                             "RequestorID, AdditionalRequestors, ClientID, MailingAddressID, IsMailingAddressSameAsBilling, BillingAddressID, " +
                                             "ProjectName, RecordSearchType, Status, SpecialCaseDetails, " +
                                             "MainCounty, AdditionalCounties, PLSS, Acres, LinearMiles, " +
                                             "AreResourcesInProject, Recommendation, IsReportReceived, Processor, EncryptionPassword, " +
                                             "FeeVersion, FeeID, TotalCost, " +
                                             "ProjectNumber, InvoiceNumber, CheckName, CheckNumber, IsPrePaid, IsSelected, Notes " +
                                             "FROM tblRecordSearches WHERE ID = " + id;
                    connection.Open();

                    OleDbDataReader reader = sqlCommand.ExecuteReader();
                    reader.Read();

                    int          index       = 0;
                    RecordSearch returnValue = new RecordSearch()
                    {
                        ID                     = reader.GetInt32Safe(index++), //0
                        ICTypePrefix           = reader.GetStringSafe(index++),
                        ICYear                 = reader.GetStringSafe(index++),
                        ICEnumeration          = reader.GetInt32Safe(index++),
                        ICSuffix               = reader.GetStringSafe(index++),
                        DateReceived           = reader.GetDateTimeSafe(index++), //5
                        DateEntered            = reader.GetDateTimeSafe(index++),
                        DateOfResponse         = reader.GetDateTimeSafe(index++),
                        DateBilled             = reader.GetDateTimeSafe(index++),
                        DatePaid               = reader.GetDateTimeSafe(index++),
                        LastUpdated            = reader.GetDateTimeSafe(index++), //10
                        RequestorID            = reader.GetInt32Safe(index),
                        Requestor              = _ps.GetPersonByID(reader.GetInt32Safe(index++)),
                        AdditionalRequestors   = reader.GetStringSafe(index++),
                        ClientID               = reader.GetInt32Safe(index),
                        ClientModel            = _cs.GetClientByID(reader.GetInt32Safe(index++)), //15
                        MailingAddress         = _as.GetAddressByID(reader.GetInt32Safe(index++)),
                        IsMailingSameAsBilling = reader.GetBooleanSafe(index++),
                        BillingAddress         = _as.GetAddressByID(reader.GetInt32Safe(index++)),
                        ProjectName            = reader.GetStringSafe(index++),
                        RSType                 = reader.GetStringSafe(index++), //20
                        Status                 = reader.GetStringSafe(index++),
                        SpecialDetails         = reader.GetStringSafe(index++),
                        MainCounty             = reader.GetStringSafe(index++),
                        AdditionalCounties     = ParseAdditionalCounties(reader.GetStringSafe(index++)),
                        PLSS                   = reader.GetStringSafe(index++), //25
                        Acres                  = reader.GetInt32Safe(index++),
                        LinearMiles            = reader.GetInt32Safe(index++),
                        AreResourcesInProject  = reader.GetBooleanSafe(index++),
                        Recommendation         = reader.GetStringSafe(index++),
                        IsReportReceived       = reader.GetBooleanSafe(index++), //30
                        Processor              = reader.GetStringSafe(index++),
                        EncryptionPassword     = reader.GetStringSafe(index++),
                        FeeVersion             = reader.GetStringSafe(index++),
                        FeeID                  = reader.GetInt32Safe(index++),
                        TotalFee               = reader.GetDecimalSafe(index++),
                        ProjectNumber          = reader.GetStringSafe(index++),
                        InvoiceNumber          = reader.GetStringSafe(index++),
                        CheckName              = reader.GetStringSafe(index++),
                        CheckNumber            = reader.GetStringSafe(index++),
                        IsPrePaid              = reader.GetBooleanSafe(index++),
                        IsSelected             = reader.GetBooleanSafe(index++),
                        Notes                  = reader.GetStringSafe(index++),
                    };

                    returnValue.Fee = GetFeeData(returnValue.FeeVersion, returnValue.FeeID);
                    if (returnValue.IsMailingSameAsBilling)
                    {
                        returnValue.BillingAddress = returnValue.MailingAddress;
                    }
                    if (loadAsCurrentSearch)
                    {
                        CurrentRecordSearch = returnValue;
                    }
                    return(returnValue);
                }
            }
        }
Ejemplo n.º 12
0
        public void UpdateRecordSearch(RecordSearch rs)
        {
            using (OleDbConnection connection = new OleDbConnection(ConnectionString))
            {
                using (OleDbCommand sqlCommand = connection.CreateCommand())
                {
                    rs.MailingAddress.AddressID = _as.UpdateAddress(rs.MailingAddress);
                    rs.BillingAddress.AddressID = _as.UpdateAddress(rs.BillingAddress);
                    rs.FeeID      = _fs.UpdateFee(rs.Fee);
                    rs.FeeVersion = rs.Fee.FeeVersion;
                    rs.TotalFee   = rs.Fee.TotalProjectCost;

                    sqlCommand.CommandText = "UPDATE tblRecordSearches SET " +
                                             "ICPrefix = @ICPrefix, ICYear = @ICYear, ICEnumeration = @ICEnumeration, ICSuffix = @ICSuffix," +
                                             "DateReceived = @DateReceived, DateEntered = @DateEntered, DateOfResponse = @DateOfResponse, DateBilled = @DateBilled, DatePaid = @DatePaid, LastUpdated = @LastUpdated, " +
                                             "RequestorID = @RequestorID, AdditionalRequestors = @AdditionalRequestors, ClientID = @ClientID, MailingAddressID = @MailingAddressID, IsMailingAddressSameAsBilling = @IsMailingAddressSameAsBilling, BillingAddressID = @BillingAddressID, " +
                                             "ProjectName = @ProjectName, RecordSearchType = @RecordSearchType, Status = @Status, SpecialCaseDetails = @SpecialCaseDetails, " +
                                             "MainCounty = @MainCounty, AdditionalCounties = @AdditionalCountiesID, PLSS = @PLSS, Acres = @Acres, LinearMiles = @LinearMiles, " +
                                             "AreResourcesInProject = @AreResourcesInProject, Recommendation = @Recommendation, IsReportReceived = @IsReportReceived, Processor = @Processor, EncryptionPassword = @EncryptionPassword, " +
                                             "FeeVersion = @FeeVersion, FeeID = @FeeID, TotalCost = @TotalCost, " +
                                             "ProjectNumber = @ProjectNumber, InvoiceNumber = @InvoiceNumber, CheckName = @CheckName, CheckNumber = @CheckNumber, IsPrePaid = @IsPrePaid, IsSelected = @IsSelected, Notes = @Notes " +
                                             "WHERE ID = ?";
                    sqlCommand.Parameters.AddWithValue("@ICPrefix", rs.ICTypePrefix ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@ICYear", rs.ICYear ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@ICEnumeration", rs.ICEnumeration);
                    sqlCommand.Parameters.AddWithValue("@ICSuffix", rs.ICSuffix ?? Convert.DBNull);

                    sqlCommand.Parameters.AddWithValue("@DateReceived", rs.DateReceived ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@DateEntered", rs.DateEntered ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@DateOfResponse", rs.DateOfResponse ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@DateBilled", rs.DateBilled ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@DatePaid", rs.DatePaid ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@LastUpdated", rs.LastUpdated ?? Convert.DBNull);

                    sqlCommand.Parameters.AddWithValue("@RequestorID", rs.RequestorID);
                    sqlCommand.Parameters.AddWithValue("@AdditionalRequestors", rs.AdditionalRequestors ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@ClientID", rs.ClientID);
                    sqlCommand.Parameters.AddWithValue("@MailingAddressID", rs.MailingAddress.AddressID);
                    sqlCommand.Parameters.AddWithValue("@IsMailingAddressSameAsBilling", rs.IsMailingSameAsBilling);
                    sqlCommand.Parameters.AddWithValue("@BillingAddressID", rs.BillingAddress.AddressID);

                    sqlCommand.Parameters.AddWithValue("@ProjectName", rs.ProjectName ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@RecordSearchType", rs.RSType ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@Status", rs.Status ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@SpecialCaseDetails", rs.SpecialDetails ?? Convert.DBNull);

                    sqlCommand.Parameters.AddWithValue("@MainCounty", rs.MainCounty ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@AdditionalCounties", WriteAdditionalCounties(rs.AdditionalCounties));
                    sqlCommand.Parameters.AddWithValue("@PLSS", rs.PLSS ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@Acres", rs.Acres);
                    sqlCommand.Parameters.AddWithValue("@LinearMiles", rs.LinearMiles);

                    sqlCommand.Parameters.AddWithValue("@AreResourcesInProject", rs.AreResourcesInProject);
                    sqlCommand.Parameters.AddWithValue("@Recommendation", rs.Recommendation ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@IsReportReceived", rs.IsReportReceived);
                    sqlCommand.Parameters.AddWithValue("@Processor", rs.Processor ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@EncryptionPassword", rs.EncryptionPassword ?? Convert.DBNull);

                    sqlCommand.Parameters.AddWithValue("@FeeVersion", rs.FeeVersion ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@FeeID", rs.FeeID);
                    sqlCommand.Parameters.AddWithValue("@TotalCost", rs.TotalFee);

                    sqlCommand.Parameters.AddWithValue("@ProjectNumber", rs.ProjectNumber ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@InvoiceNumber", rs.InvoiceNumber ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@CheckName", rs.CheckName ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@CheckNumber", rs.CheckNumber ?? Convert.DBNull);
                    sqlCommand.Parameters.AddWithValue("@IsPrePaid", rs.IsPrePaid);
                    sqlCommand.Parameters.AddWithValue("@IsSelected", rs.IsSelected);
                    sqlCommand.Parameters.AddWithValue("@Notes", rs.Notes ?? Convert.DBNull);

                    sqlCommand.Parameters.AddWithValue("ID", rs.ID);

                    connection.Open();
                    sqlCommand.ExecuteNonQuery();
                }
            }
        }
Ejemplo n.º 13
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (operated == 1)
            {
                if (RecordSearch.IsRecordExists("Path_Info", "PathNo", pathnum, DataType.String))
                {
                    //刷新

                    InitializeTreeView("");

                    InitializeGridView("");

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            else
            {
                string value = dgvMain.CurrentRow.Cells["PathNo"].Value.ToString();

                if (!RecordSearch.IsRecordExists("Path_Info", "PathNo", value, DataType.String))
                {
                    //刷新

                    InitializeTreeView("");

                    InitializeGridView("");

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 14
0
        private void AddEntry(RecordSearch record)
        {
            //Date
            Word.Paragraph dateHeader = document.Content.Paragraphs.Add(ref missing);
            dateHeader.Range.Paragraphs.SpaceAfter = 0;
            try
            {
                dateHeader.Range.Text = record.DateOfResponse.ToDateString() + "\n";
            }
            catch
            {
                dateHeader.Range.Text       = "Missing date of response.";
                dateHeader.Range.Font.Bold  = 1;
                dateHeader.Range.Font.Color = Word.WdColor.wdColorDarkRed;
                _errorCount++;
            }
            dateHeader.Range.InsertParagraphAfter();


            //Address, PEID, & Invoice #
            Word.Table iTable = document.Tables.Add(dateHeader.Range, 1, 3, ref missing, ref missing);
            iTable.AllowAutoFit = true;
            iTable.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitWindow);
            iTable.Columns[1].PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPercent;
            iTable.Columns[1].PreferredWidth     = 40;
            iTable.Columns[2].PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPercent;
            iTable.Columns[2].PreferredWidth     = 30;

            //--Address
            if (record.BillingAddress.ValidateMinimalCompleteness())
            {
                if (string.IsNullOrWhiteSpace(record.BillingAddress.AddressLine2))
                {
                    iTable.Rows[1].Cells[1].Range.Text = string.Format("{0}\r\n{1}\r\n{2}, {3} {4}",
                                                                       record.BillingAddress.AddressName, record.BillingAddress.AddressLine1, record.BillingAddress.City, record.BillingAddress.State, record.BillingAddress.ZIP);
                }
                else
                {
                    iTable.Rows[1].Cells[1].Range.Text = string.Format("{0}\r\n{1}\r\n{2}\r\n{3}, {4} {5}",
                                                                       record.BillingAddress.AddressName, record.BillingAddress.AddressLine1, record.BillingAddress.AddressLine2, record.BillingAddress.City, record.BillingAddress.State, record.BillingAddress.ZIP);
                }
            }
            else
            {
                iTable.Rows[1].Cells[1].Range.Text       = "Missing billing address information.";
                iTable.Rows[1].Cells[1].Range.Font.Bold  = 1;
                iTable.Rows[1].Cells[1].Range.Font.Color = Word.WdColor.wdColorDarkRed;
                _errorCount++;
            }

            //--PEID
            if (!string.IsNullOrWhiteSpace(record.ClientModel.NewPEID))
            {
                iTable.Rows[1].Cells[2].Range.Text = string.Format("PEID # " + record.ClientModel.NewPEID);
            }
            else if (!string.IsNullOrWhiteSpace(record.ClientModel.OldPEID))
            {
                iTable.Rows[1].Cells[2].Range.Text = string.Format("PEID # " + record.ClientModel.OldPEID);
            }
            else
            {
                iTable.Rows[1].Cells[2].Range.Text       = "Missing PEID.";
                iTable.Rows[1].Cells[2].Range.Font.Bold  = 1;
                iTable.Rows[1].Cells[2].Range.Font.Color = Word.WdColor.wdColorDarkRed;
                _errorCount++;
            }
            iTable.Rows[1].Cells[2].Range.Bold = 1;
            iTable.Rows[1].Cells[2].Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;


            //--Invoice #
            iTable.Rows[1].Cells[3].Range.Text = "Invoice #";
            iTable.Rows[1].Cells[3].Range.Bold = 1;
            iTable.Range.InsertParagraphAfter();


            //Person, Project Name, Requestor, IC File #
            Word.Paragraph projectInfo = document.Content.Paragraphs.Add(ref missing);

            string attentionTo;

            if (string.IsNullOrWhiteSpace(record.BillingAddress.AttentionTo))
            {
                attentionTo = "";
            }
            else
            {
                attentionTo = "\r\nATTN: " + record.BillingAddress.AttentionTo;
            }
            string fileNumber = "IC File # " + record.GetFileNumberFormatted();

            if (string.IsNullOrWhiteSpace(record.Requestor.FirstName))
            {
                projectInfo.Range.Text = string.Format("{0}\r\n>>\r\nRE: {1}; {2}\r\n>>",
                                                       attentionTo, record.ProjectName, fileNumber);
            }
            else
            {
                projectInfo.Range.Text = string.Format("{0}\r\n>>\r\nRE: {1} (Requested By: {2} {3}); {4}\r\n>>",
                                                       attentionTo, record.ProjectName, record.Requestor.FirstName, record.Requestor.LastName, fileNumber);
            }

            object startRange = projectInfo.Range.End - (fileNumber.Length + 4);
            object endRange   = projectInfo.Range.End - 3;

            Word.Range toBold = document.Range(ref startRange, ref endRange);
            toBold.Bold = 1;
            projectInfo.Range.InsertParagraphAfter();


            //Billing Info
            Word.Table bTable = document.Content.Tables.Add(projectInfo.Range, 1, 2, ref missing);
            bTable.AllowAutoFit = true;
            bTable.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitWindow);
            bTable.Columns[1].PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPercent;
            bTable.Columns[1].PreferredWidth     = 25;

            //--Total
            try
            {
                bTable.Rows[1].Cells[1].Range.Text = "Amount Due: $" + record.Fee.TotalProjectCost;
            }
            catch
            {
                bTable.Rows[1].Cells[1].Range.Text       = "Missing PEID.";
                bTable.Rows[1].Cells[1].Range.Font.Bold  = 1;
                bTable.Rows[1].Cells[1].Range.Font.Color = Word.WdColor.wdColorDarkRed;
                _errorCount++;
            }

            //--Fees & Surcharge
            string  chargeInformation = "";
            decimal runningTotal      = 0;

            foreach (ICharge charge in record.Fee.Charges)
            {
                if (charge.TotalCost <= 0)
                {
                    continue;
                }
                switch (charge.Type)
                {
                case "variable":
                    VariableCharge vCharge = (VariableCharge)charge;
                    chargeInformation += string.Format("  {0} - {1} {2} @ ${3} per {4}\n",
                                                       vCharge.Name, vCharge.Count, vCharge.UnitNamePlural, vCharge.Cost, vCharge.UnitName);
                    runningTotal += vCharge.TotalCost;
                    break;

                case "boolean":
                    BooleanCharge bCharge = (BooleanCharge)charge;
                    chargeInformation += string.Format("  {0} - ${1}\n", bCharge.Name, bCharge.TotalCost);
                    runningTotal      += bCharge.TotalCost;
                    break;

                case "categorical":
                    CategoricalCharge cCharge = (CategoricalCharge)charge;
                    chargeInformation += string.Format("  {0} - {1} {2} - ${3}\n", cCharge.Name, cCharge.Count, cCharge.UnitNamePlural, cCharge.TotalCost);
                    runningTotal      += cCharge.TotalCost;
                    break;

                default:
                    break;
                }
            }

            string surcharge = "";

            if (record.Fee.IsPriority)
            {
                surcharge += "  Priority Surcharge Fee: $" + (record.Fee.TotalProjectCost - runningTotal) + "\n";
            }
            if (record.Fee.IsEmergency)
            {
                surcharge += "  Emergency Surcharge Fee: $" + record.Fee.TotalProjectCost + "\n";
            }

            bTable.Rows[1].Cells[2].Range.Text = "Information\n" + chargeInformation + surcharge + "Please include the invoice number on your remittance";
            bTable.Range.InsertParagraphAfter();

            //Finish with line
            InsertLine();
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (operated == 1)
            {
                // 构造方向性
                string tmpd1 = lblFromStation.Tag.ToString() + "," + lblFromHead.Tag.ToString();
                string tmpd2 = lblToStation.Tag.ToString() + "," + lblToHead.Tag.ToString();

                string value = tmpd1 + ":" + tmpd2;

                if (RecordSearch.IsRecordExists("CodeSender_DirectionalAntenna", "DetectionInfo", value, DataType.String))
                {
                    //刷新

                    getInfo(int.Parse(txtPage.CaptionTitle), "");

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            else if (operated == 2)
            {
                if (strDelete != string.Empty)
                {
                    string value = strDelete; //dgvData.CurrentRow.Cells["标识"].Value.ToString();

                    if (!RecordSearch.IsRecordExists("CodeSender_DirectionalAntenna", "CodeSenderDirlID", value, DataType.String))
                    {
                        //刷新

                        getInfo(int.Parse(txtPage.CaptionTitle), "");

                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                    else
                    {
                        if (times < maxTimes)
                        {
                            times++;
                            timer1_Tick(sender, e);
                        }
                        else
                        {
                            times = 0;
                            //关闭timer1
                            timer1.Stop();
                        }
                    }
                }
            }
            else
            {
                string strWhere = "CodeSenderDirlID='" + vsPanel.Tag + "'"
                                  + " and Directional='" + txtUpdateD.Text + "'";

                if (RecordSearch.IsRecordExists("CodeSender_DirectionalAntenna", strWhere))
                {
                    //刷新

                    getInfo(int.Parse(txtPage.CaptionTitle), "");

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        // timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //增加
            if (operated == 1)
            {
                string value = ddlAdd.SelectedValue.ToString();

                if (RecordSearch.IsRecordExists("UnitPrice", "DeptID", value, DataType.Int))
                {
                    //刷新

                    BindDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1.Stop();
                        timer1.Start();
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //删除
            else if (operated == 2)
            {
                string value = dgrd.CurrentRow.Cells[2].Value.ToString();

                if (!RecordSearch.IsRecordExists("UnitPrice", "DeptID", value, DataType.Int))
                {
                    //刷新

                    BindDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1.Stop();
                        timer1.Start();
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //修改
            else
            {
                string strWhere = "DeptID=" + ddlAdd.SelectedValue.ToString()
                                  + "and UnitPrice=" + txtUnit.Text
                                  + " and Remark ='" + txtRemark.Text + "'";

                if (RecordSearch.IsRecordExists("UnitPrice", strWhere))
                {
                    //刷新
                    BindDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1.Stop();
                        timer1.Start();
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 17
0
        private void buttonCaptionPanel_save_Click(object sender, EventArgs e)
        {
            if (label4.Text.Length > 0)
            {
                #region 修改
                //添加前先验证
                string ip      = textBox_ip.Text.Trim();
                string port    = textBox_ipport.Text.Trim();
                string address = textBox_azwz.Text.Trim();
                if (checkaddress(address))
                {
                }
                else
                {
                    MessageBox.Show("安装位置格式不正确,请重新输入", "安装位置格式", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
                if (ip.Length > 0)
                {
                    if (!checkIpAddress(ip))
                    {
                        MessageBox.Show("IP地址不正确,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("IP不能为空,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!Check())
                {
                    return;
                }

                if (RecordSearch.IsRecordExists("TcpIPConfig", "IPAddress", ip, DataType.String))
                {
                    MessageBox.Show("IP不能为重复,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                tempip = textBox_ip.Text.Trim();
                int i = myipbal.updateip(ip, port, address, Convert.ToInt32(label4.Text));
                if (i == 1)
                {
                    MessageBox.Show("修改成功", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("修改失败", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                #endregion
            }
            else
            {
                #region 添加IP
                //添加前先验证
                string ip      = textBox_ip.Text.Trim();
                string port    = textBox_ipport.Text.Trim();
                string address = textBox_azwz.Text.Trim();
                if (checkaddress(address))
                {
                }
                else
                {
                    MessageBox.Show("安装位置格式不正确,请重新输入", "安装位置格式", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
                if (ip.Length > 0)
                {
                    if (!checkIpAddress(ip))
                    {
                        MessageBox.Show("IP地址不正确,请重新输入," + "\r\n" + " 输入格式:192.168.1.1", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("IP不能为空,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!Check())
                {
                    return;
                }
                if (RecordSearch.IsRecordExists("TcpIPConfig", "IPAddress", ip, DataType.String))
                {
                    MessageBox.Show("IP不能为重复,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }


                int i = myipbal.addip(ip, port, address);
                if (i == 1)
                {
                    tempip = textBox_ip.Text.Trim();
                    MessageBox.Show("添加成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //清空内容
                    textBox_ip.Text     = "";
                    textBox_ipport.Text = "";
                    textBox_azwz.Text   = "";
                }
                else
                {
                    MessageBox.Show("添加失败", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                #endregion
            }
        }
Ejemplo n.º 18
0
        private void bCPl_save_Click(object sender, EventArgs e)
        {
            if (m_type == 0)//新增环网IP地址
            {
                if (!Check())
                {
                    return;
                }
                string ipid      = comboBox_ip.SelectedValue.ToString();
                string stationid = comboBox_station.SelectedValue.ToString();

                if (RecordSearch.IsRecordExists("station_info", "IPAddressID <>0 and stationid=" + stationid))
                {
                    SetShowInfo("该传输分站已配置进环网", Color.Red);
                    return;
                }

                int i = myipbal.updatestation(Convert.ToInt32(stationid), Convert.ToInt32(ipid));
                if (i == 1)
                {
                    SetShowInfo("添加成功", Color.Black);
                    frmipadd.Save = true;

                    //Czlt-2011-12-10 修改时间
                    myipbal.UpdateTime();

                    //刷新
                    if (!New_DBAcess.IsDouble)          //单机版,直接刷新
                    {
                        frmipadd.BindGirdview();
                        frmipadd.LoadTcpTree();
                    }
                    else                                //热备版,启用定时器
                    {
                        frmipadd.HostBackRefresh(true);
                    }
                    #region [保存环网信息]
                    //Czlt-2012-3-28 热备配置文件
                    ConfigXmlWiter.Write("TCPIP.xml");
                    //Czlt-2012-3-28 刷新分站列表
                    DataTable dt = myipbal.GetTcpIpConfig();
                    frmipadd.ReplaceNetXml(dt, Application.StartupPath + "\\TcpServer.xml");
                    dt = frmipadd.GetStationTable();
                    frmipadd.ReplaceStationXml(dt, Application.StartupPath + "\\Station.xml");
                    #endregion
                }
                else
                {
                    SetShowInfo("添加失败", Color.Black);
                }
            }
            else//修改环网IP地址
            {
                if (!Check())
                {
                    return;
                }

                string ipid      = comboBox_ip.SelectedValue.ToString();
                string stationid = comboBox_station.SelectedValue.ToString();

                int i = myipbal.updatestation(Convert.ToInt32(stationid), Convert.ToInt32(ipid));
                if (i == 1)
                {
                    SetShowInfo("修改成功", Color.Black);
                    frmipadd.Save = true;

                    //Czlt-2011-12-10 修改时间
                    myipbal.UpdateTime();

                    if (!New_DBAcess.IsDouble)          //单机版,直接刷新
                    {
                        frmipadd.BindGirdview();
                        frmipadd.LoadTcpTree();
                    }
                    else                                //热备版,启用定时器
                    {
                        frmipadd.HostBackRefresh(true);
                    }
                    #region [保存环网信息]
                    //Czlt-2012-3-28 热备配置文件
                    ConfigXmlWiter.Write("TCPIP.xml");
                    //Czlt-2012-3-28 刷新分站列表
                    DataTable dt = myipbal.GetTcpIpConfig();
                    frmipadd.ReplaceNetXml(dt, Application.StartupPath + "\\TcpServer.xml");
                    dt = frmipadd.GetStationTable();
                    frmipadd.ReplaceStationXml(dt, Application.StartupPath + "\\Station.xml");
                    #endregion
                }
                else
                {
                    SetShowInfo("修改失败", Color.Red);
                }
            }
        }
Ejemplo n.º 19
0
        private void buttonCaptionPanel_save_Click(object sender, EventArgs e)
        {
            if (m_type == 0)//新增环网IP地址
            {
                if (!Check())
                {
                    return;
                }
                if (RecordSearch.IsRecordExists("TcpIPConfig", "IPAddress ='" + textBox_ip.Text.Trim() + "'"))
                {
                    SetShowInfo("IP不能为重复,请重新输入", Color.Red);
                    return;
                }

                int i = myipbal.addip(textBox_ip.Text.Trim(), textBox_ipport.Text.Trim(), textBox_azwz.Text.Trim());
                if (i == 1)
                {
                    SetShowInfo("添加成功", Color.Black);
                    frmipadd.Save = true;
                    //刷新
                    if (!New_DBAcess.IsDouble)          //单机版,直接刷新
                    {
                        frmipadd.BindGirdview();
                        frmipadd.LoadTcpTree();
                    }
                    else                                //热备版,启用定时器
                    {
                        frmipadd.HostBackRefresh(true);
                    }
                    #region [保存环网信息]
                    DataTable dt = myipbal.GetTcpIpConfig();
                    frmipadd.ReplaceNetXml(dt, Application.StartupPath + "\\TcpServer.xml");
                    dt = frmipadd.GetStationTable();
                    frmipadd.ReplaceStationXml(dt, Application.StartupPath + "\\Station.xml");
                    #endregion
                }
                else
                {
                    SetShowInfo("添加失败", Color.Black);
                }
            }
            else//修改环网IP地址
            {
                string ip      = textBox_ip.Text.Trim();
                string port    = textBox_ipport.Text.Trim();
                string address = textBox_azwz.Text.Trim();

                if (!Check())
                {
                    return;
                }
                if (RecordSearch.IsRecordExists("TcpIPConfig", "ipid<>" + ipid + " and ipaddress='" + textBox_ip.Text.Trim() + "'"))
                {
                    SetShowInfo("IP不能为重复,请重新输入", Color.Red);
                    return;
                }
                int i = myipbal.updateip(ip, port, address, int.Parse(ipid));
                if (i == 1)
                {
                    SetShowInfo("修改成功", Color.Black);
                    frmipadd.Save = true;
                    if (!New_DBAcess.IsDouble)          //单机版,直接刷新
                    {
                        frmipadd.BindGirdview();
                        frmipadd.LoadTcpTree();
                    }
                    else                                //热备版,启用定时器
                    {
                        frmipadd.HostBackRefresh(true);
                    }
                    #region [保存环网信息]
                    DataTable dt = myipbal.GetTcpIpConfig();
                    frmipadd.ReplaceNetXml(dt, Application.StartupPath + "\\TcpServer.xml");
                    dt = frmipadd.GetStationTable();
                    frmipadd.ReplaceStationXml(dt, Application.StartupPath + "\\Station.xml");
                    #endregion
                }
                else
                {
                    SetShowInfo("修改失败", Color.Red);
                }
            }
        }
Ejemplo n.º 20
0
        public bool RecordSearchViewFilter(object filterable)
        {
            RecordSearch recordSearch = filterable as RecordSearch;

            if (recordSearch == null)
            {
                return(false);
            }

            int passedTests = 0;

            if (ProjectNameSearchText != null)
            {
                if (recordSearch.ProjectName.ToLower().Contains(ProjectNameSearchText.ToLower()))
                {
                    passedTests++;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                passedTests++;
            }

            if (RSIDPrefixSearch != null)
            {
                if (recordSearch.ICTypePrefix.ToUpper() == RSIDPrefixSearch)
                {
                    passedTests++;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                passedTests++;
            }

            if (RSIDYearSearch != null)
            {
                if (recordSearch.ICYear.ToLower().Contains(RSIDYearSearch))
                {
                    passedTests++;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                passedTests++;
            }

            if (RSIDEnumerationSearch != null)
            {
                if (recordSearch.ICEnumeration.ToString().Contains(RSIDEnumerationSearch))
                {
                    passedTests++;
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                passedTests++;
            }

            return(passedTests >= 4);
        }
Ejemplo n.º 21
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //增加
            if (operated == 1)
            {
                if (RecordSearch.IsRecordExists("Admins", "Account", txtUser.Text, DataType.String))
                {
                    //刷新

                    adminInfo_Load(null, null);

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //删除
            else if (operated == 2)
            {
                string value = dtgAccount1.CurrentRow.Cells["ids"].Value.ToString();
                if (!RecordSearch.IsRecordExists("Admins", "ID", value, DataType.Int))
                {
                    //刷新

                    adminInfo_Load(null, null);

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //修改
            else
            {
                string strPassWord = MD5.GetPassword16(txtPassword1.Text.Trim());

                string strWhere = "Account='" + txtUserName.Text
                                  + "' and Password='******' and Remark='" + txtRemark1.Text
                                  + "'";

                if (RecordSearch.IsRecordExists("Admins", strWhere))
                {
                    //刷新

                    adminInfo_Load(null, null);

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 22
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //增加
            if (operated == 1)
            {
                timer1.Interval = 400;

                string strWhere = "PathNo='" + tbPathNo.Text
                                  + "' and EmpNo='" + cbEmp.SelectedValue.ToString() + "'";

                if (RecordSearch.IsRecordExists("Path_Emp_Relation", strWhere))
                {
                    //刷新

                    InitialzeDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //删除
            else if (operated == 2)
            {
                timer1.Interval = 1000;

                string value = dgvMain.CurrentRow.Cells["Id"].Value.ToString();
                if (!RecordSearch.IsRecordExists("Path_Emp_Relation", "Id", value, DataType.String))
                {
                    //刷新

                    InitialzeDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
            //修改
            else
            {
                timer1.Interval = 400;

                string ID       = dgvMain.CurrentRow.Cells["Id"].Value.ToString();
                string strWhere = "PathNo='" + tbPathNo.Text
                                  + "' and EmpNo='" + cbEmp.SelectedValue.ToString()
                                  + "' and Id=" + ID;

                if (RecordSearch.IsRecordExists("Path_Emp_Relation", strWhere))
                {
                    //刷新

                    InitialzeDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1_Tick(sender, e);
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 23
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //增加
            if (operated == 1)
            {
                timer1.Interval = 400;

                //刷最大次数(两次)
                if (times < maxTimes)
                {
                    times++;

                    //刷新
                    InitialzeDataGridView();
                }
                else
                {
                    times = 0;
                    timer1.Stop();
                }
            }
            //删除
            else if (operated == 2)
            {
                if (times < maxTimes)
                {
                    timer1.Interval = 1000;
                    times++;

                    InitialzeDataGridView();

                    timer1.Stop();

                    timer1.Start();
                }
                else
                {
                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
            }
            //修改
            else
            {
                timer1.Interval = 400;

                string ID       = dgvMain.CurrentRow.Cells["Id"].Value.ToString();
                string strWhere = "PathNo='" + tbPathNum.Text
                                  + "' and StationAddress=" + cbstation.SelectedValue.ToString()
                                  + " and StationHeadAddress=" + cbPiont.SelectedValue.ToString()
                                  + " and Id=" + ID;

                if (RecordSearch.IsRecordExists("Path_Detail", strWhere))
                {
                    //刷新

                    InitialzeDataGridView();

                    times = 0;
                    //关闭timer1
                    timer1.Stop();
                }
                else
                {
                    if (times < maxTimes)
                    {
                        times++;
                        timer1.Stop();
                        timer1.Start();
                    }
                    else
                    {
                        times = 0;
                        //关闭timer1
                        timer1.Stop();
                    }
                }
            }
        }
Ejemplo n.º 24
0
        private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            RecordSearch selectedRS = (RecordSearch)RSListBox.SelectedItem;

            _ea.GetEvent <RecordSearchListSelectEvent>().Publish(selectedRS.ID);
        }
Ejemplo n.º 25
0
        private void buttonCaptionPanel2_Click(object sender, EventArgs e)
        {
            if (label4.Text.Length > 0)
            {
                #region 修改
                //添加前先验证
                string ip      = textBox_ip.Text.Trim();
                string port    = textBox_ipport.Text.Trim();
                string address = textBox_azwz.Text.Trim();
                if (checkaddress(address))
                {
                }
                else
                {
                    MessageBox.Show("安装位置格式不正确,请重新输入", "安装位置格式", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
                if (ip.Length > 0)
                {
                    if (!checkIpAddress(ip))
                    {
                        MessageBox.Show("IP地址不正确,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("IP不能为空,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!Check())
                {
                    return;
                }
                if (RecordSearch.IsRecordExists("TcpIPConfig", "IPAddress", ip, DataType.String))
                {
                    MessageBox.Show("IP不能为重复,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                tempip = textBox_ip.Text.Trim();
                int i = myipbal.updateip(ip, port, address, Convert.ToInt32(label4.Text));
                if (i == 1)
                {
                    MessageBox.Show("修改成功", "修改成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Control c1 = panel1.Parent;
                    Control c2 = c1.Controls["ipmain"];
                    panel1.Visible = false;
                    c2.Visible     = true;
                    Control      cc  = c2.Controls[1];
                    Control      cc1 = cc.Controls["splitContainer3"];
                    Control      cc2 = cc1.Controls[0];
                    DataGridView c3  = new DataGridView();
                    c3 = (DataGridView)cc2.Controls["dataGridViewKJ128_ip"];


                    Control      cc5 = cc1.Controls[1];
                    DataGridView c33 = new DataGridView();
                    c33 = (DataGridView)cc5.Controls["dataGridViewKJ128_station"];
                    if (tempip != null)
                    {
                        if (tempip.Length > 0)
                        {
                            if (!New_DBAcess.IsDouble)
                            {
                                c3.DataSource  = myipbal.iplist();
                                c33.DataSource = myipbal.Getstationlist();
                            }
                            else
                            {
                                //model = 1;
                                //operate = 1;

                                //timer1.Start();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("修改失败", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                #endregion
            }
            else
            {
                #region 添加IP
                //添加前先验证
                string ip      = textBox_ip.Text.Trim();
                string port    = textBox_ipport.Text.Trim();
                string address = textBox_azwz.Text.Trim();
                if (checkaddress(address))
                {
                }
                else
                {
                    MessageBox.Show("安装位置格式不正确,请重新输入", "安装位置格式", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
                if (ip.Length > 0)
                {
                    if (!checkIpAddress(ip))
                    {
                        MessageBox.Show("IP地址不正确,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("IP不能为空,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!Check())
                {
                    return;
                }
                if (RecordSearch.IsRecordExists("TcpIPConfig", "IPAddress", ip, DataType.String))
                {
                    MessageBox.Show("IP不能为重复,请重新输入", "IP地址", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                int i = myipbal.addip(ip, port, address);
                tempip = textBox_ip.Text.Trim();
                if (i == 1)
                {
                    MessageBox.Show("添加成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //Control c1 = panel1.Parent;
                    //Control c2 = c1.Controls["ipmain"];
                    //panel1.Visible = false;
                    //c2.Visible = true;
                    //Control cc = c2.Controls[1];
                    //Control cc1 = cc.Controls["splitContainer3"];
                    //Control cc2 = cc1.Controls[0];
                    //DataGridView c3 = new DataGridView();
                    //c3 = (DataGridView)cc2.Controls["dataGridViewKJ128_ip"];


                    //Control cc5 = cc1.Controls[1];
                    //DataGridView c33 = new DataGridView();
                    //c33 = (DataGridView)cc5.Controls["dataGridViewKJ128_station"];
                    //if (tempip != null)
                    //{
                    //    if (tempip.Length > 0)
                    //    {
                    //        if (!New_DBAcess.IsDouble)
                    //        {
                    //            c3.DataSource = myipbal.iplist();
                    //            c33.DataSource = myipbal.Getstationlist();
                    //        }
                    //        else
                    //        {

                    //            model = 1;
                    //            operate = 1;

                    //            timer1.Start();

                    //        }
                    //    }
                    //}
                }
                else
                {
                    MessageBox.Show("添加失败", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                #endregion
            }
        }