Exemplo n.º 1
0
        /// <summary>
        /// delete CFP
        /// Insert CFP
        /// Calculate
        /// </summary>

        public void GTSCalculate(string barcode, decimal PrsId, string fromdate, string todate)
        {
            try
            {
                string pTableName1 = GetPtableFromDate(fromdate);
                string pTableName2 = GetPtableFromDate(todate);
                barcode = barcode.PadLeft(8, '0');
                DeletePTable(barcode, pTableName1);
                DeletePTable(barcode, pTableName2);
                DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter cfpTA = new DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter();
                cfpTA.Connection = GTSAppSettings.SQLConnection;
                //cfpTA.DeleteCFP(PrsId);
                cfpTA.UpdateCFP(Utility.ToMildiDate(fromdate), PrsId);
                string MiladifromDate = Utility.ToString(Utility.ToMildiDate(fromdate));
                //cfpTA.InsertCFP(PrsId, new DateTime(int.Parse(MiladifromDate.Split('/')[0]), int.Parse(MiladifromDate.Split('/')[1]), int.Parse(MiladifromDate.Split('/')[2])));
                ServiceReference1.TotalWebServiceClient total = new GTS.Clock.AppSetup.ServiceReference1.TotalWebServiceClient("BasicHttpBinding_ITotalWebService", GTSAppSettings.WebServiceAddress);
                if (GTSAppSettings.ClockCalculation)
                {
                    //total.Clock_FillByPersonBarCodeAndToDate(barcode, todate);
                }
                else
                {
                    string date = Utility.ToString(Utility.ToMildiDate(todate));
                    total.GTS_ExecuteByPersonIdAndToDate("InternalUtility", PrsId, new DateTime(int.Parse(date.Split('/')[0]), int.Parse(date.Split('/')[1]), int.Parse(date.Split('/')[2])));
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter cfpTA = new DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter();
     cfpTA.Connection = GTSAppSettings.SQLConnection;
     cfpTA.DeleteAll();
 }
Exemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                GTSAppSettings.FromDate   = startTimeTB.Text;
                GTSAppSettings.PTableName = ptableTB.Text;

                string        sql = String.Format(@"insert into TA_Calculation_Flag_Persons 
                                        select Prc_PCode ,'{0}'  from {1} group by Prc_PCode", startTimeTB.Text, ptableTB.Text);
                QueryExecuter exe = new QueryExecuter(null);
                exe.RunQuery(sql, GTSAppSettings.SQLConnection);

                DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter cfpTA = new DataSet.DBDataSetTableAdapters.TA_Calculation_Flag_PersonsTableAdapter();
                DBDataSet.TA_Calculation_Flag_PersonsDataTable cfpTable = new DBDataSet.TA_Calculation_Flag_PersonsDataTable();
                cfpTA.Connection = GTSAppSettings.SQLConnection;
                cfpTA.Fill(cfpTable);
                int cfpCount = cfpTable.Rows.Count;

                MessageBox.Show(String.Format("تعداد {0} درج شد", cfpCount.ToString()));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
        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;
            }
        }