public bool Update(Model_DictionarySQlMaintenance model) { StringBuilder builder = new StringBuilder(); builder.Append("update DictionarySQlMaintenance set "); builder.Append("DictionarySQlMaintenance_ID=@DictionarySQlMaintenance_ID,"); builder.Append("DictionarySQlMaintenance_Mark=@DictionarySQlMaintenance_Mark,"); builder.Append("DictionarySQlMaintenance_Name=@DictionarySQlMaintenance_Name,"); builder.Append("DictionarySQlMaintenance_Explanation=@DictionarySQlMaintenance_Explanation,"); builder.Append("DictionarySQlMaintenance_SQL=@DictionarySQlMaintenance_SQL,"); builder.Append("DictionarySQlMaintenance_CretateUser=@DictionarySQlMaintenance_CretateUser,"); builder.Append("DictionarySQlMaintenance_CreateTime=@DictionarySQlMaintenance_CreateTime,"); builder.Append("DictionarySQlMaintenance_UpdateUser=@DictionarySQlMaintenance_UpdateUser,"); builder.Append("DictionarySQlMaintenance_UpdateTime=@DictionarySQlMaintenance_UpdateTime"); builder.Append(" where "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@DictionarySQlMaintenance_ID", SqlDbType.Char, 0x24), new SqlParameter("@DictionarySQlMaintenance_Mark", SqlDbType.NVarChar, 100), new SqlParameter("@DictionarySQlMaintenance_Name", SqlDbType.NVarChar, 100), new SqlParameter("@DictionarySQlMaintenance_Explanation", SqlDbType.NVarChar, 400), new SqlParameter("@DictionarySQlMaintenance_SQL", SqlDbType.NVarChar, 0xfa0), new SqlParameter("@DictionarySQlMaintenance_CretateUser", SqlDbType.Char, 0x24), new SqlParameter("@DictionarySQlMaintenance_CreateTime", SqlDbType.DateTime), new SqlParameter("@DictionarySQlMaintenance_UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@DictionarySQlMaintenance_UpdateTime", SqlDbType.DateTime) }; cmdParms[0].Value = model.DictionarySQlMaintenance_ID; cmdParms[1].Value = model.DictionarySQlMaintenance_Mark; cmdParms[2].Value = model.DictionarySQlMaintenance_Name; cmdParms[3].Value = model.DictionarySQlMaintenance_Explanation; cmdParms[4].Value = model.DictionarySQlMaintenance_SQL; cmdParms[5].Value = model.DictionarySQlMaintenance_CretateUser; cmdParms[6].Value = model.DictionarySQlMaintenance_CreateTime; cmdParms[7].Value = model.DictionarySQlMaintenance_UpdateUser; cmdParms[8].Value = model.DictionarySQlMaintenance_UpdateTime; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
//从页面上获取模板数据 private Model_DictionarySQlMaintenance GetDictionarySQlMaintenanceFromPage() { Model_DictionarySQlMaintenance sysModel = null; switch (actionType) { case DictionarySQlMaintenance.Add: sysModel = new Model_DictionarySQlMaintenance(); sysModel.DictionarySQlMaintenance_ID = Guid.NewGuid().ToString(); sysModel.DictionarySQlMaintenance_CreateTime = DateTime.Now; sysModel.DictionarySQlMaintenance_CretateUser = loginUser.SysUser_ID; break; case DictionarySQlMaintenance.Edit: sysModel = GetDictionarySQlMaintenanceInfo(); sysModel.DictionarySQlMaintenance_UpdateTime = DateTime.Now; sysModel.DictionarySQlMaintenance_UpdateUser = loginUser.SysUser_ID; break; } sysModel.DictionarySQlMaintenance_Mark = txtConfigName.Text.Trim(); sysModel.DictionarySQlMaintenance_Name = txtName.Text.Trim(); sysModel.DictionarySQlMaintenance_Explanation = txtDesc.Text.Trim(); sysModel.DictionarySQlMaintenance_SQL = clsUtility.Encrypt(txtSqlString.Text.Trim()); return(sysModel); }
private int UpdateNew(DbTransaction tran, Model_DictionarySQlMaintenance model) { StringBuilder builder = new StringBuilder(); builder.Append(" UPDATE "); builder.Append(" DictionarySQlMaintenance "); builder.Append(" SET "); builder.Append(" DictionarySQlMaintenance_ID=@DictionarySQlMaintenance_ID,DictionarySQlMaintenance_Mark=@DictionarySQlMaintenance_Mark,DictionarySQlMaintenance_Name=@DictionarySQlMaintenance_Name,DictionarySQlMaintenance_Explanation=@DictionarySQlMaintenance_Explanation,DictionarySQlMaintenance_SQL=@DictionarySQlMaintenance_SQL,DictionarySQlMaintenance_CretateUser=@DictionarySQlMaintenance_CretateUser,DictionarySQlMaintenance_CreateTime=@DictionarySQlMaintenance_CreateTime,DictionarySQlMaintenance_UpdateUser=@DictionarySQlMaintenance_UpdateUser,DictionarySQlMaintenance_UpdateTime=@DictionarySQlMaintenance_UpdateTime "); builder.Append(" WHERE "); builder.Append(" DictionarySQlMaintenance_ID=@DictionarySQlMaintenance_ID "); return(this.CurrDB.ExecuteNonQuery(builder.ToString(), tran, new object[] { model.DictionarySQlMaintenance_ID, model.DictionarySQlMaintenance_Mark, model.DictionarySQlMaintenance_Name, model.DictionarySQlMaintenance_Explanation, model.DictionarySQlMaintenance_SQL, model.DictionarySQlMaintenance_CretateUser, model.DictionarySQlMaintenance_CreateTime, model.DictionarySQlMaintenance_UpdateUser, model.DictionarySQlMaintenance_UpdateTime })); }
private int AddNew(DbTransaction tran, Model_DictionarySQlMaintenance model) { StringBuilder builder = new StringBuilder(); builder.Append(" INSERT INTO "); builder.Append(" DictionarySQlMaintenance( "); builder.Append(" DictionarySQlMaintenance_ID,DictionarySQlMaintenance_Mark,DictionarySQlMaintenance_Name,DictionarySQlMaintenance_Explanation,DictionarySQlMaintenance_SQL,DictionarySQlMaintenance_CretateUser,DictionarySQlMaintenance_CreateTime,DictionarySQlMaintenance_UpdateUser,DictionarySQlMaintenance_UpdateTime "); builder.Append(" ) "); builder.Append(" values( "); builder.Append(" @DictionarySQlMaintenance_ID,@DictionarySQlMaintenance_Mark,@DictionarySQlMaintenance_Name,@DictionarySQlMaintenance_Explanation,@DictionarySQlMaintenance_SQL,@DictionarySQlMaintenance_CretateUser,@DictionarySQlMaintenance_CreateTime,@DictionarySQlMaintenance_UpdateUser,@DictionarySQlMaintenance_UpdateTime "); builder.Append(" ) "); return(this.CurrDB.ExecuteNonQuery(builder.ToString(), tran, new object[] { model.DictionarySQlMaintenance_ID, model.DictionarySQlMaintenance_Mark, model.DictionarySQlMaintenance_Name, model.DictionarySQlMaintenance_Explanation, model.DictionarySQlMaintenance_SQL, model.DictionarySQlMaintenance_CretateUser, model.DictionarySQlMaintenance_CreateTime, model.DictionarySQlMaintenance_UpdateUser, model.DictionarySQlMaintenance_UpdateTime })); }
public bool IsOrNotExists(Model_DictionarySQlMaintenance model, int i) { StringBuilder builder = new StringBuilder(); builder.Append("select count(1) from DictionarySQlMaintenance"); if (i == 0) { builder.AppendFormat(" where 1=1 and DictionarySQlMaintenance_ID<>'{0}' AND DictionarySQlMaintenance_Mark='{1}' ", model.DictionarySQlMaintenance_ID, model.DictionarySQlMaintenance_Mark); } else { builder.AppendFormat(" where 1=1 and DictionarySQlMaintenance_Mark='{0}'", model.DictionarySQlMaintenance_Mark); } return(int.Parse(DbHelperSQL.GetSingle(builder.ToString()).ToString()) > 0); }
public Model_DictionarySQlMaintenance DataRowToModel(DataRow row) { Model_DictionarySQlMaintenance maintenance = new Model_DictionarySQlMaintenance(); if (row != null) { if (row["DictionarySQlMaintenance_ID"] != null) { maintenance.DictionarySQlMaintenance_ID = row["DictionarySQlMaintenance_ID"].ToString(); } if (row["DictionarySQlMaintenance_Mark"] != null) { maintenance.DictionarySQlMaintenance_Mark = row["DictionarySQlMaintenance_Mark"].ToString(); } if (row["DictionarySQlMaintenance_Name"] != null) { maintenance.DictionarySQlMaintenance_Name = row["DictionarySQlMaintenance_Name"].ToString(); } if (row["DictionarySQlMaintenance_Explanation"] != null) { maintenance.DictionarySQlMaintenance_Explanation = row["DictionarySQlMaintenance_Explanation"].ToString(); } if (row["DictionarySQlMaintenance_SQL"] != null) { maintenance.DictionarySQlMaintenance_SQL = row["DictionarySQlMaintenance_SQL"].ToString(); } if (row["DictionarySQlMaintenance_CretateUser"] != null) { maintenance.DictionarySQlMaintenance_CretateUser = row["DictionarySQlMaintenance_CretateUser"].ToString(); } if ((row["DictionarySQlMaintenance_CreateTime"] != null) && (row["DictionarySQlMaintenance_CreateTime"].ToString() != "")) { maintenance.DictionarySQlMaintenance_CreateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_CreateTime"].ToString())); } if (row["DictionarySQlMaintenance_UpdateUser"] != null) { maintenance.DictionarySQlMaintenance_UpdateUser = row["DictionarySQlMaintenance_UpdateUser"].ToString(); } if ((row["DictionarySQlMaintenance_UpdateTime"] != null) && (row["DictionarySQlMaintenance_UpdateTime"].ToString() != "")) { maintenance.DictionarySQlMaintenance_UpdateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_UpdateTime"].ToString())); } } return(maintenance); }
public List <Model_DictionarySQlMaintenance> DataTableToList(DataTable dt) { List <Model_DictionarySQlMaintenance> list = new List <Model_DictionarySQlMaintenance>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_DictionarySQlMaintenance item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Add(Model_DictionarySQlMaintenance model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into DictionarySQlMaintenance("); builder.Append("DictionarySQlMaintenance_ID,DictionarySQlMaintenance_Mark,DictionarySQlMaintenance_Name,DictionarySQlMaintenance_Explanation,DictionarySQlMaintenance_SQL,DictionarySQlMaintenance_CretateUser,DictionarySQlMaintenance_CreateTime,DictionarySQlMaintenance_UpdateUser,DictionarySQlMaintenance_UpdateTime)"); builder.Append(" values ("); builder.Append("@DictionarySQlMaintenance_ID,@DictionarySQlMaintenance_Mark,@DictionarySQlMaintenance_Name,@DictionarySQlMaintenance_Explanation,@DictionarySQlMaintenance_SQL,@DictionarySQlMaintenance_CretateUser,@DictionarySQlMaintenance_CreateTime,@DictionarySQlMaintenance_UpdateUser,@DictionarySQlMaintenance_UpdateTime)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@DictionarySQlMaintenance_ID", SqlDbType.Char, 0x24), new SqlParameter("@DictionarySQlMaintenance_Mark", SqlDbType.NVarChar, 100), new SqlParameter("@DictionarySQlMaintenance_Name", SqlDbType.NVarChar, 100), new SqlParameter("@DictionarySQlMaintenance_Explanation", SqlDbType.NVarChar, 400), new SqlParameter("@DictionarySQlMaintenance_SQL", SqlDbType.NVarChar, 0xfa0), new SqlParameter("@DictionarySQlMaintenance_CretateUser", SqlDbType.Char, 0x24), new SqlParameter("@DictionarySQlMaintenance_CreateTime", SqlDbType.DateTime), new SqlParameter("@DictionarySQlMaintenance_UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@DictionarySQlMaintenance_UpdateTime", SqlDbType.DateTime) }; cmdParms[0].Value = model.DictionarySQlMaintenance_ID; cmdParms[1].Value = model.DictionarySQlMaintenance_Mark; cmdParms[2].Value = model.DictionarySQlMaintenance_Name; cmdParms[3].Value = model.DictionarySQlMaintenance_Explanation; cmdParms[4].Value = model.DictionarySQlMaintenance_SQL; cmdParms[5].Value = model.DictionarySQlMaintenance_CretateUser; cmdParms[6].Value = model.DictionarySQlMaintenance_CreateTime; cmdParms[7].Value = model.DictionarySQlMaintenance_UpdateUser; cmdParms[8].Value = model.DictionarySQlMaintenance_UpdateTime; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public int UpdateNew(Model_DictionarySQlMaintenance model) { return(this.DAL.UpdateNew(model)); }
public int AddNew(Model_DictionarySQlMaintenance model) { return(this.DAL.AddNew(model)); }
private List <Model_DictionarySQlMaintenance> GetDictionarySQlMaintenanceModelList(DbTransaction tran, int recordNum, string orderColumn, string orderType, string strCondition, params object[] param) { StringBuilder builder = new StringBuilder(); builder.Append(" SELECT "); if (recordNum > 0) { builder.Append(" TOP " + recordNum); } builder.Append(" * "); builder.Append(" FROM "); builder.Append(" DictionarySQlMaintenance "); if (!string.IsNullOrEmpty(strCondition)) { builder.Append(" WHERE "); builder.Append(strCondition); } if (!string.IsNullOrEmpty(orderColumn)) { builder.Append(" ORDER BY "); builder.Append(orderColumn); if (!string.IsNullOrEmpty(orderType)) { builder.Append(" " + orderType); } } DataSet set = this.CurrDB.ExecuteDataSet(builder.ToString(), tran, param); List <Model_DictionarySQlMaintenance> list = new List <Model_DictionarySQlMaintenance>(); Model_DictionarySQlMaintenance item = null; foreach (DataRow row in set.Tables[0].Rows) { item = new Model_DictionarySQlMaintenance(); if (row["DictionarySQlMaintenance_ID"] != null) { item.DictionarySQlMaintenance_ID = row["DictionarySQlMaintenance_ID"].ToString(); } if (row["DictionarySQlMaintenance_Mark"] != null) { item.DictionarySQlMaintenance_Mark = row["DictionarySQlMaintenance_Mark"].ToString(); } if (row["DictionarySQlMaintenance_Name"] != null) { item.DictionarySQlMaintenance_Name = row["DictionarySQlMaintenance_Name"].ToString(); } if (row["DictionarySQlMaintenance_Explanation"] != null) { item.DictionarySQlMaintenance_Explanation = row["DictionarySQlMaintenance_Explanation"].ToString(); } if (row["DictionarySQlMaintenance_SQL"] != null) { item.DictionarySQlMaintenance_SQL = row["DictionarySQlMaintenance_SQL"].ToString(); } if (row["DictionarySQlMaintenance_CretateUser"] != null) { item.DictionarySQlMaintenance_CretateUser = row["DictionarySQlMaintenance_CretateUser"].ToString(); } if (row["DictionarySQlMaintenance_CreateTime"] != null) { if (string.IsNullOrWhiteSpace(row["DictionarySQlMaintenance_CreateTime"].ToString())) { item.DictionarySQlMaintenance_CreateTime = null; } else { item.DictionarySQlMaintenance_CreateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_CreateTime"].ToString())); } } if (row["DictionarySQlMaintenance_UpdateUser"] != null) { item.DictionarySQlMaintenance_UpdateUser = row["DictionarySQlMaintenance_UpdateUser"].ToString(); } if (row["DictionarySQlMaintenance_UpdateTime"] != null) { if (string.IsNullOrWhiteSpace(row["DictionarySQlMaintenance_UpdateTime"].ToString())) { item.DictionarySQlMaintenance_UpdateTime = null; } else { item.DictionarySQlMaintenance_UpdateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_UpdateTime"].ToString())); } } list.Add(item); } return(list); }
public bool IsOrNotExists(Model_DictionarySQlMaintenance model, int i) { return(this.DAL.IsOrNotExists(model, i)); }
public bool Add(Model_DictionarySQlMaintenance model) { return(this.dal.Add(model)); }
public bool Update(Model_DictionarySQlMaintenance model) { return(this.dal.Update(model)); }
private List <Model_DictionarySQlMaintenance> GetDictionarySQlMaintenanceModelListByPage(DbTransaction tran, int pageSize, int pageIndex, string orderColumn, string orderType, string strCondition, params object[] param) { if ((pageSize <= 0) || (pageIndex <= 0)) { throw new Exception("分页参数错误,必须大于零"); } if (string.IsNullOrEmpty(orderColumn)) { throw new Exception("排序字段必须填写"); } int num = ((pageIndex - 1) * pageSize) + 1; int num2 = pageIndex * pageSize; StringBuilder builder = new StringBuilder(); builder.Append(" SELECT * FROM ("); builder.Append(string.Format(" SELECT (ROW_NUMBER() OVER(ORDER BY {0} {1})) as rownum,* FROM DictionarySQlMaintenance", orderColumn, orderType)); if (!string.IsNullOrWhiteSpace(strCondition)) { builder.Append(" WHERE "); builder.Append(strCondition); } builder.Append(" ) t "); builder.Append(" WHERE rownum between "); builder.Append(string.Format(" {0} ", num)); builder.Append(" AND "); builder.Append(string.Format(" {0} ", num2)); DataSet set = this.CurrDB.ExecuteDataSet(builder.ToString(), tran, param); List <Model_DictionarySQlMaintenance> list = new List <Model_DictionarySQlMaintenance>(); Model_DictionarySQlMaintenance item = null; foreach (DataRow row in set.Tables[0].Rows) { item = new Model_DictionarySQlMaintenance(); if (row["DictionarySQlMaintenance_ID"] != null) { item.DictionarySQlMaintenance_ID = row["DictionarySQlMaintenance_ID"].ToString(); } if (row["DictionarySQlMaintenance_Mark"] != null) { item.DictionarySQlMaintenance_Mark = row["DictionarySQlMaintenance_Mark"].ToString(); } if (row["DictionarySQlMaintenance_Name"] != null) { item.DictionarySQlMaintenance_Name = row["DictionarySQlMaintenance_Name"].ToString(); } if (row["DictionarySQlMaintenance_Explanation"] != null) { item.DictionarySQlMaintenance_Explanation = row["DictionarySQlMaintenance_Explanation"].ToString(); } if (row["DictionarySQlMaintenance_SQL"] != null) { item.DictionarySQlMaintenance_SQL = row["DictionarySQlMaintenance_SQL"].ToString(); } if (row["DictionarySQlMaintenance_CretateUser"] != null) { item.DictionarySQlMaintenance_CretateUser = row["DictionarySQlMaintenance_CretateUser"].ToString(); } if (row["DictionarySQlMaintenance_CreateTime"] != null) { if (string.IsNullOrWhiteSpace(row["DictionarySQlMaintenance_CreateTime"].ToString())) { item.DictionarySQlMaintenance_CreateTime = null; } else { item.DictionarySQlMaintenance_CreateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_CreateTime"].ToString())); } } if (row["DictionarySQlMaintenance_UpdateUser"] != null) { item.DictionarySQlMaintenance_UpdateUser = row["DictionarySQlMaintenance_UpdateUser"].ToString(); } if (row["DictionarySQlMaintenance_UpdateTime"] != null) { if (string.IsNullOrWhiteSpace(row["DictionarySQlMaintenance_UpdateTime"].ToString())) { item.DictionarySQlMaintenance_UpdateTime = null; } else { item.DictionarySQlMaintenance_UpdateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_UpdateTime"].ToString())); } } list.Add(item); } return(list); }
private Model_DictionarySQlMaintenance GetDictionarySQlMaintenanceModelByPKNew(DbTransaction tran, string dictionarysqlmaintenance_id) { StringBuilder builder = new StringBuilder(); builder.Append(" SELECT "); builder.Append(" TOP 1 * "); builder.Append(" FROM "); builder.Append(" DictionarySQlMaintenance "); builder.Append(" WHERE "); builder.Append(" DictionarySQlMaintenance_ID=@DictionarySQlMaintenance_ID "); DataSet set = this.CurrDB.ExecuteDataSet(builder.ToString(), tran, new object[] { dictionarysqlmaintenance_id }); Model_DictionarySQlMaintenance maintenance = null; if (set.Tables[0].Rows.Count > 0) { DataRow row = set.Tables[0].Rows[0]; maintenance = new Model_DictionarySQlMaintenance(); if (row["DictionarySQlMaintenance_ID"] != null) { maintenance.DictionarySQlMaintenance_ID = row["DictionarySQlMaintenance_ID"].ToString(); } if (row["DictionarySQlMaintenance_Mark"] != null) { maintenance.DictionarySQlMaintenance_Mark = row["DictionarySQlMaintenance_Mark"].ToString(); } if (row["DictionarySQlMaintenance_Name"] != null) { maintenance.DictionarySQlMaintenance_Name = row["DictionarySQlMaintenance_Name"].ToString(); } if (row["DictionarySQlMaintenance_Explanation"] != null) { maintenance.DictionarySQlMaintenance_Explanation = row["DictionarySQlMaintenance_Explanation"].ToString(); } if (row["DictionarySQlMaintenance_SQL"] != null) { maintenance.DictionarySQlMaintenance_SQL = row["DictionarySQlMaintenance_SQL"].ToString(); } if (row["DictionarySQlMaintenance_CretateUser"] != null) { maintenance.DictionarySQlMaintenance_CretateUser = row["DictionarySQlMaintenance_CretateUser"].ToString(); } if (row["DictionarySQlMaintenance_CreateTime"] != null) { if (string.IsNullOrWhiteSpace(row["DictionarySQlMaintenance_CreateTime"].ToString())) { maintenance.DictionarySQlMaintenance_CreateTime = null; } else { maintenance.DictionarySQlMaintenance_CreateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_CreateTime"].ToString())); } } if (row["DictionarySQlMaintenance_UpdateUser"] != null) { maintenance.DictionarySQlMaintenance_UpdateUser = row["DictionarySQlMaintenance_UpdateUser"].ToString(); } if (row["DictionarySQlMaintenance_UpdateTime"] == null) { return(maintenance); } if (string.IsNullOrWhiteSpace(row["DictionarySQlMaintenance_UpdateTime"].ToString())) { maintenance.DictionarySQlMaintenance_UpdateTime = null; return(maintenance); } maintenance.DictionarySQlMaintenance_UpdateTime = new DateTime?(DateTime.Parse(row["DictionarySQlMaintenance_UpdateTime"].ToString())); } return(maintenance); }
public int Update(Model_DictionarySQlMaintenance model) { return(this.Update(null, model)); }
//验证是否存在 private bool IsOrNotExists(Model_DictionarySQlMaintenance model, int i) { return(BLL.IsOrNotExists(model, i)); }
public int Add(Model_DictionarySQlMaintenance model) { return(this.Add(null, model)); }