Exemple #1
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("操作失败");
            }
        }
Exemple #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;
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取总记录数
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int GetTotalCount(GroupInfoEntity entity, int scId)
        {
            StringBuilder commandText = new StringBuilder();

            #region CommandText

            commandText.Append(@"SELECT
                                  COUNT(1), 
                                  gt.TypeName,
                                  (SELECT 
                                    COUNT(0) 
                                  FROM
                                    GroupElems ge 
                                  WHERE ge.GroupID = gi.GroupID and ge.Status=1) AS 'ElementCount',
                                  gi.* 
                                FROM
                                  groupinfo gi,
                                  grouptypes gt 
                                WHERE gi.GroupTypeID = gt.TypeID {0} ");
            #endregion

            List <MySqlParameter> paramsList = new List <MySqlParameter>();
            commandText = SearchCondition(commandText, entity);
            #region【搜索条件】
            if (scId > 0)
            {
                commandText.Append(string.Format(@"and gt.TypeClass in (11,12) and GroupTypeID not in(1200,1100) and GroupID in(select GroupID from groupschemes where SchemeID=" + scId + ") Order By {0} desc", entity.SearchOrderType));
            }
            else
            {
                commandText.Append(string.Format(@" Order By {0} desc", entity.SearchOrderType));
            }
            #endregion
            return(MySqlHelper.ExecuteScalar(this.ConnectionString, commandText.ToString(), paramsList.ToArray()).Convert <int>());
        }
Exemple #4
0
        public Task <CreateGroupResponseDto> CreateGroupSync(CreateGroupRequestDto dto)
        {
            return(Task.Run(() =>
            {
                CreateGroupResponseDto resp = new CreateGroupResponseDto();
                var classifyEntity = _groupClassifyRepository.TableNoTracking.SingleOrDefault(t => t.Id.Equals(dto.classify_id));
                if (classifyEntity != null)
                {
                    var groupEntity = new GroupInfoEntity()
                    {
                        ClassifyId = dto.classify_id,
                        CoverUrl = dto.cover_url,
                        CreatedUser = Guid.Empty,
                        Description = dto.description,
                        GMTCreate = DateTime.Now,
                        IsOffLine = false,
                        IsHot = dto.is_hot,
                        Name = dto.name
                    };
                    _groupInfoRepository.Insert(groupEntity);
                    resp.id = groupEntity.Id;
                }
                else
                {
                    throw new NotFoundException("所属板块不存在");
                }

                return resp;
            }));
        }
Exemple #5
0
        private bool ExecuteNonQuery(string commandText, GroupInfoEntity entity)
        {
            List <MySqlParameter> paramsList = GetMySqlParameters(entity);

            int result = MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray());

            return(base.ExecuteStatus(result));
        }
Exemple #6
0
        /// <summary>
        /// 查询条件拼接
        /// </summary>
        /// <param name="commandText">sql查询语句</param>
        /// <param name="entity">分组实体类</param>
        /// <returns>拼接后的sql语句</returns>
        private StringBuilder SearchCondition(StringBuilder commandText, GroupInfoEntity entity)
        {
            #region CommandText

            string status = "";
            if (entity.SearchStatus == "1")
            {
                status = status + " and gi.Status=1";
            }
            if (entity.SearchStatus == "0")
            {
                status = status + " and gi.Status=0";
            }
            #endregion

            // 拼接索要查询的数据状态
            StringBuilder newCommandText = new StringBuilder();
            newCommandText.AppendFormat(commandText.ToString(), status);

            //List<MySqlParameter> paramsList = new List<MySqlParameter>();

            //#region【搜索条件】

            //if (entity.SearchGroupType != "0")
            //{
            //    newCommandText.Append(@" and gt.TypeClass=@TypeClass");
            //    paramsList.Add(new MySqlParameter("@TypeClass", entity.SearchGroupType));
            //}
            //if (entity.SearchKeys != "")
            //{
            //    newCommandText.Append(@" and gi.GroupName like '%@GroupName%' or gi.GroupID like '%@GroupID%'");
            //    //paramsList.Add(new MySqlParameter("@GroupName", string.Format("%{0}%", entity.SearchKeys)));
            //    //paramsList.Add(new MySqlParameter("@GroupID", string.Format("%{0}%", entity.SearchKeys)));
            //    paramsList.Add(new MySqlParameter("@GroupName", entity.SearchKeys));
            //    paramsList.Add(new MySqlParameter("@GroupID",entity.SearchKeys));
            //}
            List <MySqlParameter> paramsList = new List <MySqlParameter>();

            #region【搜索条件】

            if (entity.SearchGroupType != "0")
            {
                newCommandText.AppendFormat(@" and gt.TypeClass={0}", entity.SearchGroupType);
                paramsList.Add(new MySqlParameter("@TypeClass", entity.SearchGroupType));
            }
            if (entity.SearchKeys != "")
            {
                newCommandText.AppendFormat(@" and gi.GroupName like '%{0}%' or gi.GroupID like '%{1}%'", entity.SearchKeys, entity.SearchKeys);
            }


            return(newCommandText);

            #endregion
        }
