示例#1
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            VDCamera    info = new VDCamera();
            VDCameraBLL bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll            = BLLFactory.CreateBLL <VDCameraBLL>();
                info.PostionID = this.PostionID.Value;
                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.CREATEUSER = this.HiCREATEUSER.Value;
                    info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value);
                    info.ID         = this.hiID.Value;
                    bll.Update(info);
                }

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        private void BindData()
        {
            VDCameraBLL bll       = null;
            DataPage    dp        = new DataPage();
            VDCamera    condition = new VDCamera();
            string      postionID = Request.QueryString["postionID"];

            try
            {
                bll = BLLFactory.CreateBLL <VDCameraBLL>();
                this.hiPostionID.Value = postionID;
                condition.PostionID    = postionID;
                condition.CameraCode   = this.CameraCode.Text;
                condition.CameraName   = this.CameraName.Text;

                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);

                List <VDCamera> list = dp.Result as List <VDCamera>;
                this.GvList.DataSource = list;
                this.GvList.DataBind();

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["ID"].ToString());

                    (this.GvList.Rows[i].Cells[5].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        private void BindData()
        {
            string      id        = Request.QueryString["id"];
            VDCameraBLL bll       = null;
            VDCamera    info      = new VDCamera();
            string      postionID = Request.QueryString["postionID"];

            try
            {
                bll = BLLFactory.CreateBLL <VDCameraBLL>();
                if (string.IsNullOrEmpty(id) == false)
                {
                    info.ID = id;
                    info    = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value         = info.ID;
                    this.HiCREATEUSER.Value = info.CREATEUSER;
                    this.HiCREATETIME.Value = info.CREATETIME.ToString();
                    this.PostionID.Value    = info.PostionID;
                }
                else
                {
                    info = new VDCamera();
                    this.PostionID.Value = postionID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        /// <summary>
        /// 获取查询语句
        /// </summary>
        /// <param name="user">查询条件</param>
        /// <param name="parameters">参数</param>
        /// <returns>查询语句</returns>
        private string GetQuerySql(VDCamera condition, ref List <DataParameter> parameters)
        {
            StringBuilder sqlBuilder   = new StringBuilder();
            StringBuilder whereBuilder = new StringBuilder();

            try
            {
                //构成查询语句
                sqlBuilder.Append("SELECT * ");
                sqlBuilder.Append("FROM T_VD_Camera ");

                if (string.IsNullOrEmpty(condition.PostionID) == false)
                {
                    whereBuilder.Append(" AND PostionID = @PostionID");
                    parameters.Add(new DataParameter("PostionID", condition.PostionID));
                }
                //查询条件
                if (whereBuilder.Length > 0)
                {
                    sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
                }
                return(sqlBuilder.ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="condition">条件</param>
        /// <param name="page">数据页</param>
        /// <returns>数据页</returns>
        public DataPage GetList(VDCamera condition, DataPage page)
        {
            string sql = null;

            string where = "";
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                sql = this.GetQuerySql(condition, ref parameters);
                //分页关键字段及排序
                page.KeyName = "ID";
                if (string.IsNullOrEmpty(page.SortExpression))
                {
                    page.SortExpression = "UPDATETIME DESC";
                }

                if (where != "")
                {
                    sql += " where " + where.Substring(4);
                }

                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    page = session.GetDataPage <VDCamera>(sql, parameters.ToArray(), page);
                }
                return(page);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public DataResult <int> Insert(VDCamera model)
        {
            DataResult <int> result = new DataResult <int>();

            try
            {
                //基本信息
                model.ID         = Guid.NewGuid().ToString();
                model.CREATEUSER = this.LoginUser.UserID;
                model.CREATETIME = DateTime.Now;
                model.UPDATEUSER = model.CREATEUSER;
                model.UPDATETIME = model.CREATETIME;
                if (Exists(model))
                {
                    result.Msg    = "编号已存在";
                    result.Result = -1;
                    return(result);
                }
                result.Result    = new VDCameraDAL().Insert(model);
                result.IsSuccess = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#7
0
 /// <summary>
 /// 删除信息
 /// </summary>
 /// <param name="">信息</param>
 /// <returns>删除个数</returns>
 public int Delete(VDCamera model)
 {
     try
     {
         return(new VDCameraDAL().Delete(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#8
0
 /// <summary>
 /// 判断名称是否存在
 /// </summary>
 /// <param name="">信息</param>
 /// <returns>true:已存在;fasel:不存在。</returns>
 public bool Exists(VDCamera model)
 {
     try
     {
         return(new VDCameraDAL().Exists(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#9
0
 /// <summary>
 /// 获取列表
 /// </summary>
 /// <param name="condition">条件</param>
 /// <param name="page">数据页</param>
 /// <returns>数据页</returns>
 public DataPage GetList(VDCamera condition, DataPage page)
 {
     try
     {
         return(new VDCameraDAL().GetList(condition, page));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#10
0
 /// <summary>
 /// 获取信息
 /// </summary>
 /// <param name="">条件</param>
 /// <returns>信息</returns>
 public VDCamera Get(VDCamera model)
 {
     try
     {
         return(new VDCameraDAL().Get(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#11
0
 /// <summary>
 /// 获取导出的数据
 /// </summary>
 /// <param name="">查询条件</param>
 /// <returns>数据</returns>
 public DataTable GetExportData(VDCamera model)
 {
     try
     {
         return(new VDCameraDAL().GetExportData(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#12
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns>摄像头列表</returns>
        public List <VDCamera> GetList(VDCamera condition)
        {
            List <VDCamera> list = null;
            string          sql  = null;

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                sql  = "SELECT * FROM T_VD_Camera order by CameraCode";
                list = session.GetList <VDCamera>(sql, new List <DataParameter>().ToArray()).ToList <VDCamera>();
            }

            return(list);
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                VDCamera    camera = null;
                VDCameraBLL cbll   = BLLFactory.CreateBLL <VDCameraBLL>();
                camera = cbll.Get(new VDCamera {
                    ID = Request.QueryString["id"]
                });

                this.hiCamera.Value = LAF.Common.Serialization.JsonConvertHelper.GetSerializes(camera);
            }
        }
示例#14
0
 /// <summary>
 /// 获取信息
 /// </summary>
 /// <param name="">条件</param>
 /// <returns>*信息</returns>
 public VDCamera Get(VDCamera model)
 {
     try
     {
         using (IDataSession session = AppDataFactory.CreateMainSession())
         {
             //获取信息
             model = session.Get <VDCamera>(model);
         }
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#15
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(VDCamera model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //更新信息
                    count = session.Update <VDCamera>(model);
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#16
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(VDCamera model)
        {
            StringBuilder        sqlBuilder = new StringBuilder();
            List <DataParameter> parameters = new List <DataParameter>();
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    count = session.Delete <VDCamera>(model);
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#17
0
        /// <summary>
        /// 获取导出的数据
        /// </summary>
        /// <param name="user">查询条件</param>
        /// <returns>数据</returns>
        public DataTable GetExportData(VDCamera model)
        {
            DataTable            dt         = null;
            string               sql        = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                //构成查询语句
                sql = this.GetQuerySql(model, ref parameters);
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    dt           = session.GetTable(sql, parameters.ToArray());
                    dt.TableName = "Warehouse";
                }
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#18
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>更新行数</returns>
        public DataResult <int> Update(VDCamera model)
        {
            DataResult <int> result = new DataResult <int>();

            try
            {
                if (Exists(model))
                {
                    result.Msg    = "名称已存在";
                    result.Result = -1;
                    return(result);
                }
                model.UPDATEUSER = this.LoginUser.UserID;
                result.Result    = new VDCameraDAL().Update(model);
                result.IsSuccess = true;
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#19
0
        /// <summary>
        /// 判断名称是否存在
        /// </summary>
        /// <param name="info"></param>
        /// <returns>true:已存在;fasel:不存在。</returns>
        public bool Exists(VDCamera model)
        {
            StringBuilder        sqlBuilder   = new StringBuilder();
            StringBuilder        whereBuilder = new StringBuilder();
            List <DataParameter> parameters   = new List <DataParameter>();
            int count = 0;

            try
            {
                sqlBuilder.Append("SELECT COUNT(0) FROM T_VD_Camera");
                whereBuilder.Append(" AND ID <> @ID ");
                parameters.Add(new DataParameter {
                    ParameterName = "ID", DataType = DbType.String, Value = model.ID
                });
                if (!string.IsNullOrEmpty(model.CameraCode))
                {
                    whereBuilder.Append(" AND CameraCode = @CameraCode ");
                    parameters.Add(new DataParameter {
                        ParameterName = "CameraCode", DataType = DbType.String, Value = model.CameraCode
                    });
                }
                if (whereBuilder.Length > 0)
                {
                    sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
                }
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    string sql = this.ChangeSqlByDB(sqlBuilder.ToString(), session);
                    count = Convert.ToInt32(session.ExecuteSqlScalar(sql, parameters.ToArray()));
                }
                return(count > 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }