예제 #1
0
        /// <summary>
        /// 编辑时绑定分组信息
        /// </summary>
        private void BindData()
        {
            if (GroupID.Equals(-1))
            {
                this.Alert("参数非法", "/GroupInfo.aspx");
            }
            else
            {
                CurrentEntity       = new GroupInfoBll().QueryGroupInfoByGroupID(this.GroupID);
                this.GroupName.Text = CurrentEntity.GroupName;
                this.dropOrderType.SelectedValue = CurrentEntity.OrderType.ToString();
                this.dropGroupType.SelectedValue = CurrentEntity.GroupTypeID.ToString();
                this.RecommWord.Text             = CurrentEntity.GroupTips;
                this.Status.SelectedValue        = CurrentEntity.Status.ToString();
                this.Remarks.Text   = CurrentEntity.Remarks;
                this.GroupDesc.Text = CurrentEntity.GroupDesc;
                this.StartTime.Text = CurrentEntity.StartTime.ToString();
                this.EndTime.Text   = CurrentEntity.EndTime.ToString();

                // 显示图片
                this.ShowThumbPic.ImageUrl = string.IsNullOrEmpty(CurrentEntity.GroupPicUrl) ? @"Theme/Images/empty.png" : CurrentEntity.GroupPicUrl;
                this.ThumbPicUrl.Value     = CurrentEntity.GroupPicUrl;
                this.OldThumbPicUrl.Value  = CurrentEntity.GroupPicUrl;
            }
        }
