Ejemplo n.º 1
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitDataGridView(object sender, EventArgs_DataManager e)
        {
            this.myEventArgs_DataManager = e;
            if (!this.checkBox_All.Checked && string.IsNullOrEmpty(this.myEventArgs_DataManager.str_Filter))
            {
                this.myEventArgs_DataManager.str_Filter = "1=0";
            }
            Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, this.myEventArgs_DataManager.str_DataManagerTag, false);
            Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[this.myEventArgs_DataManager.str_DataManagerName];

            if (this.myEventArgs_DataManager.str_DataManagerName == Enum_DataTable.WelderIssueStudentQCRegistrationNo.ToString())
            {
                int i_SupervisionOffset = Class_ExamField.SupervisionOffset + 1;
                if (string.IsNullOrEmpty(this.myEventArgs_DataManager.str_Filter))
                {
                    //e.str_Filter = string.Format("CertificateNo is Not Null And ValidUntil>'{0}' And isQCValid=1",DateTime.Today);
                    e.str_Filter  = string.Format("ValidUntil>'{0}' And isQCValid=1 and (", DateTime.Today);
                    e.str_Filter += string.Format(" (SupervisionFirst=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=1) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionSecond=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=2) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionThird=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=3) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionFourth=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=4) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionFifth=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=5) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionSixth=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=6) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionSeventh=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=7) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or ((SupervisionSeventh=1 or SupervisionEighth=1) and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=8) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or ((IssuedOnMonth - SupervisionCycle*48 - {0})/6=0) ", i_SupervisionOffset);
                    e.str_Filter += ")";
                }
                else
                {
                    //e.str_Filter = string.Format("({0}) And CertificateNo is Not Null And ValidUntil>'{1}' And isQCValid=1", this.myEventArgs_DataManager.str_Filter, DateTime.Today);
                    e.str_Filter  = string.Format("({0}) And ValidUntil>'{1}' And isQCValid=1 and (", this.myEventArgs_DataManager.str_Filter, DateTime.Today);
                    e.str_Filter += string.Format(" (SupervisionFirst=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=1) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionSecond=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=2) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionThird=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=3) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionFourth=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=4) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionFifth=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=5) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionSixth=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=6) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or (SupervisionSeventh=1 and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=7) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or ((SupervisionSeventh=1 or SupervisionEighth=1) and (IssuedOnMonth - SupervisionCycle*48 - {0})/6=8) ", i_SupervisionOffset);
                    e.str_Filter += string.Format(" or ((IssuedOnMonth - SupervisionCycle*48 - {0})/6=0) ", i_SupervisionOffset);
                    e.str_Filter += ")";
                }
            }
            myClass_Data.SetFilter(this.myEventArgs_DataManager.str_Filter);
            myClass_Data.RefreshData(false);
            this.dataGridView_Data.DataSource = new DataView(myClass_Data.myDataTable.Copy());
            ((DataView)this.dataGridView_Data.DataSource).Sort = myClass_Data.myDataView.Sort;
            this.label_Data.Text = string.Format("{0},({1}):", this.myEventArgs_DataManager.str_DataManagerText, this.dataGridView_Data.RowCount);
        }
Ejemplo n.º 2
0
        private void button_Query_Click(object sender, EventArgs e)
        {
            if (this.dataGridView_Data.Tag == null)
            {
                return;
            }
            Form_QueryFilter myForm = new Form_QueryFilter();

            myForm.InitControl(this.dataGridView_Data.Tag.ToString());
            if (myForm.ShowDialog() == DialogResult.OK)
            {
                EventArgs_DataManager my_e = new EventArgs_DataManager(this.myEventArgs_DataManager.str_DataManagerText, this.myEventArgs_DataManager.str_DataManagerName, this.myEventArgs_DataManager.str_DataManagerTag);
                my_e.str_Filter = myForm.str_Filter;
                Publisher_DataManager.OnEventName(my_e);
            }
        }
Ejemplo n.º 3
0
        private void toolStripMenuItem_RowAddByExcel_Click(object sender, EventArgs e)
        {
            DataTable myDataTable = Class_DataControlBind.ImportExcelToDataTable();

            if (myDataTable != null)
            {
                StringBuilder myStringBuilder = new StringBuilder();
                if (myDataTable.Columns.Contains("CertificateNo"))
                {
                    DataRow[] myDataRow_Range;
                    myDataRow_Range = myDataTable.Select("len(CertificateNo)>0");
                    myStringBuilder.Append("1=0");
                    foreach (DataRow myDataRow in myDataRow_Range)
                    {
                        myStringBuilder.Append(string.Format(" Or CertificateNo='{0}'", myDataRow["CertificateNo"].ToString()));
                    }
                }
                else if (myDataTable.Columns.Contains("ExaminingNo"))
                {
                    DataRow[] myDataRow_Range;
                    myDataRow_Range = myDataTable.Select("len(ExaminingNo)>0");
                    myStringBuilder.Append("1=0");
                    foreach (DataRow myDataRow in myDataRow_Range)
                    {
                        myStringBuilder.Append(string.Format(" Or ExaminingNo='{0}'", myDataRow["ExaminingNo"].ToString()));
                    }
                }
                else
                {
                    MessageBox.Show("数据表中不存在 'CertificateNo'或'ExaminingNo' 列!");
                    return;
                }
                EventArgs_DataManager my_e = new EventArgs_DataManager(this.myEventArgs_DataManager.str_DataManagerText, this.myEventArgs_DataManager.str_DataManagerName, this.myEventArgs_DataManager.str_DataManagerTag);
                my_e.str_Filter = myStringBuilder.ToString();
                Publisher_DataManager.OnEventName(my_e);
            }
        }
        private void treeView_Data_AfterSelect(object sender, TreeViewEventArgs e)
        {
            EventArgs_DataManager my_e = new EventArgs_DataManager((string)this.treeView_Data.SelectedNode.Text, this.treeView_Data.SelectedNode.Name, this.treeView_Data.SelectedNode.Tag.ToString());

            Publisher_DataManager.OnEventName(my_e);
        }