/// <summary> /// 新增一条业务流程数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int AddBizAppFlow(BizAppFlowEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BizAppFlow("); strSql.Append("AppName,AppInstanceID,ActivityName,Remark,ChangedTime,ChangedUserID,ChangedUserName"); strSql.Append(") values ("); strSql.Append("@AppName,@AppInstanceID,@ActivityName,@Remark,@ChangedTime,@ChangedUserID,@ChangedUserName"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@AppName", SqlDbType.NVarChar,50) , new SqlParameter("@AppInstanceID", SqlDbType.VarChar,50) , new SqlParameter("@ActivityName", SqlDbType.NVarChar,50) , new SqlParameter("@Remark", SqlDbType.NVarChar,1000) , new SqlParameter("@ChangedTime", SqlDbType.DateTime) , new SqlParameter("@ChangedUserID", SqlDbType.Int,4) , new SqlParameter("@ChangedUserName", SqlDbType.NVarChar,50) }; int idx = 0; parameters[idx++].Value = model.AppName; parameters[idx++].Value = model.AppInstanceID; parameters[idx++].Value = model.ActivityName; parameters[idx++].Value = model.Remark; parameters[idx++].Value = model.ChangedTime; parameters[idx++].Value = model.ChangedUserID; parameters[idx++].Value = model.ChangedUserName; object obj = SQLHelper.ExecuteScalar(strSql.ToString(), parameters); if (obj == null) { return 0; } else { return Convert.ToInt32(obj); } }
/// <summary> /// 得到一个对象实体 /// </summary> private static BizAppFlowEntity GetBizAppFlowModel(DataTable dt) { if (dt != null && dt.Rows != null && dt.Rows.Count > 0) { BizAppFlowEntity model = new BizAppFlowEntity(); if (dt.Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[0]["ID"].ToString()); } model.AppName = dt.Rows[0]["AppName"].ToString(); model.AppInstanceID = dt.Rows[0]["AppInstanceID"].ToString(); model.ActivityName = dt.Rows[0]["ActivityName"].ToString(); model.Remark = dt.Rows[0]["Remark"].ToString(); if (dt.Rows[0]["ChangedTime"].ToString() != "") { model.ChangedTime = DateTime.Parse(dt.Rows[0]["ChangedTime"].ToString()); } if (dt.Rows[0]["ChangedUserID"].ToString() != "") { model.ChangedUserID = int.Parse(dt.Rows[0]["ChangedUserID"].ToString()); } model.ChangedUserName = dt.Rows[0]["ChangedUserName"].ToString(); return model; } else { return null; } }
/// <summary> /// 新增一条业务流程数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int AddBizAppFlow(BizAppFlowEntity model) { return WorkFlowManager.AddBizAppFlow(model); }