//void lkb_Click(object sender, EventArgs e) //{ //} //protected void tb検索キーワード_TextChanged(object sender, System.EventArgs e) //{ // if (アクティブボタン == 在庫検索ボタンEnum.現在庫) // { // 現在庫検索(); // } // else if (アクティブボタン == 在庫検索ボタンEnum.使用量) // { // 使用量検索(); // } // else if (アクティブボタン == 在庫検索ボタンEnum.不動品) // { // 不動品検索(); // } // else if (アクティブボタン == 在庫検索ボタンEnum.後発品) // { // 後発品検索(); // } // //if (e.Item.ItemType == ListItemType.Item // // || e.Item.ItemType == ListItemType.AlternatingItem) { // // if (e.Item.Cells[0].Text.IndexOf(".NET TIPS") != -1) { // // e.Item.BackColor = System.Drawing.Color.Pink; // // } // // foreach (TableCell cell in e.Item.Cells) { // // cell.Text = cell.Text.Replace(".NET", // // "<B Style='background-color:yellow'>.NET</B>"); // // } //} private void 現在庫検索() { //アクティブボタン = 在庫検索ボタンEnum.現在庫; dg現在庫.Visible = true; dg使用量.Visible = false; dg不動品.Visible = false; dg後発品.Visible = false; bool 全期限 = false; bool 期限内 = false; bool 期限切 = false; bool 期限指定 = false; bool 以内指定か = false; int 期限加算月 = 0; if (ddl使用期限日.SelectedIndex == 0) { 全期限 = true; } else if (ddl使用期限日.SelectedIndex == 1) { 期限内 = true; } else if (ddl使用期限日.SelectedIndex == 2) { 期限切 = true; } else if (3 <= ddl使用期限日.SelectedIndex) { 期限指定 = true; Tuple <int, bool> tp = Set期限加算月(); 期限加算月 = tp.Value1; 以内指定か = tp.Value2; } Service.File.Reader.FileReaderClient client = ReferenceCreater.GetFileReaderClient(); if (tb検索キーワード.Text == "") { return; } var rdataset = client.Get現在庫検索データ(tb検索キーワード.Text, 全期限, 期限内, 期限切, 期限指定, 以内指定か, 期限加算月); //var rdataset = client.Get現在庫検索データ(tb検索キーワード.Text, true, true, true, true, true, 3); if (string.IsNullOrEmpty(rdataset.エラーメッセージ)) { var dataList = rdataset.検索結果データlist.ToList(); var 表示順序dic = Session["店舗名List"] as Dictionary <int, string>; if (表示順序dic == null) { return; } // 表示順序に登録されていない店舗があった場合に使用する臨時dic var CopyDic = GenericUtil.Copy(表示順序dic); int cnt = CopyDic.Count + 1; dataList.Sort( delegate(現在庫データ x, 現在庫データ y) { int xValue = 0; int yValue = 0; foreach (var d in CopyDic) { if (d.Value.Equals(x.店名)) { xValue = d.Key; } if (d.Value.Equals(y.店名)) { yValue = d.Key; } } // 一致するものがなかったら、臨時のcntの番号にする(表示順序が後ろ) bool xy店名が等しい = false; if (xValue == 0) { if (x.店名.Equals(y.店名)) { xy店名が等しい = true; } xValue = cnt; CopyDic.Add(cnt, x.店名); cnt++; } if (yValue == 0) { if (xy店名が等しい) { yValue = xValue; } else { yValue = cnt; CopyDic.Add(cnt, y.店名); cnt++; } } // 店名が等しい場合は、医薬品名のアイウエオ順 if (xValue == yValue) { return(x.医薬品名.CompareTo(y.医薬品名)); } return(xValue - yValue); } ); dg現在庫.DataSource = dataList; dg現在庫.DataBind(); Set在庫検索結果Result(dataList.Count, rdataset.検索キーワード); } else { // メッセージボックスを出すとXPだとIMEが利かなくなるので中止 //MessageBox.Show(rdataset.エラーメッセージ, "検索結果", MessageBoxButton.OK); lbSearchResult.Text = rdataset.エラーメッセージ; } }