예제 #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                int    totalCount   = 0;
                string selectStatus = dropStatus.SelectedValue;

                GroupInfoEntity groupInfo = new GroupInfoEntity()
                {
                    SearchGroupType = this.GroupType.SelectedValue,
                    SearchKeys      = this.Keyword_2.Value.Trim(),
                    SearchOrderType = OrderType.SelectedValue,
                    SearchStatus    = dropStatus.SelectedValue,
                    StartIndex      = pagerList.StartRecordIndex - 1,
                    EndIndex        = pagerList.PageSize,
                    Status          = 1
                };
                DataTable datatable = new DataTable();
                DataSet   dt        = new GroupInfoBll().GetDataSetList(groupInfo, SchemeID);
                datatable = dt.Tables[0];
                string fileName = string.Format("GroupInfo_{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                string path     = Server.MapPath(ServerMapPath() + fileName);
                WriteExcel(datatable, path, fileName);
                DownloadFile(path);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        public bool Delete(int id)
        {
            var bll = new GroupInfoBll();

            groupInfos.Remove(id);
            return(bll.Delete(id));
        }
예제 #4
0
        /// <summary>
        /// 插入数据
        /// </summary>
        private void Insert()
        {
            GroupInfoEntity entity = new GroupInfoEntity();

            entity.GroupName   = this.GroupName.Text;
            entity.OrderType   = this.dropOrderType.SelectedValue.Convert <int>(1);
            entity.GroupTypeID = this.dropGroupType.SelectedValue.Convert <int>(1);
            entity.GroupTips   = this.RecommWord.Text;
            entity.Status      = this.Status.SelectedValue.Convert <int>(1);
            entity.Remarks     = this.Remarks.Text;
            entity.StartTime   = this.StartTime.Text.Trim().Convert <DateTime>(DateTime.Now);
            entity.EndTime     = this.EndTime.Text.Trim().Convert <DateTime>(DateTime.Now.AddDays(7));
            entity.GroupDesc   = this.GroupDesc.Text;
            entity.GroupPicUrl = this.ThumbPicUrl.Value;


            //写入数据库
            bool result = new GroupInfoBll().InsertGroupInfo(entity);

            if (result)
            {
                this.Alert("操作成功", string.Format("/GroupInfo.aspx"));
            }
            else
            {
                this.Alert("操作失败");
            }
        }
예제 #5
0
        public int CheckAdd(GroupInfo groupInfo)
        {
            bool             flag           = true;
            int              groupId        = 0;
            List <GroupInfo> groupInfosList = groupInfos.Values.ToList();

            for (int i = 0; i < groupInfosList.Count; i++)
            {
                if (groupInfosList[i].GroupName == groupInfo.GroupName)
                {
                    flag    = false;
                    groupId = Convert.ToInt32(groupInfosList[i].GroupID);
                    break;
                }
            }

            if (flag)
            {
                var bll = new GroupInfoBll();
                int id  = bll.AddGrouopInfo(groupInfo);
                if (id > 0)
                {
                    groupInfo.GroupID = id;
                    groupInfoDic.groupInfos.Add(id, groupInfo);
                    groupId = id;
                }
            }
            return(groupId);
        }
예제 #6
0
        public DataTable GetGroupInfo(int GroupID)
        {
            DataTable dt = new DataTable();

            DataSet   dataset   = new GroupElemsBLL().QueryDataSetByGroupID(GroupID);
            DataTable datatable = dataset.Tables[0];

            int           typeId = new GroupInfoBll().QueryGroupInfoByGroupID(GroupID).GroupTypeID;
            AppInfoEntity entity = new AppInfoEntity()
            {
                AppClass   = 12,
                AppType    = typeId,
                StartIndex = 0,
                OrderType  = "DownTimes",
                EndIndex   = 500,
                Status     = 1,
            };

            if (GroupID == 93)
            {
                entity.AppType = 0;
            }
            else if (GroupID == 94)
            {
                entity.AppType   = 0;
                entity.OrderType = "CreateTime";
            }
            string  status = "1";
            DataSet ds     = new AppInfoBLL().GetExportDataList2(entity, status, "70");

            dt = ds.Tables[0];
            return(dt);
        }
예제 #7
0
        public bool UpdateSensorGroupInfo(GroupInfo groupInfo)
        {
            var bll = new GroupInfoBll();

            if (bll.UpdateGroupInfo(groupInfo))
            {
                groupInfoDic.groupInfos[(int)groupInfo.GroupID] = groupInfo;
                return(true);
            }
            return(false);
        }
예제 #8
0
        public bool Add(GroupInfo groupInfo)
        {
            var bll = new GroupInfoBll();
            int id  = bll.AddGrouopInfo(groupInfo);

            if (id > 0)
            {
                groupInfo.GroupID = id;
                groupInfoDic.groupInfos.Add(id, groupInfo);
                return(true);
            }
            return(false);
        }
예제 #9
0
 private GroupInfosDic()
 {
     if (null == this.groupInfos)
     {
         this.groupInfos = new Dictionary <int, GroupInfo>();
         var bll = new GroupInfoBll();
         IList <GroupInfo> list = bll.SelectList();
         foreach (GroupInfo groupInfo in list)
         {
             groupInfos.Add(Convert.ToInt32(groupInfo.GroupID), groupInfo);
         }
     }
 }
예제 #10
0
        private void BindData()
        {
            try
            {
                int    totalCount   = 0;
                string selectStatus = dropStatus.SelectedValue;

                GroupInfoEntity groupInfo = new GroupInfoEntity()
                {
                    SearchGroupType = this.GroupType.SelectedValue,
                    SearchKeys      = this.Keyword_2.Value.Trim(),
                    SearchOrderType = OrderType.SelectedValue,
                    SearchStatus    = dropStatus.SelectedValue,
                    StartIndex      = pagerList.StartRecordIndex - 1,
                    EndIndex        = pagerList.PageSize,
                    Status          = 1
                };
                List <GroupInfoEntity> list = new GroupInfoBll().GetDataList(groupInfo, ref totalCount, SchemeID);
                list = list.OrderByDescending(a => a.UpdateTime).OrderByDescending(a => a.Status).ToList();
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].GroupPicUrl == "")
                    {
                        list[i].GroupPicUrl = "http://cos.myqcloud.com/1002877/nwfs/M00/02/ED/Co9ZBlPE_uaEAKpAAAAAAC-RJBY895.jpg";
                    }
                }
                this.objRepeater.DataSource = list;
                this.objRepeater.DataBind();

                pagerList.RecordCount = totalCount;
                pagerList.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #11
