Esempio n. 1
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public VAN_OA.Model.EFrom.A_ProInfos ReaderBind(IDataReader dataReader)
        {
            VAN_OA.Model.EFrom.A_ProInfos model = new VAN_OA.Model.EFrom.A_ProInfos();
            object ojb;

            ojb = dataReader["ids"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ids = (int)ojb;
            }
            ojb = dataReader["pro_Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.pro_Id = (int)ojb;
            }
            ojb = dataReader["a_Role_Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.a_Role_Id = (int)ojb;
            }
            ojb = dataReader["a_Index"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.a_Index = (int)ojb;
            }

            ojb = dataReader["A_RoleName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RoleName = (string)ojb;
            }


            return(model);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(VAN_OA.Model.EFrom.A_ProInfos model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update A_ProInfos set ");
            strSql.Append("pro_Id=" + model.pro_Id + ",");
            strSql.Append("a_Role_Id=" + model.a_Role_Id + ",");
            strSql.Append("a_Index=" + model.a_Index + "");
            strSql.Append(" where ids=" + model.ids + "");
            DBHelp.ExeCommand(strSql.ToString());
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(VAN_OA.Model.EFrom.A_ProInfos model, SqlCommand objCommand)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into A_ProInfos(");
            strSql.Append("pro_Id,a_Role_Id,a_Index");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("" + model.pro_Id + ",");
            strSql.Append("" + model.a_Role_Id + ",");
            strSql.Append("" + model.a_Index + "");
            strSql.Append(")");
            strSql.Append(";select @@IDENTITY");
            objCommand.CommandText = strSql.ToString();
            int    result;
            object obj = objCommand.ExecuteScalar();

            if (!int.TryParse(obj.ToString(), out result))
            {
                return(0);
            }
            return(result);
        }