Exemple #7
0
        public int InsertForId(GroupInfoEntity entity)
        {
            string commandText = @"INSERT INTO `GroupInfo`
                                                (`GroupID`,
                                                `GroupTypeID`,
                                                `OrderType`,
                                                `OrderNo`,
                                                `GroupName`,
                                                `GroupDesc`,
                                                `GroupPicUrl`,
                                                `GroupTips`,
                                                `Remarks`,
                                                `StartTime`,
                                                `EndTime`,
                                                `CreateTime`,
                                                `UpdateTime`,
                                                `Status`)
                                                VALUES
                                                (
                                                @GroupID,
                                                @GroupTypeID,
                                                @OrderType,
                                                @OrderNo,
                                                @GroupName,
                                                @GroupDesc,
                                                @GroupPicUrl,
                                                @RecommWord,
                                                @Remarks,
                                                @StartTime,
                                                @EndTime,
                                                @CreateTime,
                                                @UpdateTime,
                                                @Status);select last_insert_id();";
            int    newId       = Tools.GetInt(MySqlHelper.ExecuteScalar(this.ConnectionString, commandText, GetMySqlParameters(entity).ToArray()), 0);

            if (newId > 0)
            {
                new GroupSchemesDAL().Insert(new GroupSchemesEntity()
                {
                    GroupID     = newId,
                    SchemeID    = entity.SchemeID,
                    GroupTypeID = entity.GroupTypeID,
                    OrderType   = 0,
                    CreateTime  = DateTime.Now,
                    UpdateTime  = DateTime.Now,
                    Status      = 1
                });
                return(newId);
            }
            return(-1);
        }
Exemple #8
0
 private void Bind()
 {
     if (_Id > 0)
     {
         _CurrentEntity = new GroupBLL().GetGroupInfoByID(_Id);
         if (_CurrentEntity != null)
         {
             txtDesc.Text            = _CurrentEntity.GroupDesc;
             ThumbPicUrl.Value       = _CurrentEntity.GroupPicUrl;
             ShowThumbPic.ImageUrl   = _CurrentEntity.GroupPicUrl;
             txtStartTime.Text       = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm");
             txtEndTime.Text         = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm");
             ddlStatus.SelectedValue = _CurrentEntity.Status.ToString();
         }
     }
 }
        protected string BindTime(object entity)
        {
            GroupInfoEntity obj         = (GroupInfoEntity)entity;
            string          timePart    = string.Format("{0:yyyy.MM.dd HH:mm} ~ {1:yyyy.MM.dd HH:mm}", obj.StartTime, obj.EndTime);
            DateTime        currentTime = DateTime.Now;

            if (obj.EndTime < currentTime)
            {
                return("<span class=\"black\">显示时间:" + timePart + "</span>");
            }
            else if (obj.StartTime > currentTime)
            {
                return("<span class=\"black\">显示时间:" + timePart + "</span>");
            }
            else
            {
                return("<span class=\"black\">显示时间:" + timePart + "</span>");
            }
        }
