예제 #1
0
        //
        //ページの初期化(新規追加)
        //
        public override void PageRefresh()
        {
            customer   = new DB.m_customer();
            member     = new DB.m_member();
            familyList = new List <DB.m_family>();

            //Comboboxの設定
            co_Sex.DataSource              = Enum.GetValues(typeof(Utile.Data.性別));
            co_Visit_motive.DataSource     = Enum.GetValues(typeof(Utile.Data.来店動機));
            co_Registered_store.DataSource = DB.m_store.getStoreNameList();
            co_Rank.DataSource             = Enum.GetValues(typeof(Utile.Data.ランク));
            co_Membership_type.DataSource  = Enum.GetValues(typeof(Utile.Data.会員種別));

            //データを設定
            t_Pref_city_town_village_name.Text = "";
            t_Address2.Text          = "";
            t_Apartment_mansion.Text = "";
            da_Birthday.Value        = DateTime.Now.Date;
            t_Customer_code.Text     = "";
            ch_DM_Available.Checked  = false;
            t_Fax.Text                            = "";
            t_Free_item1.Text                     = "";
            t_Free_item2.Text                     = "";
            t_Free_item3.Text                     = "";
            t_mail.Text                           = "";
            t_name.Text                           = "";
            t_name_kana.Text                      = "";
            t_Phone_number1.Text                  = "";
            t_Phone_number2.Text                  = "";
            t_Phone_number3.Text                  = "";
            t_Postal_code.Text                    = "";
            co_Visit_motive.SelectedIndex         = 0;
            t_Remark.Text                         = "";
            ch_Sample.Checked                     = false;
            co_Sex.SelectedIndex                  = 0;
            t_surname.Text                        = "";
            t_surname_kana.Text                   = "";
            da_Customer_wedding_anniversary.Value = DateTime.Now.Date;

            da_Registration_date.Value        = da_Registration_date.MinDate;
            co_Membership_type.SelectedIndex  = 0;
            co_Rank.SelectedIndex             = 0;
            t_Registration_officer.Text       = "";
            co_Registered_store.SelectedIndex = 0;

            dataGridView1.Rows.Clear();

            //変更チェックリセット
            mod.reset();

            //入力チェックリセット
            chk.clear();

            //一覧クリア
            dataGridView2.Rows.Clear();
            dataGridView4.Rows.Clear();
            listView1.Items.Clear();
        }
예제 #2
0
        public override void PageRefresh()
        {
            //写真選択フォームをすべて閉じる
            selectPanel.Controls.Clear();

            //写真格納フォルダ取得
            photoDirList = DB.t_shooting_data.getPhotoDir(MainForm.session_t_reception.reception_code);

            //二次選択フォルダ取得
            DB.t_selection selection = DB.t_selection.getFirst(MainForm.session_t_reception.reception_code);
            if (selection == null)
            {
                int           index    = 1;
                DB.m_customer customer = DB.m_customer.getSingle(MainForm.session_t_reception.customer_code);
                Save_dir = DateTime.Now.Date.ToString("yyyyMMdd") + "-" + index.ToString() + "-" + customer.surname;
                StringBuilder sb = new StringBuilder();

                while (sb.Length == 0)
                {
                    using (var dbc = new DB.DBConnect())
                    {
                        dbc.npg.Open();
                        sb.Append("select count(s.folder_name) as count ");
                        sb.Append("from t_selection as s ");
                        sb.Append("where s.folder_name = '@folder_name'".Replace("@folder_name", Save_dir));
                        NpgsqlCommand command    = new NpgsqlCommand(sb.ToString(), dbc.npg);
                        var           dataReader = command.ExecuteReader();
                        while (dataReader.Read())
                        {
                            if ((long)dataReader["count"] != 0)
                            {
                                index++;
                                Save_dir = DateTime.Now.Date.ToString("yyyyMMdd") + index.ToString() + customer.name;
                                sb.Clear();
                            }
                        }
                    }
                }
            }
            else
            {
                Save_dir = selection.folder_name;
            }

            //サムネイル一覧初期化
            thumbnailListRefresh();

            //DBからタグ一覧へ格納
            db2tag();

            //サムネイル一覧タグ付け
            thumbnailListTagRefresh();
        }
