示例#1
0
        private void Compaire()
        {
            helper.InitTA_PTable();

            DataSet.DBDataSetTableAdapters.TA_CompaireDiffrenceTableAdapter cdTA = new DataSet.DBDataSetTableAdapters.TA_CompaireDiffrenceTableAdapter();
            cdTA.Connection = GTSAppSettings.SQLConnection;
            for (int k = 0; k < calObjectList.Count; k++)
            {
                CalcObject objcet = calObjectList[k];

                DBDataSet.TA_PTableUsableColumnsDataTable ta_ptable = new DBDataSet.TA_PTableUsableColumnsDataTable();
                DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter ptableTA = new DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter();
                ptableTA.Connection = GTSAppSettings.SQLConnection;
                ptableTA.Fill(ta_ptable);

                DBDataSet.TA_PTableUsableColumnsDataTable ptable1 = helper.GetPTableUsableColumns(objcet.barcode, objcet.fromDate, objcet.toDate, "Clock6", true);

                DBDataSet.TA_PTableUsableColumnsDataTable ptable2 = helper.GetPTableUsableColumns(objcet.barcode, objcet.fromDate, objcet.toDate, "GTS", false);

                DBDataSet.TA_PTableUsableColumnsDataTable ptable = helper.AppendPTable(ptable1, ptable2);

                string monthDate = objcet.toDate;
                monthDate  = monthDate.Remove(monthDate.Length - 2, 2);
                monthDate += "00";

                ptable.DefaultView.Sort = "prc_date";
                ta_ptable = helper.AppendPTable(ta_ptable, ptable.DefaultView);

                bool[,] deffMat = helper.GetDifferenceIndex(ta_ptable, objcet.barcode);
                int diffCount     = 0;
                int difMonthCount = 0;
                for (int i = 1; i < deffMat.GetLength(0); i++)
                {
                    for (int j = 0; j < deffMat.GetLength(1) - 1; j++)
                    {
                        if ((ta_ptable.Rows[i][1].ToString() == monthDate) && (j == 2 || j == 3 || j == 4 || j == 21))
                        {
                            continue;
                        }
                        if (ta_ptable.Rows[i][1].ToString() == monthDate && deffMat[i, j])
                        {
                            difMonthCount++;
                        }
                        if (deffMat[i, j])
                        {
                            diffCount++;
                        }
                    }
                }
                diffCount = diffCount / 2;
                cdTA.Insert(objcet.barcode, diffCount, difMonthCount, objcet.fromDate, objcet.toDate);
            }
        }
示例#2
0
        private void CalculateAndDisplay(object sender, Jacksonsoft.WaitWindowEventArgs e)
        {
            //string ptableName = "";
            try
            {
                GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter PersonTA = new GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter();
                PersonTA.Connection = GTSAppSettings.SQLConnection;
                decimal PersonId = (decimal)PersonTA.GetPrsID(this.Barcode);

                PTableHelper helper = new PTableHelper();

                helper.InitTA_PTable();

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ta_ptable = new DataSet.DBDataSet.TA_PTableUsableColumnsDataTable();
                DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter ptableTA = new DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter();
                ptableTA.Connection = GTSAppSettings.SQLConnection;
                ptableTA.Fill(ta_ptable);

                helper.GTSCalculate(this.Barcode, PersonId, fromDataTB.Text, toDataTB.Text);

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ptable = helper.GetPTableUsableColumns(Barcode, fromDataTB.Text, toDataTB.Text, "", false);

                //ptable.DefaultView.Sort = "prc_date";
                ta_ptable = helper.AppendPTable(ta_ptable, ptable.DefaultView);

                ta_ptable = helper.MinutesToTime(ta_ptable);

                calculate = ta_ptable;
                if (dataGridView1.InvokeRequired)
                {
                    dataGridView1.Invoke(new MethodInvoker(delegate { dataGridView1.DataSource = ta_ptable; }));
                }
                else
                {
                    dataGridView1.DataSource = ta_ptable;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
        private void Display(object sender, Jacksonsoft.WaitWindowEventArgs e)
        {
            try
            {
                string ptableName = "";
                //ptableName = ptableTB1.Text;
                PTableHelper helper = new PTableHelper();

                helper.InitTA_PTable();

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ta_ptable = new DataSet.DBDataSet.TA_PTableUsableColumnsDataTable();
                DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter ptableTA = new DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter();
                ptableTA.Connection = GTSAppSettings.SQLConnection;
                ptableTA.Fill(ta_ptable);

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ptable = helper.GetPTableUsableColumns(Barcode, fromDataTB.Text, toDataTB.Text, "", false);


                // ptable.DefaultView.Sort = "prc_date";
                ta_ptable = helper.AppendPTable(ta_ptable, ptable.DefaultView);

                ta_ptable  = helper.MinutesToTime(ta_ptable);
                wthoutCalc = ta_ptable;
                if (dataGridView1.InvokeRequired)
                {
                    dataGridView1.Invoke(new MethodInvoker(delegate { dataGridView1.DataSource = ta_ptable; }));
                }
                else
                {
                    dataGridView1.DataSource = ta_ptable;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#4
0
        private void Compaire(object sender, Jacksonsoft.WaitWindowEventArgs e)
        {
            try
            {
                GTSAppSettings.FromDate = fromDataTB.Text;
                GTSAppSettings.ToDate   = toDataTB.Text;
                GTSAppSettings.Barcode  = Barcode;
                GTSAppSettings.SaveToFile();

                PTableHelper helper = new PTableHelper();


                helper.InitTA_PTable();

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ta_ptable = new DataSet.DBDataSet.TA_PTableUsableColumnsDataTable();
                DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter ptableTA = new DataSet.DBDataSetTableAdapters.TA_PTableUsableColumnsTableAdapter();
                ptableTA.Connection = GTSAppSettings.SQLConnection;
                ptableTA.Fill(ta_ptable);

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ptable1 = helper.GetPTableUsableColumns(Barcode, fromDataTB.Text, toDataTB.Text, "Clock6", false);

                GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter PersonTA = new GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter();
                decimal PersonId = (decimal)PersonTA.GetPrsID(this.Barcode);

                helper.GTSCalculate(Barcode, PersonId, fromDataTB.Text, toDataTB.Text);

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ptable2 = helper.GetPTableUsableColumns(Barcode, fromDataTB.Text, toDataTB.Text, "GTS", false);

                DataSet.DBDataSet.TA_PTableUsableColumnsDataTable ptable = helper.AppendPTable(ptable1, ptable2);

                ptable.DefaultView.Sort = "prc_date";
                ta_ptable = helper.AppendPTable(ta_ptable, ptable.DefaultView);

                ta_ptable = helper.MinutesToTime(ta_ptable);

                compaireSource = ta_ptable;
                if (dataGridView1.InvokeRequired)
                {
                    dataGridView1.Invoke(new MethodInvoker(delegate { dataGridView1.DataSource = ta_ptable; }));
                }
                else
                {
                    dataGridView1.DataSource = ta_ptable;
                }

                deffMat = helper.GetDifferenceIndex(ta_ptable, Barcode);

                int count = HighlightDiff(deffMat, ta_ptable);

                if (difCountLbl.InvokeRequired)
                {
                    difCountLbl.Invoke(new MethodInvoker(delegate { difCountLbl.Text = Convert.ToString(count / 2); }));
                    difCountLbl.Invoke(new MethodInvoker(delegate { diffCount = difCountLbl.Text; }));
                }
                else
                {
                    dataGridView1.DataSource = ta_ptable;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }