Exemple #1
0
        /// <summary>
        /// 字段绑定事件
        /// </summary>
        protected void RepeaterFields_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DNNGo_PowerForms_Field FieldItem = e.Item.DataItem as DNNGo_PowerForms_Field;

                if (FieldItem != null && FieldItem.ID > 0)
                {
                    Literal liFieldType = e.Item.FindControl("liFieldType") as Literal;
                    liFieldType.Text = EnumHelper.GetEnumTextVal(FieldItem.FieldType, typeof(EnumViewControlType));

                    Literal liName = e.Item.FindControl("liName") as Literal;
                    liName.Text = WebHelper.leftx(FieldItem.Name, 30, "...");

                    if (FieldItem.GroupID > 0)
                    {
                        DNNGo_PowerForms_Group Group = DNNGo_PowerForms_Group.FindByKeyForEdit(FieldItem.GroupID);
                        if (Group != null && Group.ID > 0)
                        {
                            Literal liGroup = e.Item.FindControl("liGroup") as Literal;
                            liGroup.Text = WebHelper.leftx(Group.Name, 20, "...");
                        }
                    }
                }
            }
        }
        protected void lbSort_Click(object sender, EventArgs e)
        {
            LinkButton ImgbutSort = (LinkButton)sender;

            if (ImgbutSort != null)
            {
                //查出当前要排序的字段
                DNNGo_PowerForms_Group objC = DNNGo_PowerForms_Group.FindByKeyForEdit(ImgbutSort.CommandArgument);

                mTips.IsPostBack = true;//回发时就要触发
                if (ImgbutSort.ToolTip == "up")
                {
                    DNNGo_PowerForms_Group.MoveField(objC, EnumMoveType.Up, ModuleId);
                    //字段上移成功
                    mTips.LoadMessage("UpMoveGroupSuccess", EnumTips.Success, this, new String[] { "" });
                }
                else
                {
                    DNNGo_PowerForms_Group.MoveField(objC, EnumMoveType.Down, ModuleId);
                    //字段下移成功

                    mTips.LoadMessage("DownMoveGroupSuccess", EnumTips.Success, this, new String[] { "" });
                }
                //绑定一下
                BindDataList();
            }
        }
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DNNGo_PowerForms_Group item = DNNGo_PowerForms_Group.FindByKeyForEdit(TagID);
                item.Description = txtContentText.Text;
                item.Name        = txtName.Text;
                if (divOptions.Visible)
                {
                    item.Options = SetItemSettings();
                }

                item.LastUser = UserId;
                item.LastTime = xUserTime.UtcTime();
                item.LastIP   = WebHelper.UserHost;

                if (item.ID > 0)
                {
                }
                else
                {
                    item.ModuleId = ModuleId;
                    item.PortalId = PortalId;
                    item.Status   = (Int32)EnumStatus.Activation;
                }

                int Resultitem = 0;

                if (item.ID > 0)
                {
                    Resultitem = item.Update();
                }
                else
                {
                    Resultitem = item.Insert();
                }



                if (Resultitem > 0)
                {
                    mTips.LoadMessage("SaveGroupSuccess", EnumTips.Success, this, new String[] { item.Name });
                }
                else
                {
                    //保存失败
                    mTips.LoadMessage("SaveGroupError", EnumTips.Success, this, new String[] { item.Name });
                }
                Response.Redirect(xUrl("Groups"), false);
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
 protected void cmdDeleteCategory_Click(object sender, EventArgs e)
 {
     try
     {
         DNNGo_PowerForms_Group item = DNNGo_PowerForms_Group.FindByKeyForEdit(TagID);
         if (item.ID > 0 && item.Delete() > 0)
         {
             mTips.LoadMessage("DeleteGroupSuccess", EnumTips.Success, this, new String[] { item.Name });
         }
         else
         {
             mTips.LoadMessage("DeleteGroupError", EnumTips.Success, this, new String[] { item.Name });
         }
         Response.Redirect(xUrl("Groups"), false);
     }
     catch (Exception ex)
     {
         ProcessModuleLoadException(ex);
     }
 }
        /// <summary>
        /// 状态应用按钮事件
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1);

                if (Status >= 0)
                {
                    string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                    string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                    Int32    IDX = 0;
                    for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                    {
                        if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                        {
                            DNNGo_PowerForms_Group item = DNNGo_PowerForms_Group.FindByKeyForEdit(IDX);
                            if (item != null && item.ID > 0)
                            {
                                mTips.IsPostBack = true;
                                if (item.Delete() > 0)
                                {
                                    //mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.ContentText });
                                }
                                else
                                {
                                    //mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.ContentText });
                                }
                            }
                        }
                    }
                    BindDataList();
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                DNNGo_PowerForms_Group item = DNNGo_PowerForms_Group.FindByKeyForEdit(btnRemove.CommandArgument);
                mTips.IsPostBack = true;
                if (item.ID > 0 && item.Delete() > 0)
                {
                    mTips.LoadMessage("DeleteGroupSuccess", EnumTips.Success, this, new String[] { item.Name });
                }
                else
                {
                    mTips.LoadMessage("DeleteGroupError", EnumTips.Success, this, new String[] { item.Name });
                }
                BindDataList();
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 绑定左边项
        /// </summary>
        private void BindDataItem()
        {
            if (TagID > 0)
            {
                cmdDelete.Visible = true;
                cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                DNNGo_PowerForms_Group item = DNNGo_PowerForms_Group.FindByKeyForEdit(TagID);
                txtName.Text = item.Name;



                txtContentText.Text = item.Description;
            }
            else
            {
                //新增界面
                cmdDelete.Visible = false;
                txtName.Text      = "";

                txtContentText.Text = "";
            }
        }
Exemple #8
0
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvFieldList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                DNNGo_PowerForms_Field Fielditem = e.Row.DataItem as DNNGo_PowerForms_Field;

                if (Fielditem != null && Fielditem.ID > 0)
                {
                    #region "编辑&删除按钮"
                    HyperLink  hlEdit          = e.Row.FindControl("hlEdit") as HyperLink;
                    HyperLink  hlMobileEdit    = e.Row.FindControl("hlMobileEdit") as HyperLink;
                    LinkButton btnRemove       = e.Row.FindControl("btnRemove") as LinkButton;
                    LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton;
                    //设置按钮的CommandArgument
                    btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Fielditem.ID.ToString();
                    //设置删除按钮的提示
                    //if (Field.Status == (Int32)EnumFieldStatus.Recycle)
                    //{
                    btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    //}
                    //else
                    //{
                    //    btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                    //    btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                    //}

                    hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("FieldID", Fielditem.ID.ToString(), "AddNewField");


                    #endregion


                    #region "移动分类按钮"
                    LinkButton lbSortUp         = e.Row.FindControl("lbSortUp") as LinkButton;
                    LinkButton lbSortDown       = e.Row.FindControl("lbSortDown") as LinkButton;
                    LinkButton lbMobileSortUp   = e.Row.FindControl("lbMobileSortUp") as LinkButton;
                    LinkButton lbMobileSortDown = e.Row.FindControl("lbMobileSortDown") as LinkButton;
                    lbSortUp.CommandArgument                     =
                        lbSortDown.CommandArgument               =
                            lbMobileSortUp.CommandArgument       =
                                lbMobileSortDown.CommandArgument = Fielditem.ID.ToString();
                    #endregion


                    e.Row.Cells[4].Text = EnumHelper.GetEnumTextVal(Fielditem.FieldType, typeof(EnumViewControlType));

                    //获取用户名称
                    DotNetNuke.Entities.Users.UserInfo uInfo = new DotNetNuke.Entities.Users.UserController().GetUser(PortalId, Fielditem.LastUser);
                    e.Row.Cells[7].Text = uInfo != null && uInfo.UserID > 0 ?  uInfo.Username:"******";

                    e.Row.Cells[8].Text = EnumHelper.GetEnumTextVal(Fielditem.Status, typeof(EnumStatus));

                    if (Fielditem.GroupID > 0)
                    {
                        DNNGo_PowerForms_Group Group = DNNGo_PowerForms_Group.FindByKeyForEdit(Fielditem.GroupID);
                        if (Group != null && Group.ID > 0)
                        {
                            e.Row.Cells[3].Text = Group.Name;
                        }
                        else
                        {
                            e.Row.Cells[3].Text = String.Empty;
                        }
                    }
                    else
                    {
                        e.Row.Cells[3].Text = String.Empty;
                    }
                }
            }
        }