예제 #3
0
        private void b_print_Click(object sender, EventArgs e)
        {
            //DBに登録
            collect();

            //顧客情報格納
            string table = "Order_list1";
            Dictionary <string, string> item = new Dictionary <string, string>();

            item.Add("customerCode", MainForm.session_t_reception.customer_code.ToString());
            item.Add("folderName", Save_dir.Trim());
            DB.m_customer cus = DB.m_customer.getSingle(MainForm.session_t_reception.customer_code.ToString());
            item.Add("customerSurnameKana", cus.surname_kana);
            item.Add("customerNameKana", cus.name_kana);
            item.Add("customerSurName", cus.surname);
            item.Add("customerName", cus.name);
            item.Add("orderEntryDate", MainForm.session_t_reception.receipt_date.ToString("yyyy年MM月dd日"));

            Utile.RepoerDB rdb = new Utile.RepoerDB(table);
            rdb.deleteAll();
            rdb.insert(item);

            //写真データ格納

            table = "Order_list2";
            rdb   = new Utile.RepoerDB(table);
            rdb.deleteAll();
            using (var dbc = new DB.DBConnect())
            {
                dbc.npg.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append(@"select * ");
                sb.Append(@"from t_selection as s ");
                sb.Append(@"where s.reception_code = '@reception_code' ".Replace("@reception_code", MainForm.session_t_reception.reception_code));

                NpgsqlCommand command    = new NpgsqlCommand(sb.ToString(), dbc.npg);
                var           dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    if ((int)dataReader["images"] != 0)
                    {
                        string path = System.IO.Path.Combine(Secondary_Select_dir, dataReader["folder_name"].ToString().Trim(), ((int)dataReader["color"]).ToString());
                        foreach (string fpath in System.IO.Directory.GetFiles(path, "*", System.IO.SearchOption.AllDirectories))
                        {
                            item = new Dictionary <string, string>();
                            item.Add("product", dataReader["color"].ToString() + " - " + dataReader["product_name"].ToString());
                            //会計処理が未実装のため""をいれる
                            item.Add("unit", "");
                            item.Add("photo", System.IO.Path.GetFullPath(fpath));
                            rdb.insert(item);
                        }
                    }
                }
            }

            PrintForm p = new PrintForm();

            p.PrintReport.Load(@"./Asset/Format/Order_list.flxr", "発注内容一覧");
            p.c1FlexViewer.DocumentSource = p.PrintReport;
            p.Show();
        }
        private void b_okiniiri_Click(object sender, EventArgs e)
        {
            //情報をデータベースに登録
            collect();

            // 顧客情報格納
            string table = "ContactSheet";

            Utile.RepoerDB rdb = new Utile.RepoerDB(table);
            rdb.deleteAll();

            //レポート作成用DBにタグにチェックがついている写真情報を格納する
            foreach (tagControl tc in this.tagsPanel.Controls)
            {
                if (tc.d_tag.Checked && tc.d_tagName.SelectedIndex == 0)
                {
                    using (var dbc = new DB.DBConnect())
                    {
                        //毎回読むのも非効率かな?
                        dbc.npg.Open();
                        StringBuilder sb = new StringBuilder();
                        sb.Append(@"select * ");
                        sb.Append(@"from t_selection as s ");
                        sb.Append(@"where s.reception_code = '@reception_code'".Replace("@reception_code", MainForm.session_t_reception.reception_code));

                        NpgsqlCommand command    = new NpgsqlCommand(sb.ToString(), dbc.npg);
                        var           dataReader = command.ExecuteReader();
                        while (dataReader.Read())
                        {
                            var color = (int)dataReader["color"];
                            if (tc.tagId == color)
                            {
                                var path  = System.IO.Path.Combine(Secondary_Select_dir, ((string)dataReader["folder_name"]).Trim(), tc.tagId.ToString());
                                var count = 0;
                                Dictionary <string, string> item = new Dictionary <string, string>();

                                foreach (string fpath in System.IO.Directory.GetFiles(path, "*", System.IO.SearchOption.AllDirectories))
                                {
                                    count++;

                                    //写真のファイル名フルパスの取得
                                    var fname = System.IO.Path.GetFileName(fpath);
                                    if (count % 3 == 1)
                                    {
                                        item.Add("customerCode", MainForm.session_t_reception.customer_code.ToString());
                                        item.Add("folderName", Save_dir.Trim());
                                        DB.m_customer cus = DB.m_customer.getSingle(MainForm.session_t_reception.customer_code.ToString());
                                        item.Add("customerSurnameKana", cus.surname_kana);
                                        item.Add("customerNameKana", cus.name_kana);
                                        item.Add("customerSurName", cus.surname);
                                        item.Add("customerName", cus.name);
                                        item.Add("orderEntryDate", MainForm.session_t_reception.receipt_date.ToString("yyyy年MM月dd日"));

                                        item.Add("filename1", fname);
                                        item.Add("image1", System.IO.Path.GetFullPath(fpath));
                                    }
                                    else if (count % 3 == 2)
                                    {
                                        item.Add("filename2", fname);
                                        item.Add("image2", System.IO.Path.GetFullPath(fpath));
                                    }
                                    else
                                    {
                                        item.Add("filename3", fname);
                                        item.Add("image3", System.IO.Path.GetFullPath(fpath));
                                        count = 0;
                                        rdb.insert(item);
                                        item.Clear();
                                    }
                                }
                                if (count != 0)
                                {
                                    rdb.insert(item);
                                }
                            }
                        }
                    }
                }
            }

            PrintForm p = new PrintForm();

            p.PrintReport.Load(@"./Asset/Format/ContactSheet.flxr", "ContactSheet");
            p.c1FlexViewer.DocumentSource = p.PrintReport;
            p.Show();
        }
