예제 #1
0
        private void Calculate(object sender, Jacksonsoft.WaitWindowEventArgs e)
        {
            string fromdate = "";
            string todate   = "";

            if (endtimeTB.InvokeRequired)
            {
                calculatedTB.Invoke(new MethodInvoker(delegate { todate = endtimeTB.Text; }));
            }
            else
            {
                todate = endtimeTB.Text;
            }

            calObjectList.Clear();
            for (int i = 0; i < cfpCount; i++)
            {
                string barcode = cfpTable.Rows[i]["CFP_Barcode"].ToString();
                string date    = cfpTable.Rows[i]["CFP_Date"].ToString();

                //انتقال به جدول موقت برای مقایسه و فقط یکبار
                if (fromdate.Length == 0)
                {
                    fromdate = date;
                    helper.TransferPTableToTempTable(helper.GetPtableFromDate(fromdate));

                    helper.TransferPTableToTempTable(helper.GetPtableFromDate(todate));
                }

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

                helper.GTSCalculate(barcode, PersonId, date, todate);

                if (calculatedTB.InvokeRequired)
                {
                    calculatedTB.Invoke(new MethodInvoker(delegate { calculatedTB.Text += "- " + barcode; }));
                }
                else
                {
                    calculatedTB.Text += "- " + barcode;
                }
                //toolStripStatusLabel1.Text = String.Format("{0} of {1}", i + 1, cfpCount);
                e.Window.Message = String.Format("Calculating {0} of {1}", i + 1, cfpCount);
                CalcObject calcObj = new CalcObject();
                calcObj.barcode  = barcode;
                calcObj.fromDate = date;
                calcObj.toDate   = endtimeTB.Text;
                calObjectList.Add(calcObj);

                //toolStripStatusLabel1.Invalidate();
                //this.Invalidate();
                //this.Update();
            }
        }
예제 #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 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);
            }
        }