public void ChangeGuidToCaseId(string guid, string caseid, IDbTransaction tran) { StringBuilder strSql = new StringBuilder(); strSql.AppendFormat("select * from B_OA_Supervision_Reminder_Notice where caseid = '{0}'", guid); DataSet ds = Utility.Database.ExcuteDataSet(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { string jsonData = JsonConvert.SerializeObject(ds.Tables[0]); List<B_OA_Supervision_Reminder_Notice> list = (List<B_OA_Supervision_Reminder_Notice>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_OA_Supervision_Reminder_Notice>)); for (int i = 0; i < list.Count; i++) { B_OA_Supervision_Reminder_Notice notice = new B_OA_Supervision_Reminder_Notice(); notice = list[i]; notice.caseid = caseid; notice.Condition.Add("id = " + notice.id); Utility.Database.Update(notice, tran); } } }
public string GetSupervisionReminderNotice(string keyId) { IDbTransaction tran = Utility.Database.BeginDbTransaction(); GetDataModel dataModel = new GetDataModel(); B_OA_Supervision_Reminder_Notice reminderNotice = new B_OA_Supervision_Reminder_Notice(); try { reminderNotice.Condition.Add("caseid = " + keyId); B_OA_Supervision_Reminder_Notice result = Utility.Database.QueryObject<B_OA_Supervision_Reminder_Notice>(reminderNotice, tran); if (result == null) { reminderNotice.year = DateTime.Now.Year.ToString(); reminderNotice.createDate = DateTime.Now.ToString(); reminderNotice.supervisionDate = DateTime.Now.ToString("yyyy年MM月dd日"); } else { reminderNotice = result; } dataModel.reminderNoticeBaseInfor = reminderNotice; Utility.Database.Commit(tran); return Utility.JsonResult(true, "保存成功", dataModel); } catch (Exception e) { Utility.Database.Rollback(tran); return Utility.JsonResult(false, "数据加载失败!异常信息: " + e.Message); } }