private void button3_Click(object sender, EventArgs e) { try { GTSAppSettings.FromDate = shamsiDateTB.Text; GTSAppSettings.Barcode = barcodeTB.Text; GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter PersonTA = new GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter(); GTS.Clock.AppSetup.DataSet.DBDataSetTableAdapters.DBQuries queriesTA = new GTS.Clock.AppSetup.DataSet.DBDataSetTableAdapters.DBQuries(); DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter cfpTA = new DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter(); PersonTA.Connection = GTSAppSettings.SQLConnection; decimal PersonId = (decimal)PersonTA.GetPrsID(barcodeTB.Text.PadLeft(8, '0')); cfpTA.Connection = GTSAppSettings.SQLConnection; string miladiDate = Utility.ToMildiDateString(shamsiDateTB.Text); cfpTA.UpdateCFP(Utility.ToMildiDateTime(miladiDate), PersonId); if (cfpTrafficCB.Checked) { cfpTA.DeleteProcceedTraffic(PersonId, Utility.ToMildiDateTime(miladiDate)); cfpTA.InvalidateBasicTraffic(PersonId, Utility.ToMildiDateTime(miladiDate)); cfpTA.InvalidateTrafficPermits(PersonId, Utility.ToMildiDateTime(miladiDate)); } MessageBox.Show("انجام شد"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { GTSAppSettings.FromDate = startTimeTB.Text; GTSAppSettings.Barcode = barcodeTB.Text.PadLeft(8, '0'); GTSAppSettings.PTableName = ptableTB.Text; GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter PersonTA = new GTS.Clock.AppSetup.DataSet.GTSDBTableAdapters.TA_PersonTableAdapter(); decimal PersonId = (decimal)PersonTA.GetPrsID(barcodeTB.Text); PTableHelper helper = new PTableHelper(); this.Cursor = Cursors.WaitCursor; DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter cfpTA = new DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter(); cfpTA.Connection = GTSAppSettings.SQLConnection; string date = PersianDateTime.ShamsiToMiladi(startTimeTB.Text); cfpTA.InsertCFP(PersonId, new DateTime(int.Parse(date.Split('/')[0]), int.Parse(date.Split('/')[1]), int.Parse(date.Split('/')[2]))); } finally { this.Enabled = true; this.Cursor = Cursors.Default; } }
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(); } }
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); } }
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); } }