Example #1
0
        public ActionResult GetNameById(int pid, int cid, int aid)
        {
            SystemAreaInfo pinfo = mSystemAreaMgr.Get(pid);
            SystemAreaInfo cinfo = mSystemAreaMgr.Get(cid);
            SystemAreaInfo ainfo = mSystemAreaMgr.Get(aid);
            string         addr  = pinfo.Display + "-" + cinfo.Display + "-" + ainfo.Display;

            return(Content(addr));
        }
Example #2
0
        public bool Delete(SystemAreaInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("delete from SystemArea");
            sb.Append(" where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, model.Id);
            return(db.ExecuteNonQuery(dbCommand) < 1 ? false : true);
        }
Example #3
0
        public bool Update(SystemAreaInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("update SystemArea set ");
            sb.Append("Display=@Display,ParentId=@ParentId");
            sb.Append(" where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, model.Id);
            db.AddInParameter(dbCommand, "@Display", DbType.String, model.Display);
            db.AddInParameter(dbCommand, "@ParentId", DbType.Int32, model.ParentId);
            return(db.ExecuteNonQuery(dbCommand) < 1 ? false : true);
        }
Example #4
0
        public int Create(SystemAreaInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("insert into SystemArea(");
            sb.Append("Display,ParentId");
            sb.Append(") values(");
            sb.Append("@Display,@ParentId);SELECT @@IDENTITY;");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Display", DbType.String, model.Display);
            db.AddInParameter(dbCommand, "@ParentId", DbType.Int32, model.ParentId);
            int id = Convert.ToInt32(db.ExecuteScalar(dbCommand));

            return(id);
        }
Example #5
0
        public SystemAreaInfo  Get(int Id)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("select * from SystemArea where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, Id);

            SystemAreaInfo model = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = FillList(dataReader);
                }
            }
            return(model);
        }
Example #6
0
        private SystemAreaInfo  FillList(IDataReader dataReader)
        {
            SystemAreaInfo model = new SystemAreaInfo();
            object         ojb;

            ojb = dataReader["Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Id = ( int)(ojb);
            }
            ojb = dataReader["Display"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Display = ( string)(ojb);
            }
            ojb = dataReader["ParentId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ParentId = ( int)(ojb);
            }

            return(model);
        }
Example #7
0
 public bool Delete(SystemAreaInfo model)
 {
     return(dal.Delete(model));
 }
Example #8
0
 public bool Update(SystemAreaInfo model)
 {
     return(dal.Update(model));
 }
Example #9
0
        public int Create(SystemAreaInfo model)
        {
            int id = dal.Create(model);

            return(id);
        }