Exemple #10
0
        /// <summary>
        /// 获取分组信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public List <GroupInfoEntity> GetDataList(GroupInfoEntity entity, int scId)
        {
            StringBuilder commandText = new StringBuilder();

            #region CommandText

            commandText.Append(@"SELECT 
                                  gt.TypeName,
                                  (SELECT 
                                    COUNT(0) 
                                  FROM
                                    GroupElems ge 
                                  WHERE ge.GroupID = gi.GroupID and ge.Status=1) AS 'ElementCount',
                                  gi.* 
                                FROM
                                  groupinfo gi,
                                  GroupTypes gt 
                                WHERE gi.GroupTypeID = gt.TypeID {0} ");
            #endregion

            List <MySqlParameter> paramsList = new List <MySqlParameter>();

            #region【搜索条件】

            commandText = SearchCondition(commandText, entity);
            if (scId > 0)
            {
                commandText.Append(string.Format(@"and gt.TypeClass in (11,12) and GroupTypeID not in(1200,1100) and GroupID in(select GroupID from groupschemes where SchemeID=" + scId + ") Order By {0} desc LIMIT @StartIndex, @EndIndex;", entity.SearchOrderType));
            }
            else
            {
                commandText.Append(string.Format(@" Order By {0} desc LIMIT @StartIndex, @EndIndex;", entity.SearchOrderType));
            }
            paramsList.Add(new MySqlParameter("@startIndex", entity.StartIndex));
            paramsList.Add(new MySqlParameter("@endIndex", entity.EndIndex));
            #endregion

            using (MySqlDataReader objReader = MySqlHelper.ExecuteReader(this.ConnectionString, commandText.ToString(), paramsList.ToArray()))
            {
                return(objReader.ReaderToList <GroupInfoEntity>() as List <GroupInfoEntity>);
            }
        }
        protected string BindStatus(object entity)
        {
            GroupInfoEntity obj         = (GroupInfoEntity)entity;
            DateTime        currentTime = DateTime.Now;

            if (obj.EndTime < currentTime)
            {
                return("<span class=\"red\">已过期</span>");
            }
            else if (obj.StartTime > currentTime)
            {
                var timeSpan = obj.StartTime - currentTime;

                return(string.Format("<span class=\"blue\">开启&nbsp;&nbsp;/&nbsp;&nbsp;{0}后显示</span>", timeSpan.Days > 0 ? timeSpan.Days.ToString() + "天" : timeSpan.Hours.ToString() + "小时"));
            }
            else
            {
                return("<span class=\"black\">开启</span>");
            }
        }
Exemple #12
0
        protected void OnSave(object sender, EventArgs e)
        {
            var currentEntity = new GroupInfoEntity();

            currentEntity.GroupID     = _Id;
            currentEntity.GroupTypeID = 4105;
            currentEntity.OrderType   = 0;
            currentEntity.OrderNo     = 0;
            currentEntity.GroupName   = "闪屏";
            currentEntity.GroupDesc   = txtDesc.Text;
            currentEntity.GroupTips   = "";
            currentEntity.GroupPicUrl = ThumbPicUrl.Value;
            currentEntity.Remarks     = "";
            currentEntity.StartTime   = DateTime.ParseExact(txtStartTime.Text, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.CurrentCulture);
            currentEntity.EndTime     = DateTime.ParseExact(txtEndTime.Text, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.CurrentCulture);
            currentEntity.Status      = nwbase_sdk.Tools.GetInt(ddlStatus.SelectedValue, 1);
            currentEntity.UpdateTime  = DateTime.Now;
            currentEntity.Remarks     = string.Empty;

            bool result = false;

            if (_Id <= 0)
            {
                //新增
                currentEntity.CreateTime = DateTime.Now;
                result = new GroupBLL().FlashPageInsert(currentEntity);
            }
            else
            {
                result = new GroupBLL().FlashPageUpdate(currentEntity);
            }
            if (result)
            {
                this.Alert("保存成功");
                Bind();
            }
            else
            {
                this.Alert("保存失败!");
            }
        }
Exemple #13
0
        private List <MySqlParameter> GetMySqlParameters(GroupInfoEntity entity)
        {
            List <MySqlParameter> paramsList = new List <MySqlParameter>();

            paramsList.Add(new MySqlParameter("@GroupID", entity.GroupID));
            paramsList.Add(new MySqlParameter("@GroupTypeID", entity.GroupTypeID));
            paramsList.Add(new MySqlParameter("@OrderType", entity.OrderType));
            paramsList.Add(new MySqlParameter("@OrderNo", entity.OrderNo));
            paramsList.Add(new MySqlParameter("@GroupName", entity.GroupName));
            paramsList.Add(new MySqlParameter("@GroupDesc", entity.GroupDesc));
            paramsList.Add(new MySqlParameter("@GroupPicUrl", entity.GroupPicUrl));
            paramsList.Add(new MySqlParameter("@RecommWord", entity.GroupTips));
            paramsList.Add(new MySqlParameter("@Remarks", entity.Remarks));
            paramsList.Add(new MySqlParameter("@StartTime", entity.StartTime));
            paramsList.Add(new MySqlParameter("@EndTime", entity.EndTime));
            paramsList.Add(new MySqlParameter("@CreateTime", entity.CreateTime));
            paramsList.Add(new MySqlParameter("@UpdateTime", entity.UpdateTime));
            paramsList.Add(new MySqlParameter("@Status", entity.Status));

            return(paramsList);
        }
Exemple #14
0
        public bool Insert(GroupInfoEntity entity)
        {
            //            string commandText = @"INSERT INTO `GroupInfo`
            //                                                (`GroupID`,
            //                                                `GroupTypeID`,
            //                                                `OrderType`,
            //                                                `OrderNo`,
            //                                                `GroupName`,
            //                                                `GroupDesc`,
            //                                                `GroupPicUrl`,
            //                                                `RecommWord`,
            //                                                `Remarks`,
            //                                                `StartTime`,
            //                                                `EndTime`,
            //                                                `CreateTime`,
            //                                                `UpdateTime`,
            //                                                `Status`)
            //                                                VALUES
            //                                                (
            //                                                @GroupID,
            //                                                @GroupTypeID,
            //                                                @OrderType,
            //                                                @OrderNo,
            //                                                @GroupName,
            //                                                @GroupDesc,
            //                                                @GroupPicUrl,
            //                                                @RecommWord,
            //                                                @Remarks,
            //                                                @StartTime,
            //                                                @EndTime,
            //                                                @CreateTime,
            //                                                @UpdateTime,
            //                                                @Status
            //                                                );";
            //            return ExecuteNonQuery(commandText, entity);
            int newId = InsertForId(entity);

            return(newId > 0);
        }
        private void Bind()
        {
            if (_Id > 0)
            {
                _CurrentEntity = new GroupBLL().GetGroupInfoByID(_Id);
                if (_CurrentEntity != null)
                {
                    txtGroupName.Text      = _CurrentEntity.GroupName;
                    SpecialName            = _CurrentEntity.GroupName;
                    txtGroupDesc.Text      = _CurrentEntity.GroupDesc;
                    ThumbPicUrl.Value      = _CurrentEntity.GroupPicUrl;
                    ShowThumbPic.ImageUrl  = _CurrentEntity.GroupPicUrl;
                    this.txtStartTime.Text = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm");
                    this.txtEndTime.Text   = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm");
                }
                applist = new GroupBLL().GetGroupElemsByGroupID(_Id);
                for (int i = 1; i <= applist.Count; i++)
                {
                    applist[i - 1].OrderNo = i;
                }
                DataList.DataSource = applist;
                DataList.DataBind();
                if (PageType == "new" && applist.Count > 0)
                {
                    Button2.Visible = true;
                }
            }
            else
            {
                txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                txtEndTime.Text   = DateTime.Now.AddYears(10).ToString("yyyy-MM-dd HH:mm");
            }

            // BindShow
            if (GroupTypeID == 3200)
            {
                addAppLi.Visible = false;
            }
        }
Exemple #16
0
        /// <summary>
        /// 更新分组信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool UpdateGroupInfo(GroupInfoEntity entity)
        {
            #region CommandText

            string commandText = @"UPDATE `GroupInfo`
                                   SET
                                    `GroupName` = @GroupName,
                                    `OrderType` = @OrderType,
                                    `GroupTypeID` = @GroupTypeID,
                                    `GroupTips` = @RecommWord,
                                    `Status` = @Status,
                                    `Remarks` = @Remarks,
                                    `StartTime` = @StartTime,
                                    `EndTime` = @EndTime,
                                    `GroupDesc` = @GroupDesc,
                                    `GroupPicUrl` = @GroupPicUrl,
                                    `UpdateTime` = now()
                                    WHERE `GroupID` = @GroupID";

            #endregion

            return(ExecuteNonQuery(commandText, entity));
        }
Exemple #17
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;
            }
        }
