Пример #1
0
 private void loadSaveBtn_Click(object sender, EventArgs e)
 {
     LoadData(configFileTB.Text);
     GTSAppSettings.SaveToFile(configFileTB.Text);
     MessageBox.Show("بارگذاری صورت گرفت");
     this.Close();
 }
Пример #2
0
 public static void LoadFromFile(string filename)
 {
     if (filename.Length == 0)
     {
         filename = "appcon.gus";
     }
     if (!filename.Contains(".gus"))
     {
         filename += ".gus";
     }
     if (File.Exists(filename))
     {
         FileStream stram;
         using (stram = new FileStream(filename, FileMode.Open))
         {
             if (stram.Length > 0)
             {
                 BinaryFormatter         formater = new BinaryFormatter();
                 GTSAppSettings.Settings setting  = new GTSAppSettings.Settings();
                 setting = (GTSAppSettings.Settings)formater.Deserialize(stram);
                 GTSAppSettings.Import(setting);
             }
         }
     }
 }
Пример #3
0
 private void filterBtn_Click(object sender, EventArgs e)
 {
     try
     {
         GTSAppSettings.FilterDate = filterDateTB.Text;
         GTSAppSettings.SaveToFile();
         string filter = "";
         if (filterDateTB.TextLength > 0 && conceptFilterTB.TextLength > 0)
         {
             filter = String.Format(" where Message like ('%{0} %') and Message like ('% {1} %')", filterDateTB.Text, conceptFilterTB.Text);
         }
         else if (filterDateTB.TextLength > 0)
         {
             filter = String.Format(" where Message like ('%{0} %')", filterDateTB.Text);
         }
         else if (conceptFilterTB.TextLength > 0)
         {
             filter = String.Format(" where Message like ('% {0} %')", conceptFilterTB.Text);
         }
         QueryExecuter exec            = new QueryExecuter(null);
         string        engineLogSelect = String.Format("select [PersonBarcode],[dbo].GTS_ASM_MiladiToShamsi(Convert(varchar(10),[Date],101)) [date],[Level],[Message],[Exception] from [TA_EngineLog] order {1} order by [Date] desc", filter);
         engineLogGridView.DataSource = exec.RunQueryResult(engineLogSelect, Connection);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                cfpTA.Connection = GTSAppSettings.SQLConnection;
                cfpTA.Fill(cfpTable);
                cfpCount = cfpTable.Rows.Count;

                GTSAppSettings.ToDate = endtimeTB.Text;
                GTSAppSettings.SaveToFile();

                this.Cursor = Cursors.WaitCursor;
                EnableDiasable(false);


                if (cfpCount == 0)
                {
                    MessageBox.Show("CFP Table is Empty!");
                }
                else
                {
                    toolStripStatusLabel2.Text = "محاسبه";
                    CalculateAll();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //PTableHelper helper = new PTableHelper();
                //helper.GetPtableFromDate("1388/08/05");
                //return;
                GTSAppSettings.FromDate = fromDataTB.Text;
                GTSAppSettings.ToDate   = toDataTB.Text;
                GTSAppSettings.Barcode  = Barcode;
                GTSAppSettings.SaveToFile();
                switch (actionTypeCombo.SelectedIndex)
                {
                //case 0:
                //    difCountLbl.Text = "0";
                //    difCountLbl.Enabled = false;
                //    WaitNow(this.CalculateAndDisplay);
                //    break;
                //case 1:
                //    difCountLbl.Text = "0";
                //    difCountLbl.Enabled = false;
                //    WaitNow(this.Display);
                //    break;
                case 0:
                    difCountLbl.Text    = "0";
                    difCountLbl.Enabled = false;
                    DisplayProceedTraffic();
                    break;

                case 1:
                    difCountLbl.Text    = "0";
                    difCountLbl.Enabled = false;
                    DisplayBasicTraffic();
                    break;

                case 2:
                    difCountLbl.Text    = "0";
                    difCountLbl.Enabled = false;
                    DisplayRequests();
                    break;

                case 3:
                    difCountLbl.Text    = "0";
                    difCountLbl.Enabled = false;
                    DisplayPermits();
                    break;
                    //case 6:
                    //    difCountLbl.Enabled = true;
                    //    WaitNow(this.Compaire);
                    //    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Utility.IsEmpty(barcodeTB.Text))
                {
                    GTSAppSettings.FromDate = fromDataTB.Text;
                    GTSAppSettings.ToDate   = toDataTB.Text;
                    GTSAppSettings.Barcode  = barcodeTB.Text;
                    GTSAppSettings.SaveToFile();

                    GTS.Clock.AppSetup.DataSet.DBDataSetTableAdapters.TA_PersonTableAdapter prsTA = new DataSet.DBDataSetTableAdapters.TA_PersonTableAdapter();
                    DBDataSet.TA_PersonDataTable table = prsTA.GetDataByBarcode(GTSAppSettings.Barcode);
                    if (table != null && table.Rows.Count > 0)
                    {
                        prsNameLbl.Text = (table.Rows[0] as DBDataSet.TA_PersonRow).Prs_FirstName + " " + (table.Rows[0] as DBDataSet.TA_PersonRow).Prs_LastName;
                    }


                    #region Query

                    QueryExecuter exec          = new QueryExecuter(null);
                    string        requestSelect = String.Format(@"
select request_PrecardID Pishcard,[dbo].[MinutesToTime](convert(varchar(10), request_FromTime,101)) FromTime,[dbo].[MinutesToTime](convert(varchar(10), request_ToTime,101)) ToTime,dbo.GTS_ASM_MiladiToShamsi(convert(varchar(10), request_FromDate,101))FromDate,dbo.GTS_ASM_MiladiToShamsi(convert(varchar(10),request_ToDate,101))ToDate,
[dbo].[MinutesToTime](convert(varchar(10) , request_TimeDuration,101))TimeDuration,mng.Prs_FirstName + ' ' + mng.Prs_LastName as Manager,Flow_FlowName Flow,reqStat_Confirm Confirm,reqStat_EndFlow [End],reqStat_IsDeleted [Delete]
from TA_Request
left outer join TA_RequestStatus on reqStat_RequestID=request_ID
join TA_ManagerFlow on mngrFlow_ID=reqStat_MnagerFlowID
join TA_Flow on Flow_ID=mngrFlow_FlowID
join TA_Manager on MasterMng_ID=mngrFlow_ManagerID
join TA_Person as mng on mng.Prs_ID=MasterMng_PersonID
WHERE request_FromDate >= '{0}'
									AND 
								   request_ToDate <= '{1}'
								    AND
								   request_PersonID=dbo.GetPerson('{2}') "                                ,
                                                                Utility.ToMildiDateString(fromDataTB.Text), Utility.ToMildiDateString(toDataTB.Text), GTSAppSettings.Barcode);

                    object result = exec.RunQueryResult(requestSelect, GTSAppSettings.SQLConnection);
                    dataGridView1.DataSource = result;

                    #endregion
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #7
0
        private void LoadData(string config)
        {
            GTSAppSettings.LoadFromFile(config);

            serverTB.Text              = GTSAppSettings.SQLConnection.DataSource;
            DBTB.Text                  = GTSAppSettings.SQLConnection.Database;
            serviceRefTb.Text          = GTSAppSettings.WebServiceAddress;
            logDBTB.Text               = GTSAppSettings.LogSQLConnection.Database;
            logserverTB.Text           = GTSAppSettings.LogSQLConnection.DataSource;
            logUserNameTB.Text         = GTSAppSettings.LogUserName;
            logPasswordTB.Text         = GTSAppSettings.LogPassword;
            usernameTB.Text            = GTSAppSettings.GTSUserName;
            passwordTB.Text            = GTSAppSettings.GTSPassword;
            GTSAppSettings.SettingName = config;
        }
Пример #8
0
        public static void SaveToFile(string filename)
        {
            if (filename.Length == 0)
            {
                filename = "appcon.gus";
            }
            FileStream stram;

            if (!filename.Contains(".gus"))
            {
                filename += ".gus";
            }
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }
            using (stram = new FileStream(filename, FileMode.Create))
            {
                BinaryFormatter formater = new BinaryFormatter();
                formater.Serialize(stram, GTSAppSettings.Export());
            }
        }
Пример #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                cfpTA.Connection = GTSAppSettings.SQLConnection;
                cfpTA.Fill(cfpTable);
                cfpCount = cfpTable.Rows.Count;

                GTSAppSettings.ToDate = endtimeTB.Text;
                GTSAppSettings.SaveToFile();

                this.Cursor  = Cursors.WaitCursor;
                this.Enabled = false;


                if (cfpCount == 0)
                {
                    MessageBox.Show("CFP Table is Empty!");
                }
                else
                {
                    toolStripStatusLabel2.Text = "محاسبه";
                    WaitNow(Calculate, "Initilizing....");
                    toolStripStatusLabel2.Text = "مقایسه";
                    Compaire();
                    toolStripStatusLabel2.Text = "اتمام";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                this.Enabled = true;
                this.Cursor  = Cursors.Default;
            }
        }
Пример #10
0
 private void AppSettings_Load(object sender, EventArgs e)
 {
     settingNamesCombo.DataSource = GTSAppSettings.GetExistSettings();
     GTSAppSettings.GetExistSettings();
     if (GTSAppSettings.SettingName != null && GTSAppSettings.SettingName.Length > 0)
     {
         configFileTB.Text = GTSAppSettings.SettingName;
     }
     base.menuStrip1.Visible = false;
     serverTB.Text           = GTSAppSettings.SQLConnection.DataSource;
     DBTB.Text          = GTSAppSettings.SQLConnection.Database;
     serviceRefTb.Text  = GTSAppSettings.WebServiceAddress;
     logDBTB.Text       = GTSAppSettings.LogSQLConnection.Database;
     logserverTB.Text   = GTSAppSettings.LogSQLConnection.DataSource;
     logUserNameTB.Text = GTSAppSettings.LogUserName;
     logPasswordTB.Text = GTSAppSettings.LogPassword;
     usernameTB.Text    = GTSAppSettings.GTSUserName;
     passwordTB.Text    = GTSAppSettings.GTSPassword;
     if (GTSAppSettings.ClockCalculation)
     {
         clockCalculationCB.Checked = true;
     }
 }
Пример #11
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            string conStr = "";

            conStr = String.Format("Data Source={0};Initial Catalog={1};User ID={2};", serverTB.Text, DBTB.Text, usernameTB.Text);
            if (passwordTB.TextLength > 0)
            {
                conStr += "Password="******";";
            }
            SqlConnection connection = new SqlConnection(conStr);

            GTSAppSettings.SQLConnection = connection;

            conStr = String.Format("Data Source={0};Initial Catalog={1};User ID={2};", logserverTB.Text, logDBTB.Text, logUserNameTB.Text);
            if (logPasswordTB.TextLength > 0)
            {
                conStr += "Password="******";";
            }


            SqlConnection logconnection = new SqlConnection(conStr);

            GTSAppSettings.LogSQLConnection = logconnection;

            GTSAppSettings.WebServiceAddress = serviceRefTb.Text;

            GTSAppSettings.LogUserName      = logUserNameTB.Text;
            GTSAppSettings.LogPassword      = logPasswordTB.Text;
            GTSAppSettings.GTSUserName      = usernameTB.Text;
            GTSAppSettings.GTSPassword      = passwordTB.Text;
            GTSAppSettings.GTSDBName        = DBTB.Text;
            GTSAppSettings.ClockCalculation = clockCalculationCB.Checked;

            GTSAppSettings.SaveToFile(configFileTB.Text);
            MessageBox.Show("ذخیره گردید");
            this.Close();
        }
Пример #12
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);
            }
        }
Пример #13
0
 private void MainPage_Load(object sender, EventArgs e)
 {
     GTSAppSettings.LoadFromFile();
 }