/// <summary> /// 将DataRedar转换为List /// </summary> private List <MyCreek.Data.Model.WorkFlowButtons> DataReaderToList(SqlDataReader dataReader) { List <MyCreek.Data.Model.WorkFlowButtons> List = new List <MyCreek.Data.Model.WorkFlowButtons>(); MyCreek.Data.Model.WorkFlowButtons model = null; while (dataReader.Read()) { model = new MyCreek.Data.Model.WorkFlowButtons(); model.ID = dataReader.GetGuid(0); model.Title = dataReader.GetString(1); if (!dataReader.IsDBNull(2)) { model.Ico = dataReader.GetString(2); } if (!dataReader.IsDBNull(3)) { model.Script = dataReader.GetString(3); } if (!dataReader.IsDBNull(4)) { model.Note = dataReader.GetString(4); } model.Sort = dataReader.GetInt32(5); List.Add(model); } return(List); }
protected void Page_Load(object sender, EventArgs e) { MyCreek.Platform.WorkFlowButtons bworkFlowButtons = new MyCreek.Platform.WorkFlowButtons(); MyCreek.Data.Model.WorkFlowButtons workFlowButton = null; string id = Request.QueryString["id"]; string title = string.Empty; string ico = string.Empty; string script = string.Empty; string note = string.Empty; Guid buttionID; if (id.IsGuid(out buttionID)) { workFlowButton = bworkFlowButtons.Get(buttionID); } string oldXML = workFlowButton.Serialize(); if (IsPostBack) { title = Request.Form["Title1"]; ico = Request.Form["Ico"]; script = Request.Form["Script"]; note = Request.Form["Note"]; bool isAdd = !id.IsGuid(); if (workFlowButton == null) { workFlowButton = new MyCreek.Data.Model.WorkFlowButtons(); workFlowButton.ID = Guid.NewGuid(); workFlowButton.Sort = bworkFlowButtons.GetMaxSort(); } workFlowButton.Ico = ico.IsNullOrEmpty() ? null : ico.Trim(); workFlowButton.Note = note.IsNullOrEmpty() ? null : note.Trim(); workFlowButton.Script = script.IsNullOrEmpty() ? null : script; workFlowButton.Title = title.Trim(); if (isAdd) { bworkFlowButtons.Add(workFlowButton); MyCreek.Platform.Log.Add("添加了流程按钮", workFlowButton.Serialize(), MyCreek.Platform.Log.Types.流程相关); } else { bworkFlowButtons.Update(workFlowButton); MyCreek.Platform.Log.Add("修改了流程按钮", "", MyCreek.Platform.Log.Types.流程相关, oldXML, workFlowButton.Serialize()); } bworkFlowButtons.ClearCache(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "new RoadUI.Window().reloadOpener();alert('保存成功!');new RoadUI.Window().close();", true); } if (workFlowButton != null) { this.Title1.Value = workFlowButton.Title; this.Ico.Value = workFlowButton.Ico; this.Script.Value = workFlowButton.Script; this.Note.Value = workFlowButton.Note; } }
public ActionResult Edit(FormCollection collection) { MyCreek.Platform.WorkFlowButtons bworkFlowButtons = new MyCreek.Platform.WorkFlowButtons(); MyCreek.Data.Model.WorkFlowButtons workFlowButton = null; string id = Request.QueryString["id"]; string title = string.Empty; string ico = string.Empty; string script = string.Empty; string note = string.Empty; Guid buttionID; if (id.IsGuid(out buttionID)) { workFlowButton = bworkFlowButtons.Get(buttionID); } string oldXML = workFlowButton.Serialize(); if (collection != null) { title = Request.Form["Title"]; ico = Request.Form["Ico"]; script = Request.Form["Script"]; note = Request.Form["Note"]; bool isAdd = !id.IsGuid(); if (workFlowButton == null) { workFlowButton = new MyCreek.Data.Model.WorkFlowButtons(); workFlowButton.ID = Guid.NewGuid(); workFlowButton.Sort = bworkFlowButtons.GetMaxSort(); } workFlowButton.Ico = ico.IsNullOrEmpty() ? null : ico.Trim(); workFlowButton.Note = note.IsNullOrEmpty() ? null : note.Trim(); workFlowButton.Script = script.IsNullOrEmpty() ? null : script; workFlowButton.Title = title.Trim(); if (isAdd) { bworkFlowButtons.Add(workFlowButton); MyCreek.Platform.Log.Add("添加了流程按钮", workFlowButton.Serialize(), MyCreek.Platform.Log.Types.流程相关); } else { bworkFlowButtons.Update(workFlowButton); MyCreek.Platform.Log.Add("修改了流程按钮", "", MyCreek.Platform.Log.Types.流程相关, oldXML, workFlowButton.Serialize()); } bworkFlowButtons.ClearCache(); ViewBag.Script = "new RoadUI.Window().reloadOpener();alert('保存成功!');new RoadUI.Window().close();"; } return(View(workFlowButton == null ? new MyCreek.Data.Model.WorkFlowButtons() : workFlowButton)); }
/// <summary> /// 更新记录 /// </summary> /// <param name="model">MyCreek.Data.Model.WorkFlowButtons实体类</param> public int Update(MyCreek.Data.Model.WorkFlowButtons model) { string sql = @"UPDATE WorkFlowButtons SET Title=@Title,Ico=@Ico,Script=@Script,Note=@Note,Sort=@Sort WHERE ID=@ID" ; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Title", SqlDbType.NVarChar, 1000) { Value = model.Title }, model.Ico == null ? new SqlParameter("@Ico", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Ico", SqlDbType.VarChar, 500) { Value = model.Ico }, model.Script == null ? new SqlParameter("@Script", SqlDbType.VarChar, -1) { Value = DBNull.Value } : new SqlParameter("@Script", SqlDbType.VarChar, -1) { Value = model.Script }, model.Note == null ? new SqlParameter("@Note", SqlDbType.VarChar, -1) { Value = DBNull.Value } : new SqlParameter("@Note", SqlDbType.VarChar, -1) { Value = model.Note }, new SqlParameter("@Sort", SqlDbType.Int, -1) { Value = model.Sort }, new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1) { Value = model.ID } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 添加记录 /// </summary> /// <param name="model">MyCreek.Data.Model.WorkFlowButtons实体类</param> /// <returns>操作所影响的行数</returns> public int Add(MyCreek.Data.Model.WorkFlowButtons model) { string sql = @"INSERT INTO WorkFlowButtons (ID,Title,Ico,Script,Note,Sort) VALUES(@ID,@Title,@Ico,@Script,@Note,@Sort)" ; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1) { Value = model.ID }, new SqlParameter("@Title", SqlDbType.NVarChar, 1000) { Value = model.Title }, model.Ico == null ? new SqlParameter("@Ico", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Ico", SqlDbType.VarChar, 500) { Value = model.Ico }, model.Script == null ? new SqlParameter("@Script", SqlDbType.VarChar, -1) { Value = DBNull.Value } : new SqlParameter("@Script", SqlDbType.VarChar, -1) { Value = model.Script }, model.Note == null ? new SqlParameter("@Note", SqlDbType.VarChar, -1) { Value = DBNull.Value } : new SqlParameter("@Note", SqlDbType.VarChar, -1) { Value = model.Note }, new SqlParameter("@Sort", SqlDbType.Int, -1) { Value = model.Sort } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 更新记录 /// </summary> /// <param name="model">MyCreek.Data.Model.WorkFlowButtons实体类</param> public int Update(MyCreek.Data.Model.WorkFlowButtons model) { string sql = @"UPDATE WorkFlowButtons SET Title=:Title,Ico=:Ico,Script=:Script,Note=:Note,Sort=:Sort WHERE ID=:ID" ; OracleParameter[] parameters = new OracleParameter[] { new OracleParameter(":Title", OracleDbType.NVarchar2, 1000) { Value = model.Title }, model.Ico == null ? new OracleParameter(":Ico", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Ico", OracleDbType.Varchar2, 500) { Value = model.Ico }, model.Script == null ? new OracleParameter(":Script", OracleDbType.Clob) { Value = DBNull.Value } : new OracleParameter(":Script", OracleDbType.Clob) { Value = model.Script }, model.Note == null ? new OracleParameter(":Note", OracleDbType.Clob) { Value = DBNull.Value } : new OracleParameter(":Note", OracleDbType.Clob) { Value = model.Note }, new OracleParameter(":Sort", OracleDbType.Int32) { Value = model.Sort }, new OracleParameter(":ID", OracleDbType.Varchar2, 40) { Value = model.ID } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 添加记录 /// </summary> /// <param name="model">MyCreek.Data.Model.WorkFlowButtons实体类</param> /// <returns>操作所影响的行数</returns> public int Add(MyCreek.Data.Model.WorkFlowButtons model) { string sql = @"INSERT INTO WorkFlowButtons (ID,Title,Ico,Script,Note,Sort) VALUES(:ID,:Title,:Ico,:Script,:Note,:Sort)" ; OracleParameter[] parameters = new OracleParameter[] { new OracleParameter(":ID", OracleDbType.Varchar2, 40) { Value = model.ID }, new OracleParameter(":Title", OracleDbType.NVarchar2, 1000) { Value = model.Title }, model.Ico == null ? new OracleParameter(":Ico", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Ico", OracleDbType.Varchar2, 500) { Value = model.Ico }, model.Script == null ? new OracleParameter(":Script", OracleDbType.Clob) { Value = DBNull.Value } : new OracleParameter(":Script", OracleDbType.Clob) { Value = model.Script }, model.Note == null ? new OracleParameter(":Note", OracleDbType.Clob) { Value = DBNull.Value } : new OracleParameter(":Note", OracleDbType.Clob) { Value = model.Note }, new OracleParameter(":Sort", OracleDbType.Int32) { Value = model.Sort } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 更新 /// </summary> public int Update(MyCreek.Data.Model.WorkFlowButtons model) { return(dataWorkFlowButtons.Update(model)); }
/// <summary> /// 新增 /// </summary> public int Add(MyCreek.Data.Model.WorkFlowButtons model) { return(dataWorkFlowButtons.Add(model)); }