Example #1
0
        /// <summary>
        /// 计划列表行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GvPlans_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "DelPlan")
                {
                    long planId = long.Parse(e.CommandArgument.ToString());
                    DeletePlanByPlanID(planId);
                }
                else if (e.CommandName == "EditPlan")
                {
                    lbErr.Text = "";
                    #region 修改计划
                    lbPTitle.Text = "修改计划";
                    string planId = e.CommandArgument.ToString();
                    hdfID.Value       = planId;
                    hdfParentID.Value = "0";
                    DataTable dt       = (DataTable)ViewState["dtPlans"];
                    DataTable dtPlans  = dt.Copy();
                    DataRow   dr       = dtPlans.Select("PlanID=" + long.Parse(planId))[0];
                    long      actionId = SystemDataExtension.GetInt32(dr, "ActionID");

                    //开始日期
                    tbStart.Text = SystemDataExtension.GetDateTime(dr, "StartDate").ToShortDateString();
                    //截止日期
                    tbDue.Text = SystemDataExtension.GetDateTime(dr, "DueDate").ToShortDateString();
                    //时长目标
                    tbDuring.Text = SystemDataExtension.GetString(dr, "During");
                    //数量目标
                    tbQuantity.Text = SystemDataExtension.GetString(dr, "Quantity");
                    //描述
                    tbDesc.Text = SystemDataExtension.GetString(dr, "Description");

                    DataTable dtActions = (DataTable)ViewState["dtActions"];
                    string    planType  = GetPlanTypeByPlanID(long.Parse(planId), dtPlans, dtActions);
                    hdfPlanType.Value = planType;
                    BindActions(planType, actionId.ToString());
                    if (planType == "计划")//是包含多个操作的计划
                    {
                        lbPlanActions.Visible  = true;
                        cblPlanActions.Visible = true;
                        //btnSetAction.Visible = true;
                        BindPlanActions(actionId, long.Parse(planId), dtPlans, dtActions);
                    }
                    else
                    {
                        lbPlanActions.Visible  = false;
                        cblPlanActions.Visible = false;
                        //btnSetAction.Visible = false;
                    }
                    //计划标题,不可更改
                    ddlPlanAction.Enabled = false;

                    divList.Visible   = false;
                    divPlan.Visible   = true;
                    divAction.Visible = false;

                    #endregion
                }
            }
            catch (Exception ex)
            {
                lbErr.Text = ex.ToString();
            }
        }