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

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

            ddlOrgType.DataSource     = datas.Select(x => new { x.OrgType, x.OrgTypeName }).Distinct().ToList();
            ddlOrgType.DataTextField  = "OrgTypeName";
            ddlOrgType.DataValueField = "OrgType";
            ddlOrgType.DataBind();
            ddlOrgType.Items.Insert(0, new ListItem("---請選擇---", ""));
        }
        else
        {
            _AllowOrgan = new List <OrganListMobel>();
            resetDDL(ddlOrgType);
            resetDDL(ddlDeptID);
            resetDDL(ddlOrganID);
        }
    }