Пример #1
0
    protected void rptSubitems_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        bool result = false;
        int  opId   = 0;

        switch (e.CommandName)
        {
        case "Del":
            string[] args = e.CommandArgument.ToString().Split(',');
            opId = Convert.ToInt32(args[0]);
            string   subject = args[1];
            OpParams param   = new OpParams()
            {
                OpId = opId
            };

            result = empAuth.DeleteOperationData(param);

            //新增後端操作記錄
            empAuth.InsertBackEndLogData(new BackEndLogData()
            {
                EmpAccount  = c.GetEmpAccount(),
                Description = string.Format(".刪除作業選項/Delete operation .代碼/id[{0}] 標題/subject[{1}] 結果/result[{2}]", opId, subject, result),
                IP          = c.GetClientIP()
            });

            // log to file
            c.LoggerOfUI.InfoFormat("{0} deletes {1}, result: {2}", c.GetEmpAccount(), "op-" + opId.ToString() + "-" + subject, result);

            if (!result)
            {
                if (param.IsThereSubitemOfOp)
                {
                    Master.ShowErrorMsg(Resources.Lang.ErrMsg_ThereIsSubitemofOp);
                }
                else
                {
                    Master.ShowErrorMsg(Resources.Lang.ErrMsg_DeleteOperationFailed);
                }
            }

            break;

        case "MoveUp":
            opId   = Convert.ToInt32(e.CommandArgument);
            result = empAuth.DecreaseOperationSortNo(opId, c.GetEmpAccount());
            break;

        case "MoveDown":
            opId   = Convert.ToInt32(e.CommandArgument);
            result = empAuth.IncreaseOperationSortNo(opId, c.GetEmpAccount());
            break;
        }

        if (result)
        {
            DisplaySubitems();
            Master.RefreshOpMenu();
        }
    }