Ejemplo n.º 1
0
    protected void Search_Click(object sender, EventArgs e)
    {
        try
        {
            ActiveDirectoryBoundary adBoundary = new ActiveDirectoryBoundary();
            StringCollection scGroupList = adBoundary.SearchGroup(txtUser.Text, txtPassword.Text);

            if (!CheckAccess(scGroupList))
            {
                MessageLabel.Text = "検索結果がありません。";
                return;
            }

            //ワークフローAPIのバウンダリ
            WorkflowBinding bWorkflow = new WorkflowBinding();

            //IDとパスワードの設定
            bWorkflow.strUserName = "******";
            bWorkflow.strPassword = "******";

            RequestManageFormType[] resFormType;
            WorkflowGetRequestsRequestType reqType = new WorkflowGetRequestsRequestType();
            reqType.manage_request_parameter = new WorkflowGetRequestType();

            //ワークフローの申請フォームIDの設定
            reqType.manage_request_parameter.request_form_id = ddfForm.SelectedItem.Value;
            //決済完了日の設定
            reqType.manage_request_parameter.start_approval_date = DateTime.Parse(StartYear.Text + "/" + StartMonth.Text + "/" + StartDay.Text);
            reqType.manage_request_parameter.start_approval_dateSpecified = true;
            reqType.manage_request_parameter.end_approval_date = DateTime.Parse(EndYear.Text + "/" + EndMonth.Text + "/" + EndDay.Text).AddDays(1);
            reqType.manage_request_parameter.end_approval_dateSpecified = true;
            //完了区分の設定
            reqType.manage_request_parameter.filter = WorkflowGetManageRequestFilter.Complete;
            reqType.manage_request_parameter.filterSpecified = true;

            //申請ID一覧の取得
            resFormType = bWorkflow.WorkflowGetRequests(reqType);

            List<string> lstRequests = new List<string>();

            foreach (XMLElement element in bWorkflow.arrayReturns)
            {
                if (element.Name.Equals("manage_item_detail") && element.NodeType == XmlNodeType.Element)
                {
                    XMLAttribute attrPid = (XMLAttribute)element.arrayAttributes[0];
                    lstRequests.Add(attrPid.Value);
                }
            }

            string[] strRequests = lstRequests.ToArray();

            //バウンダリの結果情報を消去
            bWorkflow.arrayReturns.Clear();

            if (strRequests.Length > 0)
            {
                //申請IDごとにデータ取得
                WorkflowApplicationType[] resApplicationType;
                resApplicationType = bWorkflow.WorkflowGetRequestById(strRequests);

                //結果を値引データCSVへ出力
                CreateCSV(bWorkflow);
            }
            else
            {
                MessageLabel.Text = "検索結果がありません。";
            }
        }
        catch (Exception exception)
        {
            MessageLabel.Text = exception.Message;
        }
    }