Пример #1
0
        /// <summary>
        /// 获取 在用/不在用 列表
        /// </summary>
        /// <param name="isused">在用状态</param>
        /// <returns>结果列表</returns>
        public IList <FireHouse> SELECT_BY_ISUSED(bool isused)
        {
            try
            {
                IList <FireHouse> result = new List <FireHouse>();
                var temp = (from row in db.U_firehouse where row.isused == isused orderby row.name ascending select row).GetEnumerator();
                while (temp.MoveNext())
                {
                    FireHouse element = new FireHouse();

                    element.Id          = temp.Current.id;
                    element.Name        = temp.Current.name;
                    element.Aid         = temp.Current.aid;
                    element.Lng         = temp.Current.lng;
                    element.Lat         = temp.Current.lat;
                    element.Description = temp.Current.description;
                    element.Isused      = temp.Current.isused;

                    result.Add(element);
                }
                return(result);
            }
            catch
            {
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// 更新函数
        /// </summary>
        /// <param name="info">Model</param>
        /// <returns>影响数据物理ID,已存在逻辑主码返回-1</returns>
        public short UPDATE(FireHouse info)
        {
            try
            {
                //if (SELECT_BY_NAME_ISUSED(info.Name, true) != null)
                //{
                //    return -1;
                //}

                U_firehouse         temp  = new U_firehouse();
                Table <U_firehouse> table = db.GetTable <U_firehouse>();
                temp = (from row in db.U_firehouse where row.id == info.Id select row).First();

                //temp.id = info.Id;
                temp.name        = info.Name;
                temp.aid         = info.Aid;
                temp.lng         = info.Lng;
                temp.lat         = info.Lat;
                temp.description = info.Description;
                temp.isused      = info.Isused;

                db.SubmitChanges();
                return(temp.id);
            }
            catch
            {
                return(-2);
            }
        }
Пример #3
0
        /// <summary>
        /// 插入函数
        /// </summary>
        /// <param name="info">Model</param>
        /// <returns>影响数据物理ID,已存在逻辑主码项返-1</returns>
        public short INSERT(FireHouse info)
        {
            try
            {
                if (SELECT_BY_NAME_ISUSED(info.Name, true) != null)
                {
                    return(-1);
                }

                U_firehouse temp = new U_firehouse();
                //temp.id = info.Id;
                temp.name        = info.Name;
                temp.aid         = info.Aid;
                temp.lng         = info.Lng;
                temp.lat         = info.Lat;
                temp.description = info.Description;
                temp.isused      = info.Isused;

                Table <U_firehouse> table = db.GetTable <U_firehouse>();
                table.InsertOnSubmit(temp);
                db.SubmitChanges();
                return(temp.id);
            }
            catch
            {
                return(-2);
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public short DeleteFirehouse(short id, int userid)
        {
            try
            {
                DFireHouse dfh = new DFireHouse();
                FireHouse  tmp = dfh.SELECT_BY_ID(id);
                tmp.Isused = false;
                short result = dfh.UPDATE(tmp);

                Log log = new Log();
                log.Tablename   = "FireHouse";
                log.Tableid     = result;
                log.Mid         = userid;
                log.Datetime    = DateTime.Now;
                log.Discription = "Delete";
                DLog dl = new DLog();
                dl.INSERT(log);

                return(result);
            }
            catch
            {
                return(0);
            }
        }
Пример #5
0
    protected void Button_addfirehouse_Click(object sender, EventArgs e)
    {
        this.U_updateFirehouse1.Visible = false;
        this.U_firehouse1.Visible       = true;
        FireHouse fh = new FireHouse();

        fh.Aid = short.Parse(Session["Areaid"].ToString());
        this.U_firehouse1.firehouse = fh;
    }
Пример #6
0
        /// <summary>
        /// 根据物理主码查询
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>结果</returns>
        public FireHouse SELECT_BY_ID(short id)
        {
            try
            {
                FireHouse   rd   = new FireHouse();
                U_firehouse temp = (from row in db.U_firehouse where row.id == id select row).First();

                rd.Id          = temp.id;
                rd.Name        = temp.name;
                rd.Aid         = temp.aid;
                rd.Lng         = temp.lng;
                rd.Lat         = temp.lat;
                rd.Description = temp.description;
                rd.Isused      = temp.isused;

                return(rd);
            }
            catch
            {
                return(null);
            }
        }
Пример #7
0
        /// <summary>
        /// 更新消防队信息
        /// </summary>
        /// <param name="info">消防队主体信息</param>
        /// <param name="userid">操作者ID</param>
        /// <returns></returns>
        public short EditFirehouse(FireHouse info, int userid)
        {
            try
            {
                DFireHouse dfh = new DFireHouse();
                info.Isused = true;
                short result = dfh.UPDATE(info);

                Log log = new Log();
                log.Tablename   = "FireHouse";
                log.Tableid     = result;
                log.Mid         = userid;
                log.Datetime    = DateTime.Now;
                log.Discription = "Update";
                DLog dl = new DLog();
                dl.INSERT(log);

                return(result);
            }
            catch
            {
                return(0);
            }
        }