Ejemplo n.º 1
0
        /// <summary>
        /// 将DataRedar转换为List
        /// </summary>
        private List <BizProcess.Data.Model.WorkFlowButtons> DataReaderToList(MySqlDataReader dataReader)
        {
            List <BizProcess.Data.Model.WorkFlowButtons> List = new List <BizProcess.Data.Model.WorkFlowButtons>();

            BizProcess.Data.Model.WorkFlowButtons model = null;
            while (dataReader.Read())
            {
                model       = new BizProcess.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);
        }
        public ActionResult Edit(FormCollection collection)
        {
            BizProcess.Platform.WorkFlowButtons   bworkFlowButtons = new BizProcess.Platform.WorkFlowButtons();
            BizProcess.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 BizProcess.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);
                    BizProcess.Platform.Log.Add("添加了流程按钮", workFlowButton.Serialize(), BizProcess.Platform.Log.Types.流程相关);
                }
                else
                {
                    bworkFlowButtons.Update(workFlowButton);
                    BizProcess.Platform.Log.Add("修改了流程按钮", "", BizProcess.Platform.Log.Types.流程相关, oldXML, workFlowButton.Serialize());
                }
                bworkFlowButtons.ClearCache();
                ViewBag.Script = "new BPUI.Window().reloadOpener();alert('保存成功!');new BPUI.Window().close();";
            }
            return(View(workFlowButton == null ? new BizProcess.Data.Model.WorkFlowButtons() : workFlowButton));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">BizProcess.Data.Model.WorkFlowButtons实体类</param>
        public int Update(BizProcess.Data.Model.WorkFlowButtons model)
        {
            string sql = @"UPDATE WorkFlowButtons SET 
				Title=@Title,Ico=@Ico,Script=@Script,Note=@Note,Sort=@Sort
				WHERE ID=@ID"                ;

            MySqlParameter[] parameters = new MySqlParameter[] {
                new MySqlParameter("@Title", MySqlDbType.VarChar, 500)
                {
                    Value = model.Title
                },
                model.Ico == null ? new MySqlParameter("@Ico", MySqlDbType.VarChar, 500)
                {
                    Value = DBNull.Value
                } : new MySqlParameter("@Ico", MySqlDbType.VarChar, 500)
                {
                    Value = model.Ico
                },
                model.Script == null ? new MySqlParameter("@Script", MySqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new MySqlParameter("@Script", MySqlDbType.VarChar, -1)
                {
                    Value = model.Script
                },
                model.Note == null ? new MySqlParameter("@Note", MySqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new MySqlParameter("@Note", MySqlDbType.VarChar, -1)
                {
                    Value = model.Note
                },
                new MySqlParameter("@Sort", MySqlDbType.Int32, -1)
                {
                    Value = model.Sort
                },
                new MySqlParameter("@ID", MySqlDbType.VarChar, -1)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">BizProcess.Data.Model.WorkFlowButtons实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(BizProcess.Data.Model.WorkFlowButtons model)
        {
            string sql = @"INSERT INTO WorkFlowButtons
				(ID,Title,Ico,Script,Note,Sort) 
				VALUES(@ID,@Title,@Ico,@Script,@Note,@Sort)"                ;

            MySqlParameter[] parameters = new MySqlParameter[] {
                new MySqlParameter("@ID", MySqlDbType.VarChar, -1)
                {
                    Value = model.ID
                },
                new MySqlParameter("@Title", MySqlDbType.VarChar, 500)
                {
                    Value = model.Title
                },
                model.Ico == null ? new MySqlParameter("@Ico", MySqlDbType.VarChar, 500)
                {
                    Value = DBNull.Value
                } : new MySqlParameter("@Ico", MySqlDbType.VarChar, 500)
                {
                    Value = model.Ico
                },
                model.Script == null ? new MySqlParameter("@Script", MySqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new MySqlParameter("@Script", MySqlDbType.VarChar, -1)
                {
                    Value = model.Script
                },
                model.Note == null ? new MySqlParameter("@Note", MySqlDbType.Text, -1)
                {
                    Value = DBNull.Value
                } : new MySqlParameter("@Note", MySqlDbType.Text, -1)
                {
                    Value = model.Note
                },
                new MySqlParameter("@Sort", MySqlDbType.Int32, -1)
                {
                    Value = model.Sort
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">BizProcess.Data.Model.WorkFlowButtons实体类</param>
        public int Update(BizProcess.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.Char, 36)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">BizProcess.Data.Model.WorkFlowButtons实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(BizProcess.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.Char, 36)
                {
                    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));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新
 /// </summary>
 public int Update(BizProcess.Data.Model.WorkFlowButtons model)
 {
     return(dataWorkFlowButtons.Update(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 新增
 /// </summary>
 public int Add(BizProcess.Data.Model.WorkFlowButtons model)
 {
     return(dataWorkFlowButtons.Add(model));
 }