コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int userId = GetUserId;
         if (userId != 0)
         {
             DataSet dsActionStruct = TablesBLL.GetTableFields("Action", null);        //操作表结构数据集
             ViewState["dsActionStruct"] = dsActionStruct;
             DataSet dsMyActionStruct = TablesBLL.GetTableFields("User_Action", null); //用户-操作表结构数据集
             ViewState["dsMyActionStruct"] = dsMyActionStruct;
             DataSet dsMetaData = MetaDataDAL.GetGroupMetaData();
             ViewState["dsMetaData"] = dsMetaData;
             DataSet myActions = ActionDAL.GetUserActionByUserID(userId);
             ViewState["myActions"] = myActions;
             DataSet sysActions = ActionDAL.GetAllActions();
             ViewState["sysActions"] = sysActions;
             DataTable dt = GetBindData(userId, myActions, sysActions, dsMetaData, dsActionStruct, dsMyActionStruct);
             BindGV(gvActions, dt);
         }
         else
         {
             lbErr.Text = "请先登录";
         }
         //btnClose.Click += btnClose_Click;
     }
     btnSave.Click += btnSave_Click;
 }
コード例 #2
0
        /// <summary>
        /// 页面加载与控件事件绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //btnSetAction.Click += BtnSetActions_Click;//设计计划的操作
            btnSubmit.Click    += BtnSubmit_Click;//提交计划保存
            btnCancel.Click    += BtnCancel_Click;
            btnAddSingle.Click += BtnAddSingle_Click;
            btnAddMulti.Click  += BtnAddMulti_Click;
            ddlPlanAction.SelectedIndexChanged += DdlPlanAction_SelectedIndexChanged;
            //btnSaveToPlan.Click += BtnSaveToPlan_Click;
            btnSaveToList.Click    += BtnSaveToList_Click;
            btnCancelToList.Click  += BtnCancelToList_Click;
            gvPlans.RowDataBound   += GvPlans_RowDataBound;
            gvActions.RowDataBound += GvActions_RowDataBound;
            gvPlans.RowCommand     += GvPlans_RowCommand;
            if (!IsPostBack)
            {
                int userId = VSDLL.Common.Users.UserID;
                if (userId == 0)
                {
                    divList.Visible   = false;
                    divPlan.Visible   = false;
                    divAction.Visible = false;
                    lbPTitle.Visible  = false;
                    lbErr.Text        = "你尚未登录,无法管理个人计划!";
                }
                else
                {
                    lbPTitle.Visible = true;
                    lbErr.Text       = "";
                    try
                    {
                        //获取计划列表
                        DataSet   dsPlans = TaskDAL.GetDailyTask(userId);
                        DataTable dtPlans = dsPlans.Tables[0];
                        ViewState["dtPlans"] = dtPlans;
                        //获取操作列表
                        DataSet   dsActions = ActionDAL.GetAllActions(0);
                        DataTable dtActions = dsActions.Tables[0];
                        ViewState["dtActions"] = dtActions;
                        //获取操作关系列表
                        DataSet   dsRelations = ActionDAL.GetActionRelation();
                        DataTable dtRelations = dsRelations.Tables[0];
                        ViewState["dtRelations"] = dtRelations;

                        //绑定计划列表
                        BindgvPlans(dtPlans);
                    }
                    catch (Exception ex)
                    {
                        lbErr.Text = ex.ToString();
                    }
                }
            }
        }