public ModelInvokeResult <ReminderPK> Create(Reminder reminder) { ModelInvokeResult <ReminderPK> result = new ModelInvokeResult <ReminderPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); if (reminder.Id == -1) { reminder.Id = null; } statements.Add(new IBatisNetBatchStatement { StatementName = reminder.GetCreateMethodName(), ParameterObject = reminder.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new ReminderPK { Id = reminder.Id }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult CreateReminderByCall(ReminderInfo reminderInfo) { InvokeResult result = new InvokeResult { Success = true }; CollectionInvokeResult <StringObjectDictionary> result2 = new CollectionInvokeResult <StringObjectDictionary> { Success = true }; reminderInfo.CallNo = base.GetHttpHeader("MobileNo"); try { StringObjectDictionary filters = new { RemindTime = reminderInfo.LastTime, SourceType = reminderInfo.SourceType, CallNo = reminderInfo.CallNo, OrderByClause = " RemindTime desc" }.ToStringObjectDictionary(); result2.rows = BuilderFactory.DefaultBulder().ListStringObjectDictionary("Reminder_By_CallNo_List", filters); Reminder reminder = new Reminder(); foreach (var item in result2.rows) { reminder.Id = item["Id"] == null ? 0 : Int32.Parse(item["Id"].ToString()); reminder.SourceKey = item["OldManId"].ToString(); } reminder.SourceTable = "Oca_OldManConfigInfo"; reminder.SourceColumn = "OldManId"; reminder.SourceType = reminderInfo.SourceType; reminder.RemindTime = Convert.ToDateTime(reminderInfo.LastTime); reminder.RemindContent = reminderInfo.RemindContent; if (reminder.Id > 0) { result.Success = false; } else { reminder.Id = null; List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); statements.Add(new IBatisNetBatchStatement { StatementName = reminder.GetCreateMethodName(), ParameterObject = reminder.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT }); BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } } catch (Exception e) { result.Success = false; result.ErrorMessage = e.Message; } return(result); }