コード例 #1
0
    private void LoadRoleCode40()
    {
        var isSuccess = false;
        var msg       = "";
        var datas     = new List <FlowOrganListMobel>();
        var viewData  = new WorkTimeViewModel()
        {
            UserComp = UserInfo.getUserInfo().CompID,
            UserID   = UserInfo.getUserInfo().UserID,
            CompID   = ddlCompID.SelectedValue,
            FlowType = "D"
        };

        isSuccess = WorkTime.LoadFlowOrgan(viewData, out datas, out msg);
        if (isSuccess && datas != null && datas.Count > 0)
        {
            _AllowFlowOrgan = datas;

            viewData = new WorkTimeViewModel()
            {
                UserComp = UserInfo.getUserInfo().CompID,
                UserID   = UserInfo.getUserInfo().UserID,
                CompID   = ddlCompID.SelectedValue,
                FlowType = "B"
            };

            isSuccess = WorkTime.LoadFlowOrgan(viewData, out datas, out msg);
            if (isSuccess && datas != null && datas.Count > 0)
            {
                _AllowFlowOrganView          = datas;
                ddlRoleCode40.DataSource     = datas.Where(x => x.RoleCode == "40").Select(x => new { x.OrganID, x.OrganName }).Distinct().ToList();
                ddlRoleCode40.DataTextField  = "OrganName";
                ddlRoleCode40.DataValueField = "OrganID";
                ddlRoleCode40.DataBind();
                ddlRoleCode40.Items.Insert(0, new ListItem("---請選擇---", ""));
            }
            else
            {
                _AllowFlowOrganView = new List <FlowOrganListMobel>();
                resetDDL(ddlRoleCode40);
                resetDDL(ddlRoleCode30);
                resetDDL(ddlRoleCode20);
                resetDDL(ddlRoleCode10);
            }
        }
        else
        {
            _AllowFlowOrgan = new List <FlowOrganListMobel>();
            resetDDL(ddlRoleCode40);
            resetDDL(ddlRoleCode30);
            resetDDL(ddlRoleCode20);
            resetDDL(ddlRoleCode10);
        }
    }