Esempio 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);
            }
        }
Esempio 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);
            }
        }