private Entities.TField LoadSingleTField(DataRow row) { Entities.TField model = new Entities.TField(); if (row["RecID"].ToString() != "") { model.RecID = int.Parse(row["RecID"].ToString()); } model.TFCode = row["TFCode"].ToString(); model.TFDesName = row["TFDesName"].ToString(); model.TFName = row["TFName"].ToString(); model.TTCode = row["TTCode"].ToString(); if (row["TTypeID"].ToString() != "") { model.TTypeID = int.Parse(row["TTypeID"].ToString()); } if (row["TFLen"].ToString() != "") { model.TFLen = int.Parse(row["TFLen"].ToString()); } model.TFDes = row["TFDes"].ToString(); if (row["TFInportIsNull"].ToString() != "") { model.TFInportIsNull = int.Parse(row["TFInportIsNull"].ToString()); } if (row["TFIsNull"].ToString() != "") { model.TFIsNull = int.Parse(row["TFIsNull"].ToString()); } if (row["TFSortIndex"].ToString() != "") { model.TFSortIndex = int.Parse(row["TFSortIndex"].ToString()); } model.TFCssName = row["TFCssName"].ToString(); if (row["TFIsExportShow"].ToString() != "") { model.TFIsExportShow = int.Parse(row["TFIsExportShow"].ToString()); } if (row["TFIsListShow"].ToString() != "") { model.TFIsListShow = int.Parse(row["TFIsListShow"].ToString()); } model.TFShowCode = row["TFShowCode"].ToString(); model.TFValue = row["TFValue"].ToString(); model.TFGenSubField = row["TFGenSubField"].ToString(); if (row["Status"].ToString() != "") { model.Status = int.Parse(row["Status"].ToString()); } if (row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["CreateUserID"].ToString() != "") { model.CreateUserID = int.Parse(row["CreateUserID"].ToString()); } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(SqlTransaction sqltran, Entities.TField model) { SqlParameter[] parameters = { new SqlParameter("@RecID", SqlDbType.Int, 4), new SqlParameter("@TFCode", SqlDbType.NVarChar, 20), new SqlParameter("@TFDesName", SqlDbType.NVarChar, 40), new SqlParameter("@TFName", SqlDbType.NVarChar, 40), new SqlParameter("@TTCode", SqlDbType.NVarChar, 20), new SqlParameter("@TTypeID", SqlDbType.Int, 4), new SqlParameter("@TFLen", SqlDbType.Int, 4), new SqlParameter("@TFDes", SqlDbType.NVarChar, 100), new SqlParameter("@TFInportIsNull", SqlDbType.Int, 4), new SqlParameter("@TFIsNull", SqlDbType.Int, 4), new SqlParameter("@TFSortIndex", SqlDbType.Int, 4), new SqlParameter("@TFCssName", SqlDbType.NVarChar, 200), new SqlParameter("@TFIsExportShow", SqlDbType.Int, 4), new SqlParameter("@TFIsListShow", SqlDbType.Int, 4), new SqlParameter("@TFShowCode", SqlDbType.NVarChar, 10), new SqlParameter("@TFValue", SqlDbType.NVarChar, 4000), new SqlParameter("@TFGenSubField", SqlDbType.NVarChar, 1000), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserID", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.TFCode; parameters[2].Value = model.TFDesName; parameters[3].Value = model.TFName; parameters[4].Value = model.TTCode; parameters[5].Value = model.TTypeID; parameters[6].Value = model.TFLen; parameters[7].Value = model.TFDes; parameters[8].Value = model.TFInportIsNull; parameters[9].Value = model.TFIsNull; parameters[10].Value = model.TFSortIndex; parameters[11].Value = model.TFCssName; parameters[12].Value = model.TFIsExportShow; parameters[13].Value = model.TFIsListShow; parameters[14].Value = model.TFShowCode; parameters[15].Value = model.TFValue; parameters[16].Value = model.TFGenSubField; parameters[17].Value = model.Status; parameters[18].Value = model.CreateTime; parameters[19].Value = model.CreateUserID; SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_TFIELD_INSERT, parameters); return((int)parameters[0].Value); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string jsonStr = ""; Entities.TField model = BLL.TField.Instance.GetTField(int.Parse(RecID)); if (model != null) { jsonStr = BLL.Common.JsonHelper.ToJsonString(model); } context.Response.Write(jsonStr); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.TField model) { SqlParameter[] parameters = { new SqlParameter("@RecID", SqlDbType.Int, 4), new SqlParameter("@TFCode", SqlDbType.NVarChar, 20), new SqlParameter("@TFDesName", SqlDbType.NVarChar, 40), new SqlParameter("@TFName", SqlDbType.NVarChar, 40), new SqlParameter("@TTCode", SqlDbType.NVarChar, 20), new SqlParameter("@TTypeID", SqlDbType.Int, 4), new SqlParameter("@TFLen", SqlDbType.Int, 4), new SqlParameter("@TFDes", SqlDbType.NVarChar, 100), new SqlParameter("@TFInportIsNull", SqlDbType.Int, 4), new SqlParameter("@TFIsNull", SqlDbType.Int, 4), new SqlParameter("@TFSortIndex", SqlDbType.Int, 4), new SqlParameter("@TFCssName", SqlDbType.NVarChar, 200), new SqlParameter("@TFIsExportShow", SqlDbType.Int, 4), new SqlParameter("@TFIsListShow", SqlDbType.Int, 4), new SqlParameter("@TFShowCode", SqlDbType.NVarChar, 10), new SqlParameter("@TFValue", SqlDbType.NVarChar, 4000), new SqlParameter("@TFGenSubField", SqlDbType.NVarChar, 1000), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserID", SqlDbType.Int, 4) }; parameters[0].Value = model.RecID; parameters[1].Value = model.TFCode; parameters[2].Value = model.TFDesName; parameters[3].Value = model.TFName; parameters[4].Value = model.TTCode; parameters[5].Value = model.TTypeID; parameters[6].Value = model.TFLen; parameters[7].Value = model.TFDes; parameters[8].Value = model.TFInportIsNull; parameters[9].Value = model.TFIsNull; parameters[10].Value = model.TFSortIndex; parameters[11].Value = model.TFCssName; parameters[12].Value = model.TFIsExportShow; parameters[13].Value = model.TFIsListShow; parameters[14].Value = model.TFShowCode; parameters[15].Value = model.TFValue; parameters[16].Value = model.TFGenSubField; parameters[17].Value = model.Status; parameters[18].Value = model.CreateTime; parameters[19].Value = model.CreateUserID; return(SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_TFIELD_UPDATE, parameters)); }
public List <Entities.TField> GetTFieldListByTTCode(string ttcode) { List <Entities.TField> list = new List <Entities.TField>(); Entities.QueryTField query = new QueryTField(); query.TTCode = ttcode; int totalCount = 0; DataTable dt = GetTField(query, "TFSortIndex", 1, 9999, out totalCount); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { Entities.TField model = LoadSingleTField(dr); list.Add(model); } } return(list); }
private void Submit(out string msg, int userID, out string returnTTCode) { msg = ""; returnTTCode = ""; string datainfoStr = DataStr; TemplateInfo tempInfoData = null; int templateStatus = -1;//模板状态 Entities.TPage tpageModel = new Entities.TPage(); Entities.TTable ttable = new Entities.TTable(); List <Entities.TField> editfieldList = new List <Entities.TField>(); List <Entities.TField> addfieldList = new List <Entities.TField>(); Entities.TField fieldModel = new Entities.TField(); List <Entities.TField> delFields = new List <Entities.TField>(); tempInfoData = (TemplateInfo)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(datainfoStr, typeof(TemplateInfo)); #region 验证数据 CheckMsg(tempInfoData, out msg); if (msg != "") { return; } #endregion #region 准备数据 if (tempInfoData.ttcode != "") { //编辑 #region 模板信息 tpageModel = BLL.TPage.Instance.GetTPageByTTCode(tempInfoData.ttcode); if (tpageModel != null) { //状态 templateStatus = BLL.TPage.Instance.getStatus(tpageModel.RecID.ToString(), tpageModel.Status.ToString()); if (templateStatus != 0) { msg += "模板当前状态下不允许编辑"; return; } tpageModel.TPName = tempInfoData.templateName; tpageModel.BGID = int.Parse(tempInfoData.BGID); tpageModel.SCID = int.Parse(tempInfoData.CID); tpageModel.TPContent = tempInfoData.templateDesc; tpageModel.IsShowBtn = int.Parse(tempInfoData.IsShowBtn); tpageModel.IsShowWorkOrderBtn = int.Parse(tempInfoData.IsShowWorkOrderBtn); tpageModel.IsShowSendMsgBtn = int.Parse(tempInfoData.IsShowSendMsgBtn); tpageModel.IsShowQiCheTong = int.Parse(tempInfoData.IsShowQiCheTong); tpageModel.IsShowSubmitOrder = int.Parse(tempInfoData.IsShowSubmitOrder); } else { msg += "没有找到相关模板信息"; return; } #endregion #region 自定义数据表 ttable = BLL.TTable.Instance.GetTTableByTTCode(tempInfoData.ttcode); if (ttable != null) { ttable.TTDesName = tempInfoData.templateName; } else { msg += "没有找到相关的自定义表信息"; return; } #endregion #region 编辑字段 editfieldList = BLL.TField.Instance.GetTFieldListByTTCode(tempInfoData.ttcode); List <FieldInfoData> updateFieldInfo = new List <FieldInfoData>(); #region 新增的 for (int i = tempInfoData.fieldListInfo.Length - 1; i >= 0; i--) { if (tempInfoData.fieldListInfo[i].RecID == "") { //新增 fieldModel = GetOneFieldMode(userID, tempInfoData.fieldListInfo[i], tpageModel.TTCode, ""); addfieldList.Add(fieldModel); } else { //编辑的 updateFieldInfo.Add(tempInfoData.fieldListInfo[i]); } } #endregion int existflog = 0; for (int i = editfieldList.Count - 1; i >= 0; i--) { existflog = 0; if (tempInfoData.fieldListInfo != null) { foreach (FieldInfoData field in updateFieldInfo) { if (field.RecID == editfieldList[i].RecID.ToString()) { //编辑 editfieldList[i].TFDesName = field.TFDesName; editfieldList[i].TFDes = field.TFDes; editfieldList[i].TFInportIsNull = int.Parse(field.TFInportIsNull); editfieldList[i].TFIsNull = int.Parse(field.TFIsNull); editfieldList[i].TFSortIndex = int.Parse(field.TFSortIndex); editfieldList[i].TFIsExportShow = int.Parse(field.TFIsExportShow); editfieldList[i].TFIsListShow = int.Parse(field.TFIsListShow); editfieldList[i].TFValue = field.TFValue; editfieldList[i].TFCssName = field.TFCssName; existflog = 1; } } // //在页面传来的对象中没有,是删除 if (existflog == 0) { //删除的 delFields.Add(editfieldList[i]); editfieldList.RemoveAt(i); } } } #endregion } else { //新增 #region 自定义数据表 int maxID = BLL.TTable.Instance.GetMaxID(); ttable.TTCode = "t" + maxID; ttable.TTDesName = tempInfoData.templateName; ttable.TTName = "Tempt" + maxID; ttable.Status = 0; ttable.CreateTime = DateTime.Now; ttable.CreateUserID = userID; #endregion #region 模板表 tpageModel.TPName = tempInfoData.templateName; tpageModel.BGID = int.Parse(tempInfoData.BGID); tpageModel.SCID = int.Parse(tempInfoData.CID); tpageModel.TPRef = ""; tpageModel.TTCode = ttable.TTCode; tpageModel.TPContent = tempInfoData.templateDesc; tpageModel.GenTempletPath = ""; tpageModel.Status = 0; tpageModel.Remark = ""; tpageModel.CreateTime = DateTime.Now; tpageModel.CreateUserID = userID; tpageModel.TTName = ttable.TTName; tpageModel.IsShowBtn = int.Parse(tempInfoData.IsShowBtn); tpageModel.IsShowWorkOrderBtn = int.Parse(tempInfoData.IsShowWorkOrderBtn); tpageModel.IsShowSendMsgBtn = int.Parse(tempInfoData.IsShowSendMsgBtn); tpageModel.IsShowQiCheTong = int.Parse(tempInfoData.IsShowQiCheTong); tpageModel.IsShowSubmitOrder = int.Parse(tempInfoData.IsShowSubmitOrder); tpageModel.IsUsed = -1; #endregion #region 字段 if (tempInfoData.fieldListInfo != null) { foreach (FieldInfoData item in tempInfoData.fieldListInfo) { string ttCode = ttable.TTCode; fieldModel = GetOneFieldMode(userID, item, ttCode, ""); addfieldList.Add(fieldModel); } } #endregion } #endregion #region 提交事务 string connectionstrings = ConfigurationUtil.GetAppSettingValue("ConnectionStrings_CC"); SqlConnection connection = new SqlConnection(connectionstrings); connection.Open(); SqlTransaction tran = connection.BeginTransaction("SampleTransaction"); try { if (tempInfoData.ttcode == "") { //新增 BLL.TPage.Instance.Insert(tran, tpageModel); BLL.TTable.Instance.Insert(tran, ttable); //新增的字段 foreach (Entities.TField item in addfieldList) { BLL.TField.Instance.Insert(tran, item); } returnTTCode = tpageModel.TTCode; } else { //编辑 BLL.TPage.Instance.Update(tran, tpageModel); BLL.TTable.Instance.Update(tran, ttable); //编辑的字段 foreach (Entities.TField item in editfieldList) { BLL.TField.Instance.Update(tran, item); } //新增的字段 foreach (Entities.TField item in addfieldList) { BLL.TField.Instance.Insert(tran, item); #region 如果已经生成模板,添加物理表的字段(修改为:模板生成了,还可以修改,⊙﹏⊙b汗) if (templateStatus == 1) { try { List <string> addNames = GetRealFieldName(item); foreach (string name in addNames) { BLL.TField.Instance.AddColumn(ttable.TTName, name, item.TTypeID.ToString()); } } catch (Exception ex) { msg += "添加数据表字段失败!<br>"; } } #endregion } //删除的字段 foreach (Entities.TField item in delFields) { BLL.TField.Instance.Delete(item.RecID); #region 如果已经生成模板,删除物理表的字段 if (templateStatus == 1) { try { List <string> delNames = GetRealFieldName(item); foreach (string name in delNames) { BLL.TField.Instance.DelColumn(ttable.TTName, name); } } catch (Exception ex) { msg += "删除数据表字段失败!<br>"; } } #endregion } returnTTCode = tpageModel.TTCode; } tran.Commit(); } catch (Exception ex) { if (tran.Connection != null) { tran.Rollback(); } msg = ex.Message.ToString(); } finally { connection.Close(); } #endregion }
private Entities.TField GetOneFieldMode(int userID, FieldInfoData item, string ttCode, string TFCode) { Entities.TField fieldModel = new Entities.TField(); if (TFCode == "") { if (maxFieldID == -2) { maxFieldID = BLL.TField.Instance.GetMaxID(); } else { maxFieldID++; } TFCode = "f" + maxFieldID; } fieldModel.TFCode = TFCode; fieldModel.TFDesName = item.TFDesName; if (item.TFShowCode == "100020") { //js中已经赋值 fieldModel.TFName = item.TFName; } else { fieldModel.TFName = "Tempf" + maxFieldID; } fieldModel.TTCode = ttCode; #region 字段类型和长度 switch (item.TFShowCode) { case "100001": case "100004": //复选 case "100006": case "100007": fieldModel.TTypeID = 1; fieldModel.TFLen = 200; break; case "100002": fieldModel.TTypeID = 1; fieldModel.TFLen = 2000; break; case "100003": //单选 fieldModel.TTypeID = 3; fieldModel.TFLen = 200; break; case "100005": //下拉 fieldModel.TTypeID = 3; fieldModel.TFLen = 200; break; case "100008": case "100009": case "100010": case "100011": fieldModel.TTypeID = 4; fieldModel.TFLen = 200; break; case "100012": case "100013": fieldModel.TTypeID = 3; fieldModel.TFLen = 200; break; case "100014": //CRM CustID fieldModel.TTypeID = 1; fieldModel.TFLen = 200; break; case "100019": //推荐活动 fieldModel.TTypeID = 1; fieldModel.TFLen = 4000; break; default: fieldModel.TTypeID = 1; fieldModel.TFLen = 200; break; } #endregion fieldModel.TFDes = item.TFDes; fieldModel.TFInportIsNull = int.Parse(item.TFInportIsNull); fieldModel.TFIsNull = int.Parse(item.TFIsNull); fieldModel.TFSortIndex = int.Parse(item.TFSortIndex); fieldModel.TFCssName = item.TFCssName; fieldModel.TFIsExportShow = 1; fieldModel.TFIsListShow = 1; fieldModel.TFShowCode = item.TFShowCode; fieldModel.TFValue = item.TFValue; fieldModel.TFGenSubField = ""; fieldModel.Status = 0; fieldModel.CreateTime = DateTime.Now; fieldModel.CreateUserID = userID; return(fieldModel); }
private static List <string> GetRealFieldName(Entities.TField item) { List <string> delNames = new List <string>(); #region 得到物理字段名字段 if (item.TFShowCode == "100009") { //日期段 delNames.Add(item.TFName + "_startdata"); delNames.Add(item.TFName + "_enddata"); } else if (item.TFShowCode == "100011") { //时间段 delNames.Add(item.TFName + "_starttime"); delNames.Add(item.TFName + "_endtime"); } else if (item.TFShowCode == "100012") { //二级省市 delNames.Add(item.TFName + "_Province"); delNames.Add(item.TFName + "_City"); delNames.Add(item.TFName + "_Province_name"); delNames.Add(item.TFName + "_City_name"); } else if (item.TFShowCode == "100013") { //三级省市县 delNames.Add(item.TFName + "_Province"); delNames.Add(item.TFName + "_City"); delNames.Add(item.TFName + "_Country"); delNames.Add(item.TFName + "_Province_name"); delNames.Add(item.TFName + "_City_name"); delNames.Add(item.TFName + "_Country_name"); } else if (item.TFShowCode == "100004")//复选 { delNames.Add(item.TFName + "_checkid"); delNames.Add(item.TFName + "_checkid_name"); } else if (item.TFShowCode == "100003")//单选 { delNames.Add(item.TFName + "_radioid"); delNames.Add(item.TFName + "_radioid_name"); } else if (item.TFShowCode == "100005")//下拉 { delNames.Add(item.TFName + "_selectid"); delNames.Add(item.TFName + "_selectid_name"); } else if (item.TFShowCode == "100014")//CRM CustID { delNames.Add(item.TFName + "_crmcustid_name"); } else { delNames.Add(item.TFName); } #endregion return(delNames); }
/// <summary> /// /// </summary> /// <param name="ProjectModel">项目</param> /// <param name="userId"></param> /// <param name="dt">项目的DataSource数据</param> /// <param name="msg"></param> public void GenByOtherTaskDataTable(Entities.ProjectInfo ProjectModel, int userId, DataTable dt, out string msg, out string data) { msg = ""; data = ""; #region panduan bool IsExistCrmCustID = false; string ttName = ""; string tfName = ""; List <Entities.TField> fieldlist = BLL.TField.Instance.GetTFieldListByTTCode(ProjectModel.TTCode); Entities.TField fielditem = fieldlist.Find(delegate(Entities.TField o) { return(o.TFShowCode == "100014"); }); if (fielditem != null) { IsExistCrmCustID = true; tfName = fielditem.TFName; Entities.TTable tableModel = BLL.TTable.Instance.GetTTableByTTCode(ProjectModel.TTCode); if (tableModel != null) { ttName = tableModel.TTName; } } #endregion #region 根据数据关联生成任务 List <Entities.OtherTaskInfo> list = new List <Entities.OtherTaskInfo>(); int maxcount = BLL.ProjectTaskInfo.Instance.GetMaxRecID();//从OtherTaskInfo表中查找最大值,不是ProjectTaskInfo表中查找最大值 DataTable SourceOtherTaskDt = new DataTable(); SourceOtherTaskDt.Columns.Add("PTID"); SourceOtherTaskDt.Columns.Add("ProjectID", typeof(int)); SourceOtherTaskDt.Columns.Add("RelationTableID"); SourceOtherTaskDt.Columns.Add("RelationID"); SourceOtherTaskDt.Columns.Add("CreateTime", typeof(DateTime)); SourceOtherTaskDt.Columns.Add("CreateUserID", typeof(int)); SourceOtherTaskDt.Columns.Add("LastOptTime", typeof(DateTime)); SourceOtherTaskDt.Columns.Add("LastOptUserID", typeof(int)); SourceOtherTaskDt.Columns.Add("TaskStatus", typeof(int)); SourceOtherTaskDt.Columns.Add("Status", typeof(int)); SourceOtherTaskDt.Columns.Add("CustID"); int i = 0; foreach (DataRow dr in dt.Rows) { DataRow newDr = SourceOtherTaskDt.NewRow(); string PixStr = ""; if (ProjectModel.Source == 4) { PixStr = "OTH"; } newDr["PTID"] = PixStr + (++maxcount).ToString().PadLeft(7, '0'); //记录最小id和最大id if (i == 0) { data += "{open:'@open',MinOtherTaskID:'" + newDr["PTID"] + "',"; } if (i + 1 == dt.Rows.Count) { data += "MaxOtherTaskID:'" + newDr["PTID"] + "'}"; } newDr["ProjectID"] = int.Parse(ProjectID); newDr["RelationTableID"] = ProjectModel.TTCode; newDr["RelationID"] = dr["RelationID"].ToString(); newDr["CreateTime"] = DateTime.Now; newDr["CreateUserID"] = userId; newDr["LastOptTime"] = DateTime.Now; newDr["LastOptUserID"] = userId; newDr["TaskStatus"] = (int)(OtheTaskStatus.Unallocated); newDr["Status"] = 0; if (IsExistCrmCustID) { newDr["CustID"] = GetCustID(ProjectModel, ttName, tfName, dr["RelationID"].ToString()); } else { newDr["CustID"] = ""; } SourceOtherTaskDt.Rows.Add(newDr); i++; } string connectionstrings = ConfigurationUtil.GetAppSettingValue("ConnectionStrings_CC"); SqlConnection connection = new SqlConnection(connectionstrings); connection.Open(); SqlTransaction tran = connection.BeginTransaction("SampleTransaction"); try { BLL.Util.BulkCopyToDB(SourceOtherTaskDt, connectionstrings, "OtherTaskInfo", tran, out msg); BLL.ProjectLog.Instance.InsertProjectLog(ProjectModel.ProjectID, ProjectLogOper.L6_生成任务, "生成任务" + SourceOtherTaskDt.Rows.Count + "条", tran); if (msg == "") { #region 修改项目状态 ProjectModel.Status = 1; BLL.ProjectInfo.Instance.Update(tran, ProjectModel); #endregion #region 修改关联数据状态 BLL.ProjectDataSoure.Instance.UpdateStatusByProjectId(tran, "1", dt, (int)ProjectModel.ProjectID); #endregion tran.Commit(); } } catch (Exception ex) { if (tran.Connection != null) { tran.Rollback(); } msg = ex.Message.ToString(); } finally { connection.Close(); } #endregion }
/// <summary> /// 更新一条数据 /// </summary> public int Update(SqlTransaction sqltran, Entities.TField model) { return(Dal.TField.Instance.Update(sqltran, model)); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.TField model) { return(Dal.TField.Instance.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(SqlTransaction sqltran, Entities.TField model) { return(Dal.TField.Instance.Insert(sqltran, model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.TField model) { return(Dal.TField.Instance.Insert(model)); }