private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxX1.Text.Trim())) { MsgBox.Show("未選擇前置詞,已取消操作!!"); return; } DialogResult dr = MsgBox.Show("確認儲存增加所選之事由前置詞?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (dr == System.Windows.Forms.DialogResult.Yes) { ChangeText = textBoxX1.Text.Trim(); foreach (DisciplineRecord each in _helper) { each.Reason = ChangeText + each.Reason; } try { Discipline.Update(_helper); MsgBox.Show("資料儲存完成"); ApplicationLog.Log("獎懲批次修改", "修改", "批次增加事由前置詞「" + ChangeText + "」\n" + "共" + _helper.Count + "筆資料"); this.DialogResult = System.Windows.Forms.DialogResult.Yes; } catch (Exception ex) { MsgBox.Show("儲存發生錯誤:\n" + ex.Message); SmartSchool.ErrorReporting.ReportingService.ReportException(ex); } } }
internal static DataTable GetOrdersList(string customerSearchTerm, string orderSearchTerm, DateTime?startDate, DateTime?endDate, int?resultMaxCount) { ApplicationLog.Log( SalesOrderActions.LogSource, "Getting the list of sales orders for a customer", LogTraceLevel.Trace); DataTable salesOrders; bool retVal = false; string comment = string.Empty; try { salesOrders = SalesOrder.GetCustomerOrdersList(ref retVal, ref comment, customerSearchTerm, orderSearchTerm, startDate, endDate, resultMaxCount); } catch (PosisException px) { ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, px); throw; } catch (Exception x) { ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x); throw new PosisException(52300, x); } return(salesOrders); }
private void btnSave_Click(object sender, EventArgs e) { DialogResult dr = MsgBox.Show("確認儲存事由修改?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (dr == System.Windows.Forms.DialogResult.Yes) { ChangeText = textBoxX1.Text.Trim(); foreach (DisciplineRecord each in _helper) { each.Reason = ChangeText; } try { Discipline.Update(_helper); MsgBox.Show("資料儲存完成"); ApplicationLog.Log("獎懲批次修改", "修改", "批次修改事由資料\n" + "共" + _helper.Count + "筆資料"); this.DialogResult = System.Windows.Forms.DialogResult.Yes; } catch (Exception ex) { MsgBox.Show("儲存發生錯誤:\n" + ex.Message); } } }
private void btnNew_Click(object sender, EventArgs e) { Item it = new Item(new CreationItemsRecord() { RegistStartTime = DateTime.Now, RegistEndTime = DateTime.Now, SchoolYear = int.Parse(filterSchoolYear.Text), Semester = int.Parse(filterSemester.Text), Organizers = filterOrganizers.Text }, filterOrganizers.Items); if (it.ShowDialog() == System.Windows.Forms.DialogResult.OK) { it._cir.CreateBy = FISCA.Authentication.DSAServices.UserAccount; it._cir.Save(); //if (it._cir.SchoolYear == int.Parse(filterSchoolYear.Text) && it._cir.Semester == int.Parse(filterSemester.Text) ) // DataRowList.Add(it._cir); if (!filterOrganizers.Items.Contains(it._cir.Organizers)) { filterOrganizers.Items.Add(it._cir.Organizers); } ApplicationLog.Log("服務學習線上開設", "新增項目", "新增一筆\n學年度:" + it._cir.SchoolYear + ",學期:" + it._cir.Semester + ",日期:" + it._cir.OccurDate + ",事由:" + it._cir.Reason + ",時數:" + it._cir.ExpectedHours + ",主辦單位:" + it._cir.Organizers + ",備註:" + it._cir.Remark); RunSelect(); } }
//DoWork 執行 private void _BGWorker_DoWork(object sender, DoWorkEventArgs e) { this.currentSchoolIndex = 0; this.SchoolError.Clear(); foreach (School school in this.SelectedSchools) { this.currentSchoolIndex++; _BGWorker.ReportProgress(this.getProgressPercent(), $"({this.currentSchoolIndex} / {this.SelectedSchools.Count}) 處理 {school.Title} 中"); try { UpdateSchoolDate(); SuccesLock.Add(school.Title); } catch (Exception ex) { MsgBox.Show($"解鎖{school.Title}時,發生錯誤 \n,錯誤訊息:{ex.Message} \n 堆疊:{ex.StackTrace}"); SchoolError.Add(school.Title); } _BGWorker.ReportProgress(this.getProgressPercent(), $"完成 {school.Title}"); } ApplicationLog.Log("局端手動解鎖", "執行", $"解鎖學校:\n { string.Join("\n", this.SuccesLock)}"); _BGWorker.ReportProgress(this.getProgressPercent(), $"全部完成"); }
private void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(errorProvider1.GetError(textBoxX1)) || !string.IsNullOrEmpty(errorProvider2.GetError(textBoxX2))) { MsgBox.Show("資料請修正後再儲存!!"); return; } if (DateTimeParsebifi()) { string startTime = DateTime.Parse(textBoxX1.Text).ToString(DateTimeHelper.StdDateTimeFormat); string EndTime = DateTime.Parse(textBoxX2.Text).ToString(DateTimeHelper.StdDateTimeFormat); DSXmlHelper obj = new DSXmlHelper("Request"); obj.AddElement("Content"); obj.AddElement("Content", "StartTime", startTime); obj.AddElement("Content", "EndTime", EndTime); Config.SetMoralUploadConfig(obj.BaseElement); //LOG sb.AppendLine("修改後:"); sb.AppendLine("開始時間「" + startTime + "」"); sb.AppendLine("結束時間「" + EndTime + "」"); ApplicationLog.Log("學務系統.開放時間設定", "修改開放時間設定", sb.ToString()); Close(); } else { MsgBox.Show("錯誤:\n開放時間大於截止時間!!"); return; } }
/// <summary> /// 自動修正選擇資料 /// </summary> /// <param name="EntityIDs"></param> public void ExecuteAutoCorrect(IEnumerable <string> EntityIDs) { //Log StringBuilder sb = new StringBuilder(); List <AssnAddress> list = new List <AssnAddress>(); //如果是null / 表示修正所有資料 if (K12.Data.Utility.Utility.IsNullOrEmpty(EntityIDs)) { sb.AppendLine("已進行:社團上課地點空值檢查"); sb.AppendLine("自動修正「所有」之錯誤資料"); sb.AppendLine("刪除資料如下:"); sb.AppendLine(""); foreach (AssociationAddressRATRecord APeach in RATRecords) { if (AssnciationDic.ContainsKey(APeach.課地點UID)) { AssnAddress aa = AssnciationDic[APeach.課地點UID]; string schoolyear = CourseDic[aa.AssociationID].SchoolYear.HasValue ? CourseDic[aa.AssociationID].SchoolYear.Value.ToString() : ""; string Semester = CourseDic[aa.AssociationID].Semester.HasValue ? CourseDic[aa.AssociationID].Semester.Value.ToString() : ""; sb.AppendLine("上課地點「" + aa.Address + "」" + "資料系統編號(UID)「" + aa.UID + "」上課學年度「" + aa.SchoolYear + "」上課學期「" + aa.Semester + "」"); sb.AppendLine("(社團對應資料 - 學年度「" + schoolyear + "」學期「" + Semester + "」名稱「" + CourseDic[aa.AssociationID].Name + "」)"); list.Add(aa); } //_accessHelper.Select<AssnAddress> } } else //修正部份 { sb.AppendLine("已進行:社團上課地點空值檢查"); sb.AppendLine("自動修正「已選擇」之錯誤項目"); sb.AppendLine("刪除資料如下:"); sb.AppendLine(""); foreach (string Entityeach in EntityIDs) { if (AssnciationDic.ContainsKey(Entityeach)) { AssnAddress aa = AssnciationDic[Entityeach]; string schoolyear = CourseDic[aa.AssociationID].SchoolYear.HasValue ? CourseDic[aa.AssociationID].SchoolYear.Value.ToString() : ""; string Semester = CourseDic[aa.AssociationID].Semester.HasValue ? CourseDic[aa.AssociationID].Semester.Value.ToString() : ""; sb.AppendLine("上課地點「" + aa.Address + "」" + "資料系統編號(UID)「" + aa.UID + "」上課學年度「" + aa.SchoolYear + "」上課學期「" + aa.Semester + "」"); sb.AppendLine("(社團對應資料 - 學年度「" + schoolyear + "」學期「" + Semester + "」名稱「" + CourseDic[aa.AssociationID].Name + "」)"); list.Add(AssnciationDic[Entityeach]); } } } DialogResult dr = MsgBox.Show("即將刪除選取之資料\n您確定要進行自動修正嗎??", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { _accessHelper.DeletedValues(list.ToArray()); ApplicationLog.Log("資料合理性檢查", "社團上課地點空值檢查(高雄市適用)", sb.ToString()); } else { MsgBox.Show("已取消自動修正!!"); } }
private void btnDel_Click(object sender, EventArgs e) { try { _logDict.Clear(); // 檢查是否選擇 if (dgData.SelectedRows.Count > 0) { // 取得異動編號 List <string> urId = new List <string>(); foreach (DataGridViewRow drv in dgData.SelectedRows) { string id = drv.Tag.ToString(); if (!string.IsNullOrEmpty(id)) { urId.Add(id); // 記錄 log if (_dataRowDict.ContainsKey(id)) { // 取得學生ID string sid = _dataRowDict[id]["sid"].ToString(); if (!_logDict.ContainsKey(sid)) { _logDict.Add(sid, new StringBuilder().AppendLine("刪除異動資料:")); } //學號、班級、座號、姓名、異動日期、異動代碼、原因及事項 string logdata = "學號:" + _dataRowDict[id]["student_number"].ToString() + ",班級:" + _dataRowDict[id]["class_name"].ToString() + ".座號:" + _dataRowDict[id]["seat_no"].ToString() + ",姓名:" + _dataRowDict[id]["name"].ToString() + ",異動日期:" + _dataRowDict[id]["update_date"].ToString() + ",異動代碼:" + _dataRowDict[id]["update_code"].ToString() + ",原因及事項:" + _dataRowDict[id]["update_desc"].ToString(); _logDict[sid].AppendLine(logdata); } } } // 取得異動資料 List <K12.Data.UpdateRecordRecord> urList = K12.Data.UpdateRecord.SelectByIDs(urId); // 刪除資料 K12.Data.UpdateRecord.Delete(urList); // Log // 刪除異動 log foreach (string sid in _logDict.Keys) { ApplicationLog.Log("異動資料", "刪除異動", "student", sid, _logDict[sid].ToString()); } FISCA.Presentation.Controls.MsgBox.Show("共刪除 " + urList.Count + " 筆異動資料"); this.Close(); } else { FISCA.Presentation.Controls.MsgBox.Show("請選擇異動資料"); } } catch (Exception ex) { SmartSchool.ErrorReporting.ErrorMessgae msg = new SmartSchool.ErrorReporting.ErrorMessgae(ex); FISCA.Presentation.Controls.MsgBox.Show("刪除異動資料發生錯誤," + ex.Message); } }
private static void UnhandledExceptionHandler(Exception exception) { string text = "QuickTranslator"; ApplicationLog.Log(Path.GetDirectoryName(Application.ExecutablePath), text, exception); MessageBox.Show("Lỗi chương trình! Hãy gửi " + text + ".log cho tác giả. Xin cám ơn!", "Lỗi chương trình", MessageBoxButtons.OK, MessageBoxIcon.Hand); Application.Exit(); }
/// <summary> /// Get sales order history for the given customer /// </summary> /// <param name="customerId">id of the customer (must be non-null/empty)</param> /// <returns>CustomerHistory object if successfull, NULL if not.</returns> internal static CustomerHistory GetCustomerHistory(string customerId) { if (string.IsNullOrWhiteSpace(customerId)) { throw new ArgumentNullException("customerId"); } const int successIndex = 1; // index of the success/fail result const int commentIndex = 2; // index of the error message or comment const int payloadIndex = 3; // index of the content/payload. try { CustomerHistory history = null; ReadOnlyCollection <object> containerArray; bool retValue; string comment; // Begin by checking if there is a connection to the Transaction Service if (Customer.InternalApplication.TransactionServices.CheckConnection()) { // Send request to AX containerArray = InternalApplication.TransactionServices.Invoke("getCustomerHistory", customerId, (int)Functions.DaysCustomerHistory); retValue = (bool)containerArray[successIndex]; comment = containerArray[commentIndex].ToString(); if (retValue) { // Only set the Id if we successfully created the order/quote string xmlString = containerArray[payloadIndex].ToString(); history = CustomerHistory.FromXml(xmlString); } else { ApplicationLog.Log( typeof(Customer).ToString(), string.Format("{0}\n{1}", ApplicationLocalizer.Language.Translate(99412), comment), //"an error occured in the operation" LogTraceLevel.Error); Customer.InternalApplication.Services.Dialog.ShowMessage(99412, MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (history != null) { history.Parse(); } return(history); } catch (Exception ex) { LSRetailPosis.ApplicationExceptionHandler.HandleException(typeof(Customer).ToString(), ex); throw; } }
private void dataGridViewX1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { DialogResult dr = MsgBox.Show("您確定於封存資料中,刪除選擇之書面記錄(輔導)?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (dr == DialogResult.No) { MsgBox.Show("已中止刪除資料!"); e.Cancel = true; } else { //說明: //CurrentRow的TAG內存之UID / 是WriteCounselingUDT的UID //欲取得GraduateUDT資料,需要先取得WriteCounselingUDT //後由WriteCounselingUDT的RefUDT_ID取得GraduateUDT資料 List <string> uidList = new List <string>(); foreach (DataGridViewRow each in dataGridViewX1.SelectedRows) { string UID = "" + each.Cells[0].Tag; if (!string.IsNullOrEmpty(UID)) { uidList.Add(UID); } } //取得所選的書面資料 List <WriteCounselingUDT> listUDT2 = _AccessHelper.Select <WriteCounselingUDT>(UDT_S.PopOneCondition("UID", uidList)); if (listUDT2.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("班級「" + _StudentUdt.ClassName + "」"); sb.Append("座號「" + (_StudentUdt.SeatNo.HasValue ? _StudentUdt.SeatNo.Value.ToString() : "") + "」"); sb.Append("姓名「" + _StudentUdt.Name + "」"); sb.AppendLine("學號「" + _StudentUdt.StudentNumber + "」"); foreach (WriteCounselingUDT each in listUDT2) { sb.AppendLine("已刪除書面(輔導)資料「" + each.Name + each.Format + "」"); } _AccessHelper.DeletedValues(listUDT2.ToArray()); ApplicationLog.Log("畢業生檔案檢索.書面資料(輔導)", "刪除", sb.ToString()); MsgBox.Show("已刪除所選書面資料(輔導)"); e.Cancel = true; OnPrimaryKeyChanged(null); } else { MsgBox.Show("刪除書面資料發生錯誤!"); e.Cancel = true; } } }
private void 刪除ToolStripMenuItem_Click(object sender, EventArgs e) { #region 右鍵刪除功能 DialogResult DR = new DialogResult(); DR = FISCA.Presentation.Controls.MsgBox.Show("是否刪除選擇之獎懲內容?\n共" + DelRowIdList.Count + " 筆", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (DR == DialogResult.Yes) { StringBuilder sbDEL = new StringBuilder(); sbDEL.AppendLine("已進行批次刪除獎懲資料"); sbDEL.AppendLine("刪除資料如下:"); foreach (DisciplineRecord each in DelRowRecordList) { if (each.MeritFlag == "1") { sbDEL.Append("獎勵日期「" + each.OccurDate.ToShortDateString() + "」"); sbDEL.Append("學生「" + each.Student.Name + "」"); sbDEL.Append("班級「" + (each.Student.Class != null ? each.Student.Class.Name : "") + "」"); sbDEL.AppendLine("座號「" + (each.Student.SeatNo.HasValue ? each.Student.SeatNo.Value.ToString() : "") + "」"); } else if (each.MeritFlag == "0") { sbDEL.Append("懲戒日期「" + each.OccurDate.ToShortDateString() + "」"); sbDEL.Append("學生「" + each.Student.Name + "」"); sbDEL.Append("班級「" + (each.Student.Class != null ? each.Student.Class.Name : "") + "」"); sbDEL.AppendLine("座號「" + (each.Student.SeatNo.HasValue ? each.Student.SeatNo.Value.ToString() : "") + "」"); } else if (each.MeritFlag == "2") { sbDEL.Append("留查日期「" + each.OccurDate.ToShortDateString() + "」"); sbDEL.AppendLine("留查日期「" + each.OccurDate.ToShortDateString() + "」"); sbDEL.Append("學生「" + each.Student.Name + "」"); sbDEL.Append("班級「" + (each.Student.Class != null ? each.Student.Class.Name : "") + "」"); sbDEL.AppendLine("座號「" + (each.Student.SeatNo.HasValue ? each.Student.SeatNo.Value.ToString() : "") + "」"); } } try { Discipline.Delete(DelRowIdList); } catch { FISCA.Presentation.Controls.MsgBox.Show("刪除發生錯誤"); return; } ApplicationLog.Log("獎懲批次修改", "刪除", sbDEL.ToString() + "\n已將「" + DelRowIdList.Count + "」筆獎懲資料刪除。"); FISCA.Presentation.Controls.MsgBox.Show("刪除成功!!"); btnRefresh_Click(null, null); //if (!_loader.IsBusy) //重置相關資料? //{ // Merit.Instance.SyncAllBackground(); // Demerit.Instance.SyncAllBackground(); //} } #endregion }
/// <summary> /// Get a sales order or quote by id /// </summary> /// <param name="orderId"></param> /// <param name="orderType"></param> /// <returns></returns> internal static CustomerOrderTransaction GetCustomerOrder(string orderId, CustomerOrderType orderType, CustomerOrderMode forMode) { CustomerOrderTransaction result = null; IRetailTransaction order; bool retValue = false; string comment; //Verify that the user has rights to EDIT an order, and prompt for access. if (!SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(SalesOrder.InternalApplication.Shift.StaffId, PosisOperations.CustomerOrderDetails)) { return(null); } switch (orderType) { case CustomerOrderType.SalesOrder: SalesOrder.InternalApplication.Services.SalesOrder.GetCustomerOrder( ref retValue, orderId, out comment, out order); break; case CustomerOrderType.Quote: SalesOrder.InternalApplication.Services.SalesOrder.GetCustomerQuote( ref retValue, orderId, out comment, out order); break; default: throw new InvalidOperationException("Unsupported CustomerOrderType"); } if (retValue) { // Cache the order CustomerOrderTransaction customerOrder = (CustomerOrderTransaction)order; customerOrder.Mode = forMode; if (forMode == CustomerOrderMode.Cancel) { AddDefaultCancellationCharge(customerOrder); } customerOrder.CalcTotals(); result = customerOrder; } else { // The sales order was not found in AX ApplicationLog.Log(SalesOrderActions.LogSource, string.Format("{0}\n{1}", ApplicationLocalizer.Language.Translate(56124), comment), LogTraceLevel.Error); SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56124, MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
private void Save() { UpdateHelper updateHelper = new UpdateHelper(); List <string> updateSQLs = new List <string>(); List <DataGridViewRow> Rows = new List <DataGridViewRow>(); StringBuilder strLog = new StringBuilder(); foreach (DataGridViewRow Row in grdLog.Rows) { if (Row.Cells["colComment"].Style.BackColor.Equals(UpdateColor) || Row.Cells["colVerify"].Style.BackColor.Equals(UpdateColor)) { string UID = "" + Row.Cells["colID"].Value; string Date = "" + Row.Cells["colDate"].Value; string School = "" + Row.Cells["colSchool"].Value; string Action = "" + Row.Cells["colAction"].Value; string Content = "" + Row.Cells["colContent"].Value; string Comment = "" + Row.Cells["colComment"].Value; string Verify = "" + Row.Cells["colVerify"].Value; Rows.Add(Row); updateSQLs.Add("UPDATE $school_log SET is_verify = '" + Verify + "', comment = '" + Comment + "' WHERE uid =" + UID); strLog.AppendLine("日期時間「" + Date + "」學校「" + School + "」動作「" + Action + "」審核結果「" + Verify + "」備註「" + Comment + "」"); } } if (updateSQLs.Count > 0) { try { updateHelper.Execute(updateSQLs); foreach (DataGridViewRow Row in Rows) { Row.Cells["colComment"].Style.BackColor = Color.White; Row.Cells["colVerify"].Style.BackColor = Color.White; } IsUpdate = true; ApplicationLog.Log("高雄市自動編班", "修改審核及備註", strLog.ToString()); MessageBox.Show("已成功更新" + updateSQLs.Count + "筆記錄!"); } catch (Exception ve) { MessageBox.Show("更新錯誤,錯誤訊息如下:" + System.Environment.NewLine + ve.Message); } } }
/// <summary> /// Create pick list for the given order /// </summary> /// <param name="transaction"></param> internal static void TryCreatePickListForOrder(SalesStatus status, string orderId) { try { switch (status) { case SalesStatus.Created: case SalesStatus.Processing: case SalesStatus.Delivered: // These statuses are allowed for Packslip creation break; case SalesStatus.Canceled: case SalesStatus.Confirmed: case SalesStatus.Invoiced: case SalesStatus.Lost: case SalesStatus.Sent: case SalesStatus.Unknown: default: // Please select an open order SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56132, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Prevent Picking list creation if cashier doesn't have view/edit access if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess( SalesOrder.InternalApplication.Shift.StaffId, PosisOperations.CustomerOrderDetails)) { bool retValue; string comment; SalesOrder.CreatePickingList(orderId, out retValue, out comment); if (retValue) { // "The pick list was created" SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56233); } else { // "Pick list could not be created as this time." ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error); SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56230, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, ex); throw; } }
private void btnExport_Click(object sender, EventArgs e) { #region 匯出 if (saveFileDialog1.ShowDialog() != DialogResult.OK) return; DataGridViewExport export = new DataGridViewExport(dataGridViewX1); export.Save(saveFileDialog1.FileName); ApplicationLog.Log("獎懲批次修改", "匯出", "已將獎懲查詢內容匯出。"); if (new CompleteForm().ShowDialog() == DialogResult.Yes) System.Diagnostics.Process.Start(saveFileDialog1.FileName); #endregion }
/// <summary> /// Print a pack slip for the given order /// </summary> /// <param name="status"></param> /// <param name="orderId"></param> internal static void TryPrintPackSlip(SalesStatus status, string orderId) { try { //if (!selectedOrderStatus.Equals("Delivered")) if (status != SalesStatus.Delivered) { // Please select an delivered order SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56133, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(orderId)) { // Please select a sales order SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56116, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Prevent Packing slip printing if cashier doesn't have view/edit access if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess( SalesOrder.InternalApplication.Shift.StaffId, PosisOperations.CustomerOrderDetails)) { IRetailTransaction transaction; bool retValue = false; string comment; SalesOrder.InternalApplication.Services.SalesOrder.GetCustomerOrder( ref retValue, orderId, out comment, out transaction); if (retValue) { SalesOrder.InternalApplication.Services.Printing.PrintPackSlip(transaction); } else { // The sales order was not found in AX ApplicationLog.Log("frmGetSalesOrder.btnPrintPackSlip_Click()", string.Format("{0}/n{1}", ApplicationLocalizer.Language.Translate(56124), comment), LogTraceLevel.Error); SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56124, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception x) { ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x); SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56220, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void 修改學年度學期ToolStripMenuItem_Click(object sender, EventArgs e) { List<DisciplineRecord> list = new List<DisciplineRecord>(); foreach (DataGridViewRow row in dataGridViewX1.SelectedRows) { DisciplineRecord jhd = (DisciplineRecord)row.Tag; list.Add(jhd); } SetValueSchoolYearSemester ssy = new SetValueSchoolYearSemester(); DialogResult dr = ssy.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.Yes) { StringBuilder sb = new StringBuilder(); sb.AppendLine("已進行批次修改獎懲資料之學年度/學期:"); sb.AppendLine(string.Format("以下所選取資料已指定為學年度「{0}」學期「{1}」", ssy._schoolYear.ToString(), ssy._semester.ToString())); foreach (DisciplineRecord each in list) { if (each.MeritFlag == "0") { sb.Append("懲戒資料:"); sb.Append("學生「" + each.Student.Name + "」"); sb.Append("懲戒日期「" + each.OccurDate.ToShortDateString() + "」"); sb.Append("原學年「" + each.SchoolYear.ToString() + "」"); sb.AppendLine("原學期「" + each.Semester.ToString() + "」"); } else if (each.MeritFlag == "1") { sb.Append("獎勵資料:"); sb.Append("學生「" + each.Student.Name + "」"); sb.Append("獎勵日期「" + each.OccurDate.ToShortDateString() + "」"); sb.Append("原學年「" + each.SchoolYear.ToString() + "」"); sb.AppendLine("原學期「" + each.Semester.ToString() + "」"); } each.SchoolYear = ssy._schoolYear; each.Semester = ssy._semester; } Discipline.Update(list); ApplicationLog.Log("獎懲批次修改", "更新", sb.ToString()); FISCA.Presentation.Controls.MsgBox.Show("儲存成功!"); btnRefresh_Click(null, null); } else { FISCA.Presentation.Controls.MsgBox.Show("未修改!"); } }
private void btnDelete_Click(object sender, EventArgs e) { if (listView.SelectedItems.Count == 0) { MsgBox.Show("必須選擇一筆以上資料!!"); return; } List <BehaviorRecord> behaviorList = new List <BehaviorRecord>(); List <string> listSelectedStuID = new List <string>(); foreach (ListViewItem item in listView.SelectedItems) { BehaviorRecord editor = item.Tag as BehaviorRecord; behaviorList.Add(editor); listSelectedStuID.Add(editor.UID); } if (MsgBox.Show($"確認刪除所選擇-[生活行為紀錄]?", "確認", MessageBoxButtons.YesNo) == DialogResult.No) { return; } try { string deleteSql = $"DELETE FROM $esl.behavior_data WHERE uid IN ( {String.Join(",", listSelectedStuID)} ) RETURNING *"; qp.Select(deleteSql); } catch (Exception ex) { MsgBox.Show("刪除「刪除生活行為紀錄」資料失敗" + ex.Message); return; } LoadingData(); //LOG (刪除) StringBuilder sb = new StringBuilder(); StudentRecord sr = K12.Data.Student.SelectByID(this.PrimaryKey); sb.Append("班級「" + (string.IsNullOrEmpty(sr.RefClassID) ? "" : sr.Class.Name) + "」"); sb.Append("座號「" + (sr.SeatNo.HasValue ? sr.SeatNo.Value.ToString() : "") + "」"); sb.AppendLine("學生「" + sr.Name + "」"); foreach (BehaviorRecord behavior in behaviorList) { sb.AppendLine("日期「" + behavior.CreateDate + "」,生活行為紀錄已被刪除"); } ApplicationLog.Log("生活行為紀錄", "刪除生活行為紀錄", "student", this.PrimaryKey, sb.ToString()); }
/// <summary> /// 异常处理 /// </summary> /// <param name="e"></param> protected override void OnError(EventArgs e) { // 获取异常 Exception ex = Server.GetLastError(); // 写错误日志文件 ApplicationLog.Log(ex.Message); // 转向错误信息页面 Context.Session["SystemError"] = ex.Message; Context.Response.Redirect(@"http://" + urlSuffix + "/ErrorPage.aspx"); Server.ClearError(); }
private void btnSave_Click(object sender, EventArgs e) { string msg = _cir.CreateBy != FISCA.Authentication.DSAServices.UserAccount ? "注意:您並非此項目的開設者" : ""; if (MessageBox.Show("你是否要進行此操作? (儲存後無法修改)\n" + msg, "確認", MessageBoxButtons.OKCancel) == DialogResult.OK) //&& DataRowList.Count > 0) { List <string> log = new List <string>(); List <SLRecord> lslr = new List <SLRecord>(); try { lslr = takeoutSLRecordFormDataRow(DataRowList); tool._A.InsertValues(lslr); XElement xe = _cir.ApprovedDetail; int i = 1; foreach (ServiceDataRow sdr in DataRowList) { SLRecord item = sdr._slr; XElement tmpxe = new XElement("SLRecord"); tmpxe.Add(new XElement("RefStudentID", item.RefStudentID)); tmpxe.Add(new XElement("SchoolYear", item.SchoolYear)); tmpxe.Add(new XElement("Semester", item.Semester)); tmpxe.Add(new XElement("OccurDate", item.OccurDate)); tmpxe.Add(new XElement("Reason", item.Reason)); tmpxe.Add(new XElement("Hours", item.Hours)); tmpxe.Add(new XElement("Organizers", item.Organizers)); tmpxe.Add(new XElement("RegisterDate", item.RegisterDate)); tmpxe.Add(new XElement("Remark", item.Remark)); xe.Add(tmpxe); log.Add("" + i + ":學生系統編號:" + sdr.StudentID + ",學生姓名:" + sdr.StudentName + ",學號:" + sdr.StudentNumber + ",學年度:" + item.SchoolYear + ",學期:" + item.Semester + ",服務日期:" + item.OccurDate + ",服務事由:" + item.Reason + ",時數:" + item.Hours + ",主辦單位:" + item.Organizers + ",備註:" + item.Remark); i++; } _cir.ApprovedDetail = new XElement("這不會被用到"); _cir.Save(); } catch (Exception ex) { MsgBox.Show("資料更新發生錯誤!!\n" + ex.Message); return; } ApplicationLog.Log("服務學習線上開設", "登錄作業", "服務學習記錄\n已新增" + lslr.Count + "筆資料\n" + string.Join("\n", log)); MsgBox.Show("儲存成功!!"); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }
/// <summary> /// 儲存教師Log /// </summary> public static void SaveTeacherLogData() { StringBuilder sbTeracher = new StringBuilder(); if (_teacherLogData.Count > 0) { foreach (string str in _teacherLogData.Values) { sbTeracher.AppendLine(str); } } if (sbTeracher.Length > 0) { sbTeracher.AppendLine("總共永久刪除教師" + _teacherLogData.Values.Count + "筆"); ApplicationLog.Log("核心模組.永久刪除教師", sbTeracher.ToString()); } }
/// <summary> /// 儲存學生Log /// </summary> public static void SaveStudentLogData() { StringBuilder sbSud = new StringBuilder(); if (_studLogData.Count > 0) { foreach (string str in _studLogData.Values) { sbSud.AppendLine(str); } } if (sbSud.Length > 0) { sbSud.AppendLine("總共永久刪除學生" + _studLogData.Values.Count + "筆"); ApplicationLog.Log("核心模組.永久刪除學生", sbSud.ToString()); } }
/// <summary> /// 按下儲存時 /// </summary> /// <param name="e"></param> protected override void OnSaveButtonClick(EventArgs e) { StringBuilder sb = new StringBuilder(); sb.AppendLine("學生電子檔案索引系統「備註已修改」"); sb.AppendLine("姓名「" + GraduateOBJ.Name + "」"); sb.AppendLine("學號「" + GraduateOBJ.StudentNumber + "」"); sb.AppendLine("索引分類「" + GraduateOBJ.ArchiveNote + "」"); sb.AppendLine("====修改前===="); if (!string.IsNullOrEmpty(GraduateOBJ.Remarks)) { sb.AppendLine(GraduateOBJ.Remarks); } else { sb.AppendLine("(無內容)"); } sb.AppendLine("====修改後===="); if (!string.IsNullOrEmpty(textBoxX1.Text)) { sb.AppendLine(textBoxX1.Text); } else { sb.AppendLine("(無內容)"); } GraduateOBJ.Remarks = textBoxX1.Text; List <GraduateUDT> list = new List <GraduateUDT>(); list.Add(GraduateOBJ); _AccessHelper.UpdateValues(list.ToArray()); SaveButtonVisible = false; CancelButtonVisible = false; MsgBox.Show("儲存成功!"); ApplicationLog.Log("畢業生檔案檢索.備註", "修改", sb.ToString()); //this.Loading = true; BGW.RunWorkerAsync(); }
private void btnSave_Click(object sender, EventArgs e) { string msg = _cir.CreateBy != FISCA.Authentication.DSAServices.UserAccount ? "注意:您並非此項目的開設者" : ""; if (MessageBox.Show("你是否要進行此操作?\n" + msg, "確認", MessageBoxButtons.OKCancel) == DialogResult.OK) { List <string> log = new List <string>(); int i = 1; foreach (DataGridViewRow row in dataGridViewX1.Rows) { ((CreationItemsParticipateRecord)row.Tag).CanParticipate = row.Cells[5].Value.ToString() == "True" ? true : false; log.Add("" + i + ":年級:" + row.Cells[0].Value + ",班級:" + row.Cells[1].Value + ",座號:" + row.Cells[2].Value + ",姓名:" + row.Cells[3].Value + ",學號:" + row.Cells[4].Value + ",核可:" + (row.Cells[5].Value.ToString() == "True" ? "是" : "否")); i++; } lcipr.SaveAll(); ApplicationLog.Log("服務學習線上開設", "核可作業", "已核可" + dataGridViewX1.Rows.Count + "筆資料\n" + string.Join("\n", log)); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }
private static bool GetAdditionalInformation(CorporateCardTenderLineItem cardTenderLine, IApplication application) { ApplicationLog.Log("CorporateCard.GetAdditionalInformation", "Additional fleet card infomration", LogTraceLevel.Trace); bool result = false; using (frmInformation frmAddInfo = new frmInformation()) { application.ApplicationFramework.POSShowForm(frmAddInfo); if (frmAddInfo.DialogResult == DialogResult.OK) { cardTenderLine.DriverId = frmAddInfo.DriverId; cardTenderLine.VehicleId = frmAddInfo.VehicleId; cardTenderLine.OdometerReading = Convert.ToInt32(frmAddInfo.Odometer); result = true; } } return(result); }
/// <summary> /// Print Report for currently opend batch (X-Report) /// </summary> /// <param name="transaction"></param> public void PrintXReport(IPosTransaction transaction) { ApplicationLog.Log("EOD.PrintXReport", "Printing X report.", LogTraceLevel.Trace); if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()) { FiscalPrinter.FiscalPrinter.Instance.PrintXReport(transaction); return; } if (transaction == null) { NetTracer.Warning("transaction parameter is null"); throw new ArgumentNullException("transaction"); } Batch batch = new Batch(transaction.Shift); POSFormsManager.ShowPOSMessageWithBackgroundWorker(51303, delegate { batch.Calculate(); }); // Calculating transactions... POSFormsManager.ShowPOSMessageWithBackgroundWorker(99, delegate { batch.Print(ReportType.XReport); }); // Printing in progress... }
/// <summary> /// Print recently closed batch report (Z-Report) /// </summary> /// <param name="transaction"></param> public void PrintZReport(IPosTransaction transaction) { ApplicationLog.Log("EOD.PrintZReport", "Printing Z report.", LogTraceLevel.Trace); if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()) { FiscalPrinter.FiscalPrinter.Instance.PrintZReport(transaction); return; } BatchData batchData = new BatchData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID); Batch batch = batchData.ReadRecentlyClosedBatch(ApplicationSettings.Terminal.TerminalId); if (batch != null) { // Print batch. POSFormsManager.ShowPOSMessageWithBackgroundWorker(99, delegate { batch.Print(ReportType.ZReport); }); } else { NetTracer.Information("EDO::PrintZReport: batch is null"); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dataGridViewX1.SelectedRows.Count != 1) { return; } Item it = new Item(DataRowList[dataGridViewX1.SelectedRows[0].Index], filterOrganizers.Items); string log_before = "原 學年度:" + it._cir.SchoolYear + ",學期:" + it._cir.Semester + ",日期:" + it._cir.OccurDate + ",事由:" + it._cir.Reason + ",時數:" + it._cir.ExpectedHours + ",主辦單位:" + it._cir.Organizers + ",備註:" + it._cir.Remark; if (it.ShowDialog() == System.Windows.Forms.DialogResult.OK) { it._cir.Save(); if (it._cir.SchoolYear != int.Parse(filterSchoolYear.Text) || it._cir.Semester != int.Parse(filterSemester.Text)) { dataGridViewX1.Rows.RemoveAt(dataGridViewX1.SelectedRows[0].Index); DataRowList.Remove(it._cir); } ApplicationLog.Log("服務學習線上開設", "修改項目", "修改一筆\n" + log_before + "\n後 學年度:" + it._cir.SchoolYear + ",學期:" + it._cir.Semester + ",日期:" + it._cir.OccurDate + ",事由:" + it._cir.Reason + ",時數:" + it._cir.ExpectedHours + ",主辦單位:" + it._cir.Organizers + ",備註:" + it._cir.Remark); //RunSelect(); } }
internal void ExecuteLoadHistory() { if (!(this.Customer.IsEmptyCustomer() || this.historyLoadedFromAx)) { try { this.history = CS.GetCustomerHistory(this.Customer.CustomerId); } catch (Exception ex) { ApplicationLog.Log( typeof(Customer).ToString(), string.Format("{0}\n{1}", ApplicationLocalizer.Language.Translate(99412), ex.Message), //"an error occured in the operation" LogTraceLevel.Error); CS.InternalApplication.Services.Dialog.ShowMessage(99412, MessageBoxButtons.OK, MessageBoxIcon.Error); } this.historyLoadedFromAx = true; OnPropertyChanged("DateCreated"); OnPropertyChanged("LastVisitedStore"); OnPropertyChanged("LastVisitedDate"); OnPropertyChanged("TotalVisitsCount"); OnPropertyChanged("TotalSalesAmount"); } }