예제 #5
0
        public override void PageRefresh()
        {
            //顧客情報設定
            if (MainForm.session_t_reception != null)
            {
                DB.m_customer cus = DB.m_customer.getSingle(MainForm.session_t_reception.customer_code);
                l_customer_code.Text = cus.customer_code;
                l_customer_name.Text = $"{cus.surname} {cus.name}";
                l_birthday.Text      = cus.birthday.ToString("yyyy年MM月dd日");
                l_age.Text           = GetAge(cus.birthday, DateTime.Now).ToString();
                l_sex.Text           = ((Utile.Data.性別)(int.Parse(cus.sex))).ToString();
                l_postal_code.Text   = cus.postal_code;
                l_address1.Text      = cus.address1;
                l_address2.Text      = cus.address2;
                l_address3.Text      = cus.address3;
                l_phone_number1.Text = cus.phone_number1;
                l_phone_number2.Text = cus.phone_number2;
                l_phone_number3.Text = cus.phone_number3;
                l_mail_address.Text  = cus.mail_address;
            }
            else
            {
                l_customer_code.Visible = false;
                l_customer_name.Visible = false;
                l_birthday.Visible      = false;
                l_age.Visible           = false;
                l_sex.Visible           = false;
                l_postal_code.Visible   = false;
                l_address1.Visible      = false;
                l_address2.Visible      = false;
                l_address3.Visible      = false;
                l_phone_number1.Visible = false;
                l_phone_number2.Visible = false;
                l_phone_number3.Visible = false;
                l_mail_address.Visible  = false;
            }

            //コンボボックス設定
            d_tenpomei.DataSource        = DB.m_store.getStoreNameList();
            d_shisetumei.DataSource      = DB.m_facility.getFacilityNameList(facility_reservation.store_code);
            d_satueisya.DataSource       = DB.m_staff.getStaffNameList(facility_reservation.store_code);
            d_select_name.DataSource     = DB.m_staff.getStaffNameList(facility_reservation.store_code);
            d_tasukukubun.DataSource     = DB.m_task.getTaskNameList();
            d_satsueimokuteki.DataSource = Enum.GetValues(typeof(Utile.Data.撮影目的));
            // 初期値設定
            d_tenpomei.SelectedIndex = d_tenpomei.FindStringExact(DB.m_store.getSingle(facility_reservation.store_code).store_name);
            if (facility_reservation.facility_code == MainForm.Reservation_timetable.scheduleLabel)
            {
                d_shisetumei.SelectedIndex = -1;
            }
            else
            {
                d_shisetumei.SelectedIndex = d_shisetumei.FindStringExact(DB.m_facility.getSingle(facility_reservation.store_code, facility_reservation.facility_code).facility_name);
            }
            var staff = DB.m_staff.getSingleName(facility_reservation.store_code, facility_reservation.photographer);

            if (staff != null)
            {
                d_satueisya.SelectedIndex   = d_satueisya.FindStringExact(staff.staff_name);
                d_select_name.SelectedIndex = d_select_name.FindStringExact(staff.staff_name);
            }
            else
            {
                d_satueisya.SelectedIndex   = -1;
                d_select_name.SelectedIndex = -1;
            }
            DB.m_task task = DB.m_task.getSingle(facility_reservation.task_class);
            if (task != null)
            {
                d_tasukukubun.SelectedIndex = d_tasukukubun.FindStringExact(task.task_name);
            }
            else
            {
                d_tasukukubun.SelectedIndex = 0;
            }
            if (facility_reservation.shooting_purpose == null)
            {
                d_satsueimokuteki.SelectedIndex = 0;
            }
            else
            {
                d_satsueimokuteki.SelectedIndex = d_satsueimokuteki.FindStringExact(facility_reservation.shooting_purpose);
            }

            //テキスト・カレンダー設定
            d_start_date.Value = facility_reservation.start_date;
            d_start_time.Text  = facility_reservation.start_time.ToString(@"hh\:mm");
            if (facility_reservation.end_date != DateTime.MinValue)
            {
                d_end_date.Value = facility_reservation.end_date;
            }
            else
            {
                d_end_date.Value = DateTime.Today.Date;
            }
            if (facility_reservation.end_time != TimeSpan.MinValue)
            {
                d_end_time.Text = (facility_reservation.start_time + TimeSpan.FromHours(1)).ToString(@"hh\:mm");
            }
            else
            {
                d_end_time.Text = "";
            }
            if (facility_reservation.selection_start_date != null && facility_reservation.selection_start_date.Value != DateTime.MinValue)
            {
                d_select_start_date.Value = facility_reservation.selection_start_date.Value;
            }
            else
            {
                d_select_start_date.Value = facility_reservation.start_date;
            }
            if (facility_reservation.selection_start_time != null && facility_reservation.selection_start_time.Value != TimeSpan.MinValue)
            {
                d_select_start_time.Text = facility_reservation.selection_start_time.Value.ToString(@"hh\:mm");
            }
            else
            {
                d_select_start_time.Text = facility_reservation.start_time.ToString(@"hh\:mm");
            };
            if (facility_reservation.selection_end_date != null && facility_reservation.selection_end_date.Value != DateTime.MinValue)
            {
                d_select_end_date.Value = facility_reservation.selection_end_date.Value;
            }
            else
            {
                d_select_end_date.Value = facility_reservation.end_date;
            }
            if (facility_reservation.selection_end_time != null && facility_reservation.selection_end_time.Value != TimeSpan.MinValue)
            {
                d_select_end_time.Text = facility_reservation.selection_end_time.Value.ToString(@"hh\:mm");
            }
            else
            {
                d_select_end_time.Text = (facility_reservation.start_time + TimeSpan.FromHours(1)).ToString(@"hh\:mm");
            };
            d_yoyakusya.Text = facility_reservation.reservator;
            if (facility_reservation.cancellation_date != null && facility_reservation.cancellation_date.Value != DateTime.MinValue)
            {
                d_tyushi.Value   = facility_reservation.cancellation_date.Value;
                d_tyushi.Checked = true;
            }
            else
            {
                d_tyushi.Value   = DateTime.Today.Date;
                d_tyushi.Checked = false;
            }

            d_tekiyou.Text = facility_reservation.remarks;

            //リスト更新
            if (MainForm.session_t_reception != null)
            {
                setYoyakuTabList(MainForm.session_t_reception.reception_code);
            }
            sescheduleTabList(facility_reservation.start_date, facility_reservation.store_code);

            //スケジュール切り替え
            if (facility_reservation.facility_code == MainForm.Reservation_timetable.scheduleLabel)
            {
                d_check.Checked = true;
            }
            else
            {
                d_check.Checked = false;
            }
            changeSchedule();

            //変更チェックリセット
            mod.reset();

            //入力チェックリセット
            chk.clear();
        }
        private void b_search_Click(object sender, EventArgs e)
        {
            //表,変数の初期化
            dataGridView1.Rows.Clear();


            //結果格納クエリーの初期化
            NpgsqlDataReader customerReader = null;

            using (var db = new DB.DBConnect())
            {
                //条件文の設定
                String strSQLWHERE = "";

                //顧客コード
                strSQLWHERE = t_customer_code.Text != "" ? "c.customer_code LIKE" + "'%" + t_customer_code.Text + "%'" : "";

                //お客様姓名
                strSQLWHERE += t_customer_name.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += t_customer_name.Text != "" ? "c.surname || c.name LIKE " + "'%" + t_customer_name.Text + "%'" : "";

                //お客様姓名 カナ
                strSQLWHERE += t_Customer_name_kana.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += t_Customer_name_kana.Text != "" ? "c.surname_kana || c.name_kana LIKE " + "'%" + t_Customer_name_kana.Text + "%'" : "";

                //電話番号
                strSQLWHERE += t_phone_number.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += t_phone_number.Text != "" ? "c.phone_number1 LIKE " + "'%" + t_phone_number.Text + "%'" : "";

                //性別
                strSQLWHERE += d_seibetsu.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += d_seibetsu.Text != "" ? "c.sex = " + "'" + d_seibetsu.SelectedIndex + "'" : "";

                //DM発送可
                strSQLWHERE += d_DM_shipping.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += d_DM_shipping.Text != "" ? "c.dm_delivery = " + "'" + d_DM_shipping.SelectedIndex + "'" : "";

                //結婚記念日
                strSQLWHERE += wedding_anniversary_from != null && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += wedding_anniversary_from != null ? "c.wedding_anniversary >= " + "'" + wedding_anniversary_from + "'" : "";
                strSQLWHERE += wedding_anniversary_to != null && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += wedding_anniversary_to != null ? "c.birthday <= " + "'" + wedding_anniversary_to + "'" : "";

                //生年月日
                strSQLWHERE += birthday_from != null && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += birthday_from != null ? "c.birthday >= " + "'" + birthday_from + "'" : "";
                strSQLWHERE += birthday_to != null && strSQLWHERE.Length > 0 ? " and " : "";
                strSQLWHERE += birthday_to != null ? "c.birthday <= " + "'" + birthday_to + "'" : "";

                if (c_member_search.Checked)
                {
                    //ランク
                    string member_lank = d_member_lank.SelectedIndex.ToString();
                    strSQLWHERE += d_member_lank.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += d_member_lank.Text != "" ? "m.rank = " + "'" + member_lank + "'" : "";

                    //会員種別
                    string membership_type = (d_member_type.SelectedIndex + 1).ToString();
                    strSQLWHERE += d_member_type.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += d_member_type.Text != "" ? "m.rank = " + "'" + membership_type + "'" : "";
                }

                if (c_family_search.Checked)
                {
                    //家族続柄
                    strSQLWHERE += t_family_zokugara.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += t_family_zokugara.Text != "" ? "f.relationship LIKE " + "'%" + t_family_zokugara.Text + "%'" : "";

                    //お客様家族姓名
                    strSQLWHERE += t_family_name.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += t_family_name.Text != "" ? "f.surname || f.name LIKE " + "'%" + t_family_name.Text + "%'" : "";

                    //お客様家族姓名かな
                    strSQLWHERE += t_family_name_kana.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += t_family_name_kana.Text != "" ? "f.surname_kana || f.name_kana LIKE " + "'%" + t_family_name_kana.Text + "%'" : "";

                    //家族性年月日
                    strSQLWHERE += family_birthday_from != null && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += family_birthday_from != null ? "f.birthday >= " + "'" + family_birthday_from + "'" : "";
                    strSQLWHERE += family_birthday_to != null && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += family_birthday_to != null ? "f.birthday <= " + "'" + family_birthday_to + "'" : "";

                    //家族性別
                    strSQLWHERE += d_family_seibetsu.Text != "" && strSQLWHERE.Length > 0 ? " and " : "";
                    strSQLWHERE += d_family_seibetsu.Text != "" ? "f.sex = " + "'" + d_family_seibetsu.SelectedIndex + "'" : "";
                }
                strSQLWHERE = strSQLWHERE.Length > 0 ? " WHERE " + strSQLWHERE : "";


                //DBオープン
                db.npg.Open();
                StringBuilder sb = new StringBuilder();


                //SQL文の生成
                //家族情報を検索に含めてしまうと、一意に決まらないために
                //家族検索時だけ家族情報をリンクするように変更。
                if (c_family_search.Checked)
                {
                    sb.Append(@"SELECT 
                            c.customer_code	as customer_code,							
                            c.surname as surname,							
                            c.surname_kana as surname_kana,			
                            c.name as name,	
                            c.name_kana as name_kana,
                            c.birthday as birthday,				
                            c.sex as sex,			
                            c.dm_delivery as dm_delivery,                               
                            c.sample_availability as sample_availability,
                            c.postal_code as postal_code,				
                            c.address1 as address1,								
                            c.address2 as address2,								
                            c.address3 as address3,								
                            c.mail_address	as mail_address,
                            c.phone_number1 as phone_number1,
                            c.phone_number2 as phone_number2,								
                            c.phone_number3 as phone_number3,								
                            c.fax_number as fax_number,                                 
                            c.wedding_anniversary as wedding_anniversary,
                            c.remarks as remarks,								
                            c.free_item1 as free_item1,								
                            c.free_item2 as free_item2,								
                            c.free_item3 as free_item3,								
                            c.reasons as reasons,
                            m.date as dateofregistration,
                            m.rank as rank,
                            m.membership_type as membership_type,								
                            f.relationship as relationship,		
                            f.surname as f_surname,		
                            f.surname_kana as f_surname_kana,					
                            f.name as f_name,			
                            f.name_kana as f_name_kana,						
                            f.birthday as f_birthday,			
                            f.sex as f_sex,
                            r.status as status
                            ");
                    sb.Append(@"FROM
                            m_customer AS c
                            LEFT JOIN m_member AS m ON
                            c.customer_code = m.customer_code
                            LEFT JOIN m_family AS f ON
                            c.customer_code = f.customer_code
                            LEFT JOIN (
                            SELECT status,customer_code from t_reception 
                            WHERE status = '3') AS r ON 
                            c.customer_code = r.customer_code
                            ");
                    sb.Append(@strSQLWHERE);
                    sb.Append(@" ORDER BY c.customer_code");
                }
                else
                {
                    sb.Append(@"SELECT 
                            c.customer_code	as customer_code,							
                            c.surname as surname,							
                            c.surname_kana as surname_kana,			
                            c.name as name,	
                            c.name_kana as name_kana,
                            c.birthday as birthday,				
                            c.sex as sex,			
                            c.dm_delivery as dm_delivery,                               
                            c.sample_availability as sample_availability,
                            c.postal_code as postal_code,				
                            c.address1 as address1,								
                            c.address2 as address2,								
                            c.address3 as address3,								
                            c.mail_address	as mail_address,
                            c.phone_number1 as phone_number1,
                            c.phone_number2 as phone_number2,								
                            c.phone_number3 as phone_number3,								
                            c.fax_number as fax_number,                                 
                            c.wedding_anniversary as wedding_anniversary,
                            c.remarks as remarks,								
                            c.free_item1 as free_item1,								
                            c.free_item2 as free_item2,								
                            c.free_item3 as free_item3,								
                            c.reasons as reasons,
                            m.date as dateofregistration,
                            m.rank as rank,
                            m.membership_type as membership_type,
                            r.status as status
                            ");
                    sb.Append(@"FROM
                            m_customer AS c
                            LEFT JOIN m_member AS m ON
                            c.customer_code = m.customer_code
                            LEFT JOIN (
                            SELECT status,customer_code from t_reception 
                            WHERE status = '3' group by customer_code,status) AS r ON 
                            c.customer_code = r.customer_code
                            ");
                    sb.Append(@strSQLWHERE);
                    sb.Append(@" ORDER BY c.customer_code");
                }
                var command = new NpgsqlCommand(sb.ToString(), db.npg);

                customerReader = command.ExecuteReader();
                if (customerReader.HasRows)
                {
                    while (customerReader.Read())
                    {
                        //内規情報フラグ
                        var naiki = customerReader["status"].ToString() == "3" ? "★" : "";
                        //顧客コード
                        var customer_code = customerReader["customer_code"].ToString();
                        //名前
                        var fullname = customerReader["surname"].ToString() + customerReader["name"].ToString();
                        //名前カナ
                        var fullname_kana = customerReader["surname_kana"].ToString() + customerReader["name_kana"].ToString();
                        //電話番号
                        var phone_number = customerReader["phone_number1"].ToString();
                        //誕生日
                        DateTime.TryParse(customerReader["birthday"].ToString(), out DateTime birthday);
                        //性別
                        int intVal1 = int.Parse(customerReader["sex"].ToString());
                        var sex     = (Utile.Data.性別)Enum.ToObject(typeof(Utile.Data.性別), intVal1);
                        //DM送付区分
                        int intVal2     = int.Parse(customerReader["dm_delivery"].ToString());
                        var dm_delivery = (Utile.Data.DM発送)Enum.ToObject(typeof(Utile.Data.DM発送), intVal2);
                        //郵便番号
                        var postal_code = customerReader["postal_code"].ToString();
                        //結婚記念日
                        DateTime.TryParse(customerReader["wedding_anniversary"].ToString(), out DateTime wedding_anniversary);
                        //登録日
                        DateTime.TryParse(customerReader["dateofregistration"].ToString(), out DateTime dateofregistration);
                        var strdateofregistration = customerReader["dateofregistration"].ToString() != "" ? dateofregistration.ToShortDateString() : "";
                        //ランク
                        int.TryParse(customerReader["rank"].ToString(), out int intVal3);
                        var rank    = (Utile.Data.ランク)Enum.ToObject(typeof(Utile.Data.ランク), intVal3);
                        var strrank = strdateofregistration != "" ? rank.ToString() : "";
                        //会員種別
                        int.TryParse((customerReader["membership_type"].ToString()), out int intVal4);
                        var membership_type    = Enum.ToObject(typeof(Utile.Data.会員種別), intVal4).ToString();
                        var strmembership_type = strdateofregistration != "" ? membership_type.ToString() : "";

                        //家族検索時のみ
                        string family_name  = "";
                        string relationship = "";
                        string family_sex   = "";

                        if (c_family_search.Checked == true)
                        {
                            //家族名前
                            family_name = customerReader["f_surname"].ToString() + customerReader["f_name"].ToString();
                            //続柄
                            relationship = customerReader["relationship"].ToString();
                            //性別
                            int.TryParse(customerReader["f_sex"].ToString(), out int intVal5);
                            family_sex = family_name != ""?(string)Enum.ToObject(typeof(Utile.Data.性別), intVal5).ToString():"";
                        }

                        dataGridView1.Rows.Add(
                            naiki,
                            customer_code,
                            fullname,
                            fullname_kana,
                            phone_number,
                            birthday.ToShortDateString(),
                            dm_delivery,
                            sex,
                            postal_code,
                            wedding_anniversary.ToShortDateString(),
                            strdateofregistration,
                            strrank,
                            strmembership_type,
                            family_name,
                            relationship,
                            family_sex
                            );

                        //セッションデータへの引継ぎ用のリスト作成
                        DB.m_customer m_Customer = new DB.m_customer();

                        m_Customer.customer_code       = customerReader["customer_code"].ToString();
                        m_Customer.surname             = customerReader["surname"].ToString();
                        m_Customer.surname_kana        = customerReader["surname_kana"].ToString();
                        m_Customer.name                = customerReader["name"].ToString();
                        m_Customer.name_kana           = customerReader["name_kana"].ToString();
                        m_Customer.birthday            = DateTime.Parse(customerReader["birthday"].ToString());
                        m_Customer.sex                 = customerReader["sex"].ToString();
                        m_Customer.dm_delivery         = customerReader["dm_delivery"].ToString();
                        m_Customer.sample_availability = customerReader["sample_availability"].ToString();
                        m_Customer.postal_code         = customerReader["postal_code"].ToString();
                        m_Customer.address1            = customerReader["address1"].ToString();
                        m_Customer.address2            = customerReader["address2"].ToString();
                        m_Customer.address3            = customerReader["address3"].ToString();
                        m_Customer.mail_address        = customerReader["mail_address"].ToString();
                        m_Customer.phone_number1       = customerReader["phone_number1"].ToString();
                        m_Customer.phone_number2       = customerReader["phone_number2"].ToString();
                        m_Customer.phone_number3       = customerReader["phone_number3"].ToString();
                        m_Customer.fax_number          = customerReader["fax_number"].ToString();
                        m_Customer.wedding_anniversary = DateTime.Parse(customerReader["wedding_anniversary"].ToString());
                        m_Customer.remarks             = customerReader["remarks"].ToString();
                        m_Customer.free_item1          = customerReader["free_item1"].ToString();
                        m_Customer.free_item2          = customerReader["free_item2"].ToString();
                        m_Customer.free_item3          = customerReader["free_item3"].ToString();
                        m_Customer.reasons             = customerReader["reasons"].ToString();

                        Customers.Add(m_Customer);
                    }
                }
                else
                {
                    MessageBox.Show("検索結果が0件でした。", "お知らせ", MessageBoxButtons.OK);
                }
            }
        }