0
        /// <summary>
        /// 修改数据
        /// </summary>
        private void Update()
        {
            GroupInfoEntity entity = new GroupInfoEntity();

            entity.GroupName   = this.GroupName.Text;
            entity.OrderType   = this.dropOrderType.SelectedValue.Convert <int>(1);
            entity.GroupTypeID = this.dropGroupType.SelectedValue.Convert <int>(1);
            entity.GroupTips   = this.RecommWord.Text;
            entity.Status      = this.Status.SelectedValue.Convert <int>(1);
            entity.Remarks     = this.Remarks.Text;
            entity.StartTime   = this.StartTime.Text.Trim().Convert <DateTime>(DateTime.Now);
            entity.EndTime     = this.EndTime.Text.Trim().Convert <DateTime>(DateTime.Now.AddDays(7));
            entity.GroupDesc   = this.GroupDesc.Text;
            entity.GroupPicUrl = this.ThumbPicUrl.Value;
            entity.GroupID     = this.GroupID;

            #region 处理缩略图
            if (this.OldThumbPicUrl.Value != this.ThumbPicUrl.Value)
            {
                if (!string.IsNullOrEmpty(entity.GroupPicUrl))
                {
                    if (this.Width != 0 && this.Height != 0)
                    {
                        //裁剪方式
                        string croptype = this.Request <string>("cropType", string.Empty);

                        Bitmap bitSource = ImageHelper.GetBitmapFromUrl(entity.GroupPicUrl);

                        if (bitSource == null)
                        {
                            this.Alert("远程图片解析失败,请刷新后再试");
                            return;
                        }

                        int rX = Convert.ToInt32(Math.Round(this.X1, MidpointRounding.AwayFromZero));
                        int rY = Convert.ToInt32(Math.Round(this.Y1, MidpointRounding.AwayFromZero));
                        int rW = Convert.ToInt32(Math.Round(this.Width, MidpointRounding.AwayFromZero));
                        int rH = Convert.ToInt32(Math.Round(this.Height, MidpointRounding.AwayFromZero));

                        bitSource = ImageHelper.KiCut(bitSource, rX, rY, rW, rH);

                        if (croptype == "hengping")
                        {
                            bitSource = ImageHelper.ImageCompress(bitSource, 260, 195);
                        }
                        else
                        {
                            bitSource = ImageHelper.ImageCompress(bitSource, 195, 260);
                        }

                        UploadFile up = new UploadFile();

                        byte[] imageBytes = BitmapToBytes(bitSource);
                        //StartTransfer中的AppID和CID在前端页面中上传控件定义
                        string token        = up.StartTransfer(2, 41, entity.GroupPicUrl.Substring(entity.GroupPicUrl.LastIndexOf("."), 4), 1, imageBytes.Length, string.Empty);
                        string resultString = up.Transfer(token, imageBytes, 1);

                        entity.GroupPicUrl = resultString.Split(',')[1];

                        //up.GenerateThumb(entity.GroupPicUrl, 0);
                        up.GenerateThumb(token);

                        bitSource.Dispose();
                    }
                }
            }
            #endregion

            //写入数据库
            bool result = new GroupInfoBll().UpdateGroupInfo(entity);
            if (result)
            {
                this.Alert("操作成功", string.Format("/GroupInfo.aspx"));
            }
            else
            {
                this.Alert("操作失败");
            }
        }
예제 #12
0
        public bool DeleteSensorGroupInfos(int startId, int endId)
        {
            var bll = new GroupInfoBll();

            return(bll.DeleteGroupInfos(startId, endId));
        }