public ActionResult Supprimer(int id, int idCompte) { ListLog.suppressionLog(id, idCompte); ListCharges.list[id].listComptes.RemoveAt(idCompte); ListCharges.list[id].updateIds(idCompte); return(RedirectToAction("ListCharge")); }
public List <ListLog> getLog(string pGuid) { List <ListLog> listData = new List <ListLog>(); bool isSucceed = true; var connectionString = context.Database.GetDbConnection().ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { //Declare COnnection var querySstring = @" select TASK_ID,UPLOAD_MESSAGE from WISE_STAGING.dbo.T_MKT_POLO_UPLOAD where UPLOAD_STS=0 and QUEUE_UID='" + pGuid + "'"; SqlCommand command = new SqlCommand(querySstring, connection); //open Connection command.Connection.Open(); //PRoses Sp SqlDataReader rd = command.ExecuteReader(); while (rd.Read()) { ListLog data = new ListLog(); data.TASK_ID = rd[0].ToString(); data.UPLOAD_MESSAGE = rd[1].ToString(); listData.Add(data); } //Connection Close command.Connection.Close(); } return(listData); }
/// <summary> /// hàm xử lý trong timer /// /// Tổ chức. /// - Yêu tiên bắt số 1/2 giấy bắt số gọi đến một lần /// - Số bắt được lưu vào ds cuộc gọi đến /// - Dùng backgroudworker để xác định các cuộc gọi /// - Phân chuông của cuộc gọiđã nghe máy, tính vào lúc đã có được ghi âm /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void timerCapture_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { if (g_BlinkIcon == 0) { notifyIcon1.Icon = global::TaxiOperation_CallCapture2.Properties.Resources.Taxi; g_BlinkIcon = 1; } else { notifyIcon1.Icon = global::TaxiOperation_CallCapture2.Properties.Resources.TongDai; g_BlinkIcon = 0; } if (g_bTimerHoanThanh) { g_bTimerHoanThanh = false; List <StructCuocGoi> ListLog; if (!ThongTinCauHinh.HasTongDai) { ListLog = TaxiCapture.GetNhungCuocGoiMoiCuaLogInComing(g_FileLogIncomingPath); } else // Co lay du lieu tu tong dai { ListLog = TaxiCapture.GetNhungCuocGoiMoiCuaTongDai_COMPort(g_ConnecString, g_ThoiDiemLayDuLieuTruocDay); } //cap nhat vao danh sach theo doi cuoc goi nho + cuoc goi chua co chuong, thoi luong cuoc goi if ((ListLog != null) && (ListLog.Count > 0)) { List <StructCuocGoi> ListLogNew = InsertCuocGoiLanDauLogIncoming(ListLog); //cong them vao g_ListCuocGoiLogInComing AddToListLogIncoming(ListLogNew); ListLog.Clear(); ListLog = null; } // Xử lý backgroundwordker if (g_bKetThucBackgroundWork) { g_bKetThucBackgroundWork = false; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.RunWorkerAsync(); } g_bTimerHoanThanh = true; g_ThoiDiemLayDuLieuTruocDay = DateTime.Now; } } catch (Exception ex) { LogError.WriteLogError("Loi trong timer.", ex); } }
//--------------------------------------------------------------------- public void AddLog(string log) { GComponent com = UIPackage.CreateObject("Main", "ListItemLog").asCom; var txt_log = com.GetChild("TxtLog").asTextField; txt_log.text = log; ListLog.AddChildAt(com, 0); }
public ActionResult Affecter(int id, int idCompte, int idCharge) { ListLog.affectationLog(id, idCompte, idCharge); Compte cpt = ListCharges.list[id].listComptes[idCompte]; ListCharges.list[idCharge].addCompte(cpt.numeroCompte, cpt.codeAgence, cpt.intitule); ListCharges.list[id].listComptes.RemoveAt(idCompte); ListCharges.list[id].updateIds(idCompte); return(RedirectToAction("ListCharge")); }
private async void Delete(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa vận chuyển này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (obj != null) { if (await log_repo.Remove((int)obj)) { ListLog.Remove(ListLog.SingleOrDefault(t => t.LogID == (int)obj)); dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; await DialogHost.Show(dialog, DialogHostId); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private async void LoadData(int?obj) { if (obj != null) { var i = ListLog.SingleOrDefault(t => t.LogID == (int)obj); if (i != null) { LogID = i.LogID.ToString(); Name = i.Name; Fee = i.Fee.ToString(); } await DialogHost.Show(new LogisticProfile(), DialogHostId); } }
public void Interimaire(int id, int[] idsCompte, int idCharge) { foreach (int c in idsCompte) { ListLog.interimaireLog(id, c, idCharge); ListCharges.list[id].listComptes[c].interimaire.id = idCharge; ListCharges.list[id].listComptes[c].interimaire.intitule = ListCharges.list[idCharge].intitule; } int n = ListCharges.list[id].listComptes.FindAll(x => x.charge.id == x.interimaire.id).Count; if (n == 0) { ListCharges.list[id].tousInterimaire = true; } }
private void ShowStationMsg(ListLog listlog, string msg) { if (listlog == null) { return; } if (InvokeRequired) { BeginInvoke(new Action(() => ShowStationMsg(listlog, msg))); } else { listlog.AddMsg(msg); listlog.TopIndex = listlog.Items.Count - (int)(listlog.Height / listlog.ItemHeight); } }
//--------------------------------------------------------------------- public override void OnCreate() { BtnClose = ComUi.GetChild("BtnClose").asButton; BtnClose.onClick.Add(_onClickBtnClose); BtnBugly = ComUi.GetChild("BtnBugly").asButton; BtnBugly.onClick.Add(_onClickBtnBugly); BtnLuaLog = ComUi.GetChild("BtnLuaLog").asButton; BtnLuaLog.onClick.Add(_onClickBtnLuaLog); TxtInfo = ComUi.GetChild("TxtInfo").asRichTextField; ListLog = ComUi.GetChild("ListLog").asList; ListLog.RemoveChildren(); }
// 消息列表添加数据记录 private void AppendLog(string text) { var len = 30; Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { //消息长度一行为len //添加消息带上时间戳 ListLog.Items.Add("[" + DateTime.Now.ToString() + "] "); string temp; if (text.Length > len) { for (int i = 0; text.Length > len; i++) { temp = text.Substring(0, len); ListLog.Items.Add(temp); text = text.Substring(len); } } ListLog.Items.Add(text); ListLog.SelectedIndex = ListLog.Items.Count - 1; ListLog.ScrollIntoView(ListLog.SelectedItem); })); }
public static void SetLog(ListLog listLog) { string _msg; switch (listLog) { case ListLog.Init: _msg = "Init game"; break; case ListLog.CreateStar: _msg = "Создание звезд и планет"; break; case ListLog.CreateComet: _msg = "Создание астероидов"; break; case ListLog.Shot: _msg = "Выстрел!"; break; case ListLog.Up: _msg = "Вверх!"; break; case ListLog.Down: _msg = "Вниз!"; break; case ListLog.Medication: _msg = "Использование аптечки"; break; case ListLog.MedicAdd: _msg = "Новая аптечка"; break; case ListLog.Damage: _msg = "Попадание метеорита в корабль"; break; case ListLog.Die: _msg = "Крушение корабля"; break; case ListLog.TargetHit: _msg = "Попадание в цель! Так держать!"; break; case ListLog.MedicHit: _msg = "Попадание в аптечку"; break; default: _msg = "Неизвестный код сообщения"; break; } Log(_msg, SetLogConsole); Log(_msg, SetLogFile); }
/// <summary> /// Gets the mysql DB connection_ execute. /// </summary> private void GetMysqlDBConnection_Execute() { string connectionString = connectionString_MYSQL_Export + "Connection Timeout=180"; string errorMsg = string.Empty; StringBuilder item; try { if (queryToExecute != null && queryToExecute.Count > 0) { // Set the connection this.factory = DbProviderFactories.GetFactory("MySql.Data.MySqlClient"); cn = Factory.CreateConnection(); cn.ConnectionString = connectionString; isRunning = true; foreach (string table in queryToExecute.Keys) { // Open con and Begin Trans cn.Open(); trans = cn.BeginTransaction(); errorMsg = table; // Append to Log ListLog.Invoke((Action)(() => this.ListLog.AppendText(table + " Executing..." + Environment.NewLine))); ListLog.Invoke((Action)(() => this.ListLog.Focus())); queryToExecute.TryGetValue(table, out item); cmd = this.CreateCommand(item.ToString(), CommandType.Text); cmd.Transaction = trans; cmd.ExecuteNonQuery(); if (progressBar1.Value < maxProgress) { progressBar1.Invoke((Action)(() => this.progressBar1.Value += 1)); } // Append to Log ListLog.Invoke((Action)(() => this.ListLog.AppendText(table + " Completed." + Environment.NewLine))); ListLog.Invoke((Action)(() => this.ListLog.Focus())); // Close con and Commit Trans trans.Commit(); if (cn != null && cn.State == ConnectionState.Open) { cn.Close(); } } isRunning = false; progressBar1.Invoke((Action)(() => this.progressBar1.Value = maxProgress)); RetrievingTables.Invoke((Action)(() => this.RetrievingTables.Visible = false)); ListLog.Invoke((Action)(() => this.ListLog.AppendText((queryToExecute.Count - 2) + " tables copied successfully." + Environment.NewLine))); ListLog.Invoke((Action)(() => this.ListLog.Focus())); } } catch (Exception ex) { hasErrors = true; trans.Rollback(); this.ElapsedTime.Stop(); this.ElapsedTime.Enabled = false; //CancelBtn.Invoke((Action)(() => this.CancelBtn.Visible = false)); progressBar1.Invoke((Action)(() => this.progressBar1.Value = 0)); RetrievingTables.Invoke((Action)(() => this.RetrievingTables.Visible = false)); // Append to Log ListLog.Invoke((Action)(() => this.ListLog.AppendText("Execution aborted." + Environment.NewLine))); ListLog.Invoke((Action)(() => this.ListLog.Focus())); MessageBox.Show("Sorry, There was an error encountered, the error was on the " + errorMsg + " table." + Environment.NewLine + ex.Message); } }
/// <summary> /// Gets the table data. /// </summary> /// <param name="tablesList">The tables list.</param> private void GetTableData(Dictionary <string, string> tablesList, Dictionary <string, string> tables_fields, string connectionString) { int count = 0; string fields, initialQuery; StringBuilder sb = new StringBuilder(); try { if (tablesList != null && tablesList.Count > 0 && tables_fields != null && tables_fields.Count > 0) { isRunning = true; ListLog.Invoke((Action)(() => this.ListLog.Clear())); // Append to Log ListLog.Invoke((Action)(() => this.ListLog.AppendText("Query generation in progress..." + Environment.NewLine))); // Set the connection this.factory = DbProviderFactories.GetFactory("System.Data.SqlClient"); cn = Factory.CreateConnection(); cn.ConnectionString = connectionString; cn.Open(); using (TransactionScope scope = new TransactionScope()) { maxProgress = (tablesList.Keys.Count * 2) + 2; progressBar1.Invoke((Action)(() => progressBar1.Maximum = maxProgress)); // Set foreign_key_checks = 0; sb.Append("SET foreign_key_checks = 0;" + Environment.NewLine); // Initialize the query list queryToExecute = new Dictionary <string, StringBuilder>(); queryToExecute.Add("FK_Disable", sb); foreach (string table in tablesList.Keys) { sb = new StringBuilder(); tables_fields.TryGetValue(table, out fields); cmd = this.CreateCommand("SELECT " + fields + " FROM [" + table + "]", CommandType.Text); rdr = cmd.ExecuteReader(); if (rdr != null) { tablesList.TryGetValue(table, out initialQuery); // Append the delete script sb.Append("SET SQL_SAFE_UPDATES = 0;" + Environment.NewLine); sb.Append("DELETE FROM `" + table + "`;" + Environment.NewLine); if (rdr.HasRows) { while (rdr.Read()) { // Append the insert script sb.Append(initialQuery); sb.Append("("); for (int i = 0; i < rdr.FieldCount; i++) { // Format the quote ' values. if (rdr[i].ToString().Contains("'")) { string[] s = rdr[i].ToString().Split('\''); sb.Append("'"); if (i + 1 == rdr.FieldCount) { sb.Append("" + s[0].ToString() + "''" + s[1].ToString() + "'"); } else { sb.Append("" + s[0].ToString() + "''" + s[1].ToString() + "', "); } } else { // Format the data according to the datatype. if (rdr[i] == (object)System.DBNull.Value) { if (i + 1 == rdr.FieldCount) { sb.Append("NULL"); } else { sb.Append("NULL, "); } } else if (rdr[i] is long || rdr[i] is short) { if (i + 1 == rdr.FieldCount) { sb.Append(" " + rdr[i].ToString()); } else { sb.Append(" " + rdr[i].ToString() + ", "); } } else if (rdr[i] is bool) { if (i + 1 == rdr.FieldCount) { sb.Append(rdr[i].ToString().ToLower().Equals("false") ? 0 : 1); } else { sb.Append(rdr[i].ToString().ToLower().Equals("false") ? 0 + "," : 1 + ","); } } else if (rdr[i] is DateTime) { sb.Append("'"); if (i + 1 == rdr.FieldCount) { sb.Append("" + Convert.ToDateTime(rdr[i]).ToString("yyyy/MM/dd HH:mm:ss") + "'"); } else { sb.Append("" + Convert.ToDateTime(rdr[i]).ToString("yyyy/MM/dd HH:mm:ss") + "', "); } } else { sb.Append("'"); if (i + 1 == rdr.FieldCount) { sb.Append("" + rdr[i].ToString() + "'"); } else { sb.Append("" + rdr[i].ToString() + "', "); } } } } sb.Append(");" + Environment.NewLine); count++; } } } rdr.Close(); // Assign sb to the global variable queryToExecute.Add(table, sb); // Increment the progressbar. progressBar1.Invoke((Action)(() => this.progressBar1.Value += 1)); } } isRunning = false; // Append to Log ListLog.Invoke((Action)(() => this.ListLog.AppendText("Query generation is completed." + Environment.NewLine + "Data exporting started..." + Environment.NewLine))); } // Set foreign_key_checks = 1; sb = new StringBuilder(); sb.Append("SET foreign_key_checks = 1;" + Environment.NewLine); queryToExecute.Add("FK_Enabled", sb); } catch (Exception ex) { hasErrors = true; ListLog.Invoke((Action)(() => this.ListLog.AppendText("Error in Query generation." + Environment.NewLine))); MessageBox.Show(ex.Message); } }
public void WriteLine(string log, Logger.LogType type = Logger.LogType.Info) { switch (type) { case Logger.LogType.Error: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "错误:" + log; break; case Logger.LogType.Info: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "信息:" + log; break; case Logger.LogType.Crash: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "崩溃:" + log; break; case Logger.LogType.Exception: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "异常:" + log; break; case Logger.LogType.Game: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "游戏:" + log; break; case Logger.LogType.Fml: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "FML :" + log; break; default: log = DateTime.Now.ToString(CultureInfo.InvariantCulture) + "信息:" + log; break; } Dispatcher.Invoke(new System.Windows.Forms.MethodInvoker(delegate { ListLog.Items.Add(log); ListLog.ScrollIntoView(ListLog.Items[ListLog.Items.Count - 1]); })); }
private async void Submit(string obj) { try { var newObj = new Logistic() { Name = Name, }; newObj.Fee = Convert.ToDecimal(Fee); if (string.IsNullOrEmpty(obj)) { var result = await log_repo.Add(newObj); if (result != null) { ListLog.Add(result); dc = new DialogContent() { Content = "Thêm Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } else { dc = new DialogContent() { Content = "Thêm Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } else { newObj.LogID = Convert.ToInt32(LogID); if (await log_repo.Update(newObj)) { dc = new DialogContent() { Content = "Cập Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListLog = new ObservableCollection <Logistic>(log_repo.GetAll()); } else { dc = new DialogContent() { Content = "Cập Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { MessageBox.Show("Có Lỗi"); } }
public ActionResult UpdateConge(int id, DateTime dateDeb, DateTime dateFin) { ListLog.congeLog(id, dateDeb, dateFin); ListCharges.list[id].conge.setDate(dateDeb, dateFin); return(RedirectToAction("ListCharge")); }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (ListLog.Expression != null) { targetCommand.AddParameter("ListLog", ListLog.Get(context)); } if (LogName.Expression != null) { targetCommand.AddParameter("LogName", LogName.Get(context)); } if (ListProvider.Expression != null) { targetCommand.AddParameter("ListProvider", ListProvider.Get(context)); } if (ProviderName.Expression != null) { targetCommand.AddParameter("ProviderName", ProviderName.Get(context)); } if (Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } if (MaxEvents.Expression != null) { targetCommand.AddParameter("MaxEvents", MaxEvents.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (FilterXPath.Expression != null) { targetCommand.AddParameter("FilterXPath", FilterXPath.Get(context)); } if (FilterXml.Expression != null) { targetCommand.AddParameter("FilterXml", FilterXml.Get(context)); } if (FilterHashtable.Expression != null) { targetCommand.AddParameter("FilterHashtable", FilterHashtable.Get(context)); } if (Force.Expression != null) { targetCommand.AddParameter("Force", Force.Get(context)); } if (Oldest.Expression != null) { targetCommand.AddParameter("Oldest", Oldest.Get(context)); } if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", PSComputerName.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public ActionResult Ajouter(int id, int codeAgence, int numCompte, string intitule) { ListLog.ajoutLog(id, codeAgence, numCompte); ListCharges.list[id].addCompte(numCompte, codeAgence, intitule); return(RedirectToAction("ListCharge")); }