void btnDelete_Click(object sender, EventArgs e) { try { if (grdLister.CurrentRow != null && grdLister.CurrentRow is GridViewDataRowInfo) { long Id = grdLister.CurrentRow.Cells["Id"].Value.ToLong(); using (Taxi_Model.TaxiDataContext db = new Taxi_Model.TaxiDataContext()) { db.Messages.DeleteOnSubmit(db.Messages.FirstOrDefault(c => c.Id == Id)); db.SubmitChanges(); } PopulateData(); } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { if (chkDontRemind.Checked) { using (Taxi_Model.TaxiDataContext db = new Taxi_Model.TaxiDataContext()) { var obj = db.Gen_SysPolicy_Configurations.FirstOrDefault(c => c.SysPolicyId != null); if (obj.AccJobsShowNotificationDay.ToStr().Contains(",")) { obj.AccJobsShowNotificationDay = obj.AccJobsShowNotificationDay.ToStr().Remove(obj.AccJobsShowNotificationDay.ToStr().IndexOf(",")); obj.AccJobsShowNotificationDay += "," + string.Format("{0:dd/MM/yyyy}", DateTime.Now.ToDate()); } else { if (obj.AccJobsShowNotificationDay.ToStr() == string.Empty) { obj.AccJobsShowNotificationDay = DateTime.Now.DayOfWeek.ToStr() + "," + string.Format("{0:dd/MM/yyyy}", DateTime.Now.ToDate()); } else { obj.AccJobsShowNotificationDay += "," + string.Format("{0:dd/MM/yyyy}", DateTime.Now.ToDate()); } } db.SubmitChanges(); } } } catch (Exception ex) { } Close(); }