Exemple #18
0
        /// <summary>
        /// 插入GroupInfo表
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>false:插入失败;true:插入成功</returns>
        public bool InsertGroupInfo(GroupInfoEntity entity)
        {
            string commandText = @"INSERT INTO `GroupInfo`
                                                (
                                                `GroupTypeID`,
                                                `OrderType`,
                                                `OrderNo`,
                                                `GroupName`,
                                                `GroupDesc`,
                                                `GroupPicUrl`,
                                                `GroupTips`,
                                                `Remarks`,
                                                `StartTime`,
                                                `EndTime`,
                                                `CreateTime`,
                                                `Status`)
                                                VALUES
                                                (
                                                @GroupTypeID,
                                                @OrderType,
                                                @OrderNo,
                                                @GroupName,
                                                @GroupDesc,
                                                @GroupPicUrl,
                                                @RecommWord,
                                                @Remarks,
                                                @StartTime,
                                                @EndTime,
                                                now(),
                                                @Status);select last_insert_id();";
            List <MySqlParameter> paramsList = this.GetMySqlParameters(entity);

            int result = MySqlHelper.ExecuteScalar(this.ConnectionString, commandText, paramsList.ToArray()).Convert <int>();

            return(result > 0 ? true : false);
        }
Exemple #19
0
 /// <summary>
 /// 修改专题
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool SpecialTopicUpdate(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().Update(entity));
 }
