private void CalendarGetBodyCompleted(Object sender, krw.CalendarGetBodyCompletedEventArgs Completed) { try { string result = Completed.Result; switch (result.Substring(0, Base.srvMsgLen)) { case Base.srvMsgSuccess: Base.Loading(this, false); result = result.Substring(Base.srvMsgLen).Trim(); frm = new frmCalendarAddEdit(); frm.mode = "Edit"; DataGridView dgv = new DataGridView(); string[] mm = { }; switch (lang) { case "calendarfa": mm = months; dgv = dgvCalendar; break; case "calendaren": mm = monthsEn; dgv = dgvCalendarEn; break; case "calendarar": mm = monthsAr; dgv = dgvCalendarAr; break; default: break; } int m = -1; for (int i = 0; i < mm.Length; i++) { if (dgv.CurrentRow.Cells[0].Value.ToString().Trim() == mm[i].Trim()) { m = i; break; } } frm.months = mm; frm.returnMonth = m.ToString().Trim(); frm.returnDay = dgv.CurrentRow.Cells[1].Value.ToString().Trim(); frm.returnTitle = dgv.CurrentRow.Cells[2].Value.ToString().Trim(); frm.returnBody = result.Trim(); frm.ShowDialog(this); if (!frm.wasCanceled) { SendRequest("CalendarEdit"); } break; case Base.srvMsgErr: result = result.Substring(Base.srvMsgLen); switch (result) { case "Not Found": MessageBox.Show("رخدادی با عنوان موردنظر جهت ویرایش یافت نشد", Base.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); Base.Loading(this, false); break; case Base.srvMsgInvalidLegal: MessageBox.Show(Base.errPrefix + result, Base.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); DoExit(); break; default: TryRequest("CalendarGetBody", result); break; } break; default: TryRequest("CalendarGetBody", result); break; } } catch (SoapException ex) { TryRequest("CalendarGetBody", ex.Message + "\n\n" + ex.InnerException.Message); } catch (Exception ex) { TryRequest("CalendarGetBody", ex.Message + "\n\n" + ex.InnerException.Message); } finally { } }
private void tmiCalendarInsert_Click(object sender, EventArgs e) { frm = new frmCalendarAddEdit(); frm.mode = "Add"; switch (lang) { case "calendarfa": frm.months = months; break; case "calendaren": frm.months = monthsEn; break; case "calendarar": frm.months = monthsAr; break; default: break; } frm.ShowDialog(this); if (!frm.wasCanceled) { SendRequest("CalendarAdd"); } }