Exemple #20
0
 /// <summary>
 /// 新增闪屏
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool FlashPageInsert(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().Insert(entity));
 }
Exemple #21
0
 /// <summary>
 /// 插入分组信息
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool InsertGroupInfo(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().InsertGroupInfo(entity));
 }
Exemple #22
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("操作失败");
            }
        }
Exemple #23
0
 public DataSet GetDataSetList(GroupInfoEntity entity, int scId)
 {
     return(new GroupInfoDAL().GetDataSetList(entity, scId));
 }
Exemple #24
0
 /// <summary>
 /// 更新分组信息
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool UpdateGroupInfo(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().UpdateGroupInfo(entity));
 }
Exemple #25
0
        /// <summary>
        /// 获取分组信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public List <GroupInfoEntity> GetDataList(GroupInfoEntity entity, ref int totalCount, int scId)
        {
            totalCount = new GroupInfoDAL().GetTotalCount(entity, scId);

            return(new GroupInfoDAL().GetDataList(entity, scId));
        }
Exemple #26
0
 /// <summary>
 /// 修改闪屏
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool FlashPageUpdate(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().Update(entity));
 }
Exemple #27
0
 /// <summary>
 /// 新增专题
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool SpecialTopicInsert(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().Insert(entity));
 }
        protected void OnSave(object sender, EventArgs e)
        {
            var currentEntity = new GroupInfoEntity();

            currentEntity.GroupID     = _Id;
            currentEntity.GroupTypeID = this.GroupTypeID;
            currentEntity.OrderType   = 0;
            currentEntity.OrderNo     = 0;
            currentEntity.GroupName   = txtGroupName.Text;
            currentEntity.GroupDesc   = txtGroupDesc.Text;
            currentEntity.GroupTips   = "";
            currentEntity.GroupPicUrl = ThumbPicUrl.Value;
            currentEntity.Remarks     = "";
            currentEntity.StartTime   = this.txtStartTime.Text.Trim().Convert <DateTime>(DateTime.Now);
            currentEntity.EndTime     = this.txtEndTime.Text.Trim().Convert <DateTime>(new DateTime(2048, 1, 1));
            currentEntity.CreateTime  = DateTime.Now;
            currentEntity.UpdateTime  = DateTime.Now;
            currentEntity.Status      = 1; // 开启
            currentEntity.UpdateTime  = DateTime.Now;
            currentEntity.Remarks     = string.Empty;
            currentEntity.SchemeID    = this.SchemeID;

            bool result = false;

            if (_Id <= 0)
            {
                //新增
                currentEntity.CreateTime = DateTime.Now;
                int newId = new GroupBLL().InsertInfoForId(currentEntity);
                if (SchemeID == 104)
                {
                    OperateRecordEntity info = new OperateRecordEntity()
                    {
                        ElemId         = newId,
                        reason         = "",
                        Status         = 1,
                        OperateFlag    = "1",
                        SourcePage     = 61,
                        OperateType    = "5",
                        OperateExplain = "新增专题",
                        OperateContent = currentEntity.GroupName,
                        UserName       = GetUserName(),
                    };
                    new OperateRecordBLL().Insert(info);
                }
                this.Alert("新增成功", "SpecialTopicEdit.aspx?id=" + newId.ToString() + "&page=" + PageType + "&SchemeID=" + SchemeID.ToString() + "&GroupTypeID=" + GroupTypeID.ToString());
            }
            else
            {
                result = new GroupBLL().SpecialTopicUpdate(currentEntity);
                if (SchemeID == 104)
                {
                    OperateRecordEntity info = new OperateRecordEntity()
                    {
                        ElemId         = _Id,
                        reason         = "",
                        Status         = 1,
                        OperateFlag    = "2",
                        SourcePage     = 61,
                        OperateType    = "5",
                        OperateExplain = "编辑专题",
                        OperateContent = currentEntity.GroupName,
                        UserName       = GetUserName(),
                    };
                    new OperateRecordBLL().Insert(info);
                }
            }
            if (result)
            {
                this.Alert("保存成功");
                Bind();
            }
            else
            {
                this.Alert("保存失败!");
            }
        }
Exemple #29
0
 public int InsertInfoForId(GroupInfoEntity entity)
 {
     return(new GroupInfoDAL().InsertForId(entity));
 }