Ejemplo n.º 1
0
 public Login()
 {
     InitializeComponent();
     //必須項目チェック
     //入力チェック初期化
     chk = new checkOperation(this);
     //コントロールを追加
     chk.addControl(t_password);
     chk.addControl(t_login);
 }
Ejemplo n.º 2
0
        public Staff_master()
        {
            InitializeComponent();

            //入力チェック初期化
            chk = new checkOperation(this);
            chk.addControl(d_tenpo);
            chk.addControl(t_staff_code);
            chk.addControl(t_staff);
            chk.addControl(t_staff_kana);
            chk.addControl(t_login_id);
            chk.addControl(t_password);
            chk.addControl(d_kengen);
            chk.addControl(d_employment);
            chk.addControl(d_seibetsu);
            chk.addControl(d_status);
        }
Ejemplo n.º 3
0
        public Facility_master()
        {
            InitializeComponent();

            //存在チェック項目の追加
            chkExist = new checkOperation(this);
            chkExist.addControl(d_tenpo);
            chkExist.addControl(t_facility);
            chkExist.addControl(t_facility_code);

            //桁数チェック
            chk8Digit = new checkOperation(this);
            chk8Digit.addControl(t_facility_code);

            chk20Digit = new checkOperation(this);
            chk20Digit.addControl(t_facility);
        }
Ejemplo n.º 4
0
        private void t_current_page_Leave(object sender, EventArgs e)
        {
            using (var dbc = new DB.DBConnect())
            {
                var q = from t in dbc.m_facility
                        where t.delete_flag == "0"
                        select t;
                totalPage = q.Count();
            }

            chk.clear();
            chk.addControl(t_current_page);
            if (chk.check("W00003", chk.checkTextboxFormat, @"^\d{1,5}?\z", @"数値") ||
                chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }

            d_tenpo.Enabled         = false;
            t_facility_code.Enabled = false;
            currentPage             = int.Parse(t_current_page.Text);

            if (currentPage > 0 && currentPage <= totalPage)
            {
                if (changeValue == false)
                {
                    set_currentDisplay();
                }
                else
                {
                    DialogResult result = MessageBox.Show("変更が保存されてません。\n" +
                                                          "処理を破棄して次の処理に進みますか?", "変更確認メッセージ",
                                                          MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        set_currentDisplay();
                    }
                }
            }
            else
            {
                Utile.Message.showMessageOK("I14001");
            }
        }
Ejemplo n.º 5
0
        private void b_regist_Click(object sender, EventArgs e)
        {
            chk.clear();
            chk.addControl(t_start_time);
            chk.addControl(t_end_time);
            chk.addControl(t_syugyoukubun);
            chk.addControl(d_staff);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }


            chk.clear();
            chk.addControl(t_start_time);
            chk.addControl(t_end_time);
            if (chk.check("W00003", chk.checkTextboxFormat, @"^([0-9]|[0-1][0-9]|[2][0-3]):[0-5][0-9]$", "00:00"))
            {
                return;
            }

            var ss = GetStaff_Shift();

            if (ss == null)
            {
                ss            = new DB.m_staff_shift();
                ss.store_code = DB.m_store.getSingleName(d_tenpo.SelectedItem.ToString()).store_code;
                ss.staff_code = DB.m_staff.getSingleName(ss.store_code, d_staff.SelectedItem.ToString()).staff_code;
                ss.work_day   = monthCalendar1.SelectionStart;
            }
            ss.start_time = TimeSpan.Parse(t_start_time.Text);
            ss.end_time   = TimeSpan.Parse(t_end_time.Text);
            ss.work_class = t_syugyoukubun.SelectedIndex.ToString();
            ss.Command();

            Utile.Message.showMessageOK("I11001");
            mod.reset();
        }
Ejemplo n.º 6
0
        //登録ボタン
        private void b_regist_Click(object sender, EventArgs e)
        {
            //必須入力チェック
            chk.clear();
            chk.addControl(t_tenpo_code);
            chk.addControl(t_company);
            chk.addControl(t_tenpo);
            chk.addControl(t_postal_code);
            chk.addControl(t_kensikuchouson);
            chk.addControl(t_banchi);
            chk.addControl(t_telephon_no);
            chk.addControl(t_eigyou_start);
            chk.addControl(t_eigyou_end);
            chk.addControl(t_regular_holiday);
            chk.addControl(d_status);
            chk.addControl(d_tenpo_kubun);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }

            //桁数
            //5
            chk.clear();
            chk.addControl(t_eigyou_start);
            chk.addControl(t_eigyou_end);
            if (chk.check("W00001", chk.checkTextboxLength, 5))
            {
                return;
            }
            //8
            chk.clear();
            chk.addControl(t_tenpo_code);
            if (chk.check("W00001", chk.checkTextboxLength, 8))
            {
                return;
            }
            //10
            chk.clear();
            chk.addControl(t_regular_holiday);
            if (chk.check("W00001", chk.checkTextboxLength, 10))
            {
                return;
            }
            //13
            chk.clear();
            chk.addControl(t_telephon_no);
            if (chk.check("W00001", chk.checkTextboxLength, 13))
            {
                return;
            }
            //60
            chk.clear();
            chk.addControl(t_company);
            chk.addControl(t_tenpo);
            if (chk.check("W00001", chk.checkTextboxLength, 60))
            {
                return;
            }
            //120
            chk.clear();
            chk.addControl(t_kensikuchouson);
            chk.addControl(t_banchi);
            chk.addControl(t_apart);
            if (chk.check("W00001", chk.checkTextboxLength, 120))
            {
                return;
            }

            //フォーマットチェック
            chk.clear();
            chk.addControl(t_eigyou_start);
            chk.addControl(t_eigyou_end);
            if (chk.check("W00003", chk.checkTextboxFormat, @"^([0-9]|[0-1][0-9]|[2][0-3]):[0-5][0-9]$", "00:00"))
            {
                return;
            }

            chk.clear();
            chk.addControl(t_telephon_no);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\A0\d{1,4}-\d{1,4}-\d{4}\z", "000-0000-0000"))
            {
                return;
            }

            chk.clear();
            chk.addControl(t_postal_code);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\A\d\d\d-\d\d\d\d\z", "000-0000"))
            {
                return;
            }

            if (t_tenpo_code.Text == "")
            {
                Utile.Message.showMessageOK("E13001");
                return;
            }

            //内容保存
            //ListStore();


            StoreCode       = this.t_tenpo_code.Text;
            StoreCompany    = this.t_company.Text;
            StoreName       = this.t_tenpo.Text;
            StorePostalCode = this.t_postal_code.Text;
            StorePrefCityTownDistrictVillage = this.t_kensikuchouson.Text;
            StoreAddress        = this.t_banchi.Text;
            StoreApart          = this.t_apart.Text;
            StorePhoneNumber    = this.t_telephon_no.Text;
            StoreStatus         = this.d_status.SelectedIndex.ToString();
            StoreStartTime      = TimeSpan.Parse(this.t_eigyou_start.Text);
            StoreEndTime        = TimeSpan.Parse(this.t_eigyou_end.Text);
            StoreRegularHoliday = this.t_regular_holiday.Text;
            StoreClassification = this.d_tenpo_kubun.SelectedIndex.ToString();


            using (var dbc = new DB.DBConnect())
            {
                var data = DB.m_store.getSingle(StoreCode);
                if (data == null)
                {
                    data = new DB.m_store();
                }

                data.store_code      = StoreCode;
                data.company_name    = StoreCompany;
                data.store_name      = StoreName;
                data.postal_code     = StorePostalCode;
                data.address1        = StorePrefCityTownDistrictVillage;
                data.address2        = StoreAddress;
                data.address3        = StoreApart;
                data.phone_number    = StorePhoneNumber;
                data.status          = StoreStatus;
                data.start_time      = StoreStartTime;
                data.end_time        = StoreEndTime;
                data.regular_holiday = StoreRegularHoliday;
                data.store_category  = StoreClassification;

                data.Command();
            }

            var    rootPath   = System.Configuration.ConfigurationManager.AppSettings["photo_root"].ToString();
            var    cosDir     = System.Configuration.ConfigurationManager.AppSettings["Costume_Image"].ToString();
            string Cost_Path  = System.IO.Path.Combine(rootPath, cosDir);
            string store_Path = System.IO.Path.Combine(Cost_Path, StoreName);

            if (!System.IO.Directory.Exists(store_Path))
            {
                ;
            }
            {
                Directory.CreateDirectory(store_Path);
            }

            /*
             * max_index = StoreList.Count;
             *
             * // 接続インスタンスを作成。
             * var dbc = new DB.DBConnect();
             *
             * //insert文の生成
             * for (int i = 0; i < max_index; i++)            {
             *  // 登録する新規データの入れ物を作成(店舗マスターに対して実行する)。
             *  DB.m_store data = dbc.m_store.Create();
             *  //データの投入
             *  data.store_code = StoreList[i].store_code;
             *  data.company_name = StoreList[i].store_company;
             *  data.store_name = StoreList[i].store_name;
             *  data.postal_code = StoreList[i].store_postal_code;
             *  data.address1 = StoreList[i].store_pref_city_town_district_village;
             *  data.address2 = StoreList[i].store_address;
             *  data.address3 = StoreList[i].store_apart;
             *  data.phone_number = StoreList[i].store_phone_number;
             *  data.status = StoreList[i].store_status;
             *  data.start_time = StoreList[i].store_start_time;
             *  data.end_time = StoreList[i].store_end_time;
             *  data.regular_holiday = StoreList[i].store_regular_hoiday;
             *  data.store_category = StoreList[i].store_classification;
             *  data.registration_date = nowDay;
             *  data.registration_staff = MainForm.session_m_staff.staff_name;
             *  data.update_date = nowDay;
             *  data.update_staff = MainForm.session_m_staff.staff_name;
             *  data.delete_flag = "0";
             *
             *
             *  // レコードををテーブルに登録。
             *  dbc.m_store.Add(data);
             *
             *  //INSERT文が問題ない場合は実行する
             *  try
             *  {
             *      dbc.SaveChanges();
             *  }
             *  //エラーの場合はUPDATE文を生成し実行する
             *  catch (Exception)
             *  {
             *      //データ確認用の店舗コードを取得する(現時点では店舗コード入力欄に店舗コードが入っているものを検索している)
             *      //upStoreCode = this.t_tenpo_code.Text;
             *
             *      // 接続インスタンスを作成。
             *      dbc = new DB.DBConnect();
             *
             *
             *      // 絞り込んで取得。
             *      var filterData = DB.m_store.getSingle(StoreList[i].store_code);
             *
             *      m_storeStoreCode = filterData.store_code;
             *      m_storeStoreCompany = filterData.company_name;
             *      m_storeStoreName = filterData.store_name;
             *      m_storeStorePostalCode = filterData.postal_code;
             *      m_storeStorePrefCityTownDistrictVillage = filterData.address1;
             *      m_storeStoreAddress = filterData.address2;
             *      m_storeStoreApart = filterData.address3;
             *      m_storeStorePhoneNumber = filterData.phone_number;
             *      m_storeStoreStatus = filterData.status;
             *      m_storeStoreStartTime = filterData.start_time;
             *      m_storeStoreEndTime = filterData.end_time;
             *      m_storeStoreRegularHoliday = filterData.regular_holiday;
             *      m_storeStoreClassification = filterData.store_category;
             *
             *
             *      // 更新する新規データの入れ物を作成。
             *      data = DB.m_store.getSingle(StoreList[i].store_code);
             *
             *      //データを比較しながらアップデート文を生成する
             *      for (int j=0; j < max_index; j++)
             *      {
             *
             *          //会社名が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreCompany != StoreList[j].store_company)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //企業名を変更
             *              data.company_name = StoreList[j].store_company;
             *          }
             *
             *          //店舗名が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreName != StoreList[j].store_name)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //店舗名を変更
             *              data.store_name = StoreList[j].store_name;
             *          }
             *
             *          //郵便番号が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStorePostalCode != StoreList[j].store_postal_code)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //郵便番号を変更
             *              data.postal_code = StoreList[j].store_postal_code;
             *          }
             *
             *          //県・市町区村が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStorePrefCityTownDistrictVillage != StoreList[j].store_pref_city_town_district_village)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //県・市区町村を変更
             *              data.address1 = StoreList[j].store_pref_city_town_district_village;
             *          }
             *
             *          //番地が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreAddress != StoreList[j].store_address)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //番地を変更
             *              data.address2 = StoreList[j].store_address;
             *          }
             *
             *          //アパート・マンションが変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreApart != StoreList[j].store_apart)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //アパート・マンションを変更
             *              data.address3 = StoreList[j].store_apart;
             *          }
             *
             *          //電話番号が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStorePhoneNumber != StoreList[j].store_phone_number)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //電話番号を変更
             *              data.phone_number = StoreList[j].store_phone_number;
             *          }
             *
             *          //ステータスが変わっていないかを確認。変わっていればデータベース更新
             *          //開店中の場合
             *          if (m_storeStoreStatus == StoreList[j].store_status)
             *          {
             *              data.status = StoreList[j].store_status;
             *          }
             *
             *          //店舗開始時間が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreStartTime != StoreList[j].store_start_time)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //店舗開始時間を変更
             *              data.start_time = StoreList[j].store_start_time;
             *          }
             *
             *          //店舗終了時間が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreEndTime != StoreList[j].store_end_time)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //店舗終了時間を変更
             *              data.end_time = StoreList[j].store_end_time;
             *          }
             *
             *          //店舗休業日が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreRegularHoliday != StoreList[j].store_regular_hoiday)
             *          {
             *              //変更がかかっている場合はスキーマに設定した変数に直書き
             *              //店舗休業日を変更
             *              data.regular_holiday = StoreList[j].store_regular_hoiday;
             *          }
             *
             *          //店舗区分が変わっていないかを確認。変わっていればデータベース更新
             *          if (m_storeStoreClassification == StoreList[j].store_classification)
             *          {
             *              data.store_category = StoreList[i].store_classification;
             *          }
             *
             *          data.update_date = nowDay;
             *          data.update_staff = MainForm.session_m_staff.staff_name;
             *          data.delete_flag = "0";
             *
             *
             *          // 更新内容を反映。
             *          dbc.SaveChanges();
             *      }
             *  }
             * }
             */
            pageParent.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 7
0
        //登録
        private void b_regist_Click(object sender, EventArgs e)
        {
            //入力チェック
            chk.clear();
            chk.addControl(d_tenpo);
            chk.addControl(t_staff_code);
            chk.addControl(t_staff);
            chk.addControl(t_staff_kana);
            chk.addControl(t_login_id);
            chk.addControl(t_password);
            chk.addControl(d_kengen);
            chk.addControl(d_employment);
            chk.addControl(d_seibetsu);
            chk.addControl(d_status);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }

            //桁数チェック
            chk.clear();
            chk.addControl(t_staff_code);
            if (chk.check("W00001", chk.checkTextboxLength, 8))
            {
                return;
            }

            chk.clear();
            chk.addControl(t_login_id);
            chk.addControl(t_staff);
            if (chk.check("W00001", chk.checkTextboxLength, 20))
            {
                return;
            }

            chk.clear();
            chk.addControl(t_staff_kana);
            if (chk.check("W00001", chk.checkTextboxLength, 40))
            {
                return;
            }

            chk.clear();
            chk.addControl(t_password);
            if (chk.check("W00001", chk.checkTextboxLength, 256))
            {
                return;
            }

            //データベース更新処理
            //データの取得
            StaffListStore();

            if (update_flag == false || newData_flag == true)
            {
                // 接続インスタンスを作成。
                var dbc = new DB.DBConnect();


                // 登録する新規データの入れ物を作成(スタッフマスターに対して実行する)。
                DB.m_staff data = dbc.m_staff.Create();
                //データの投入
                data.store_code       = staff_store_code;
                data.staff_code       = staff_code;
                data.staff_name       = staff_name;
                data.staff_name_kana  = staff_name_kana;
                data.login_id         = staff_login_id;
                data.password         = staff_Hash_password;
                data.permission_class = staff_kengen;
                data.work_class       = staff_employment;
                data.status           = staff_status;
                data.sex = staff_seibetu;


                data.registration_date  = staff_registration_date;
                data.registration_staff = staff_registration_staff;
                data.update_date        = staff_update_date;
                data.update_staff       = staff_update_staff;
                data.delete_flag        = staff_delete_flag;


                // レコードををテーブルに登録。
                dbc.m_staff.Add(data);

                try
                {
                    dbc.SaveChanges();
                }
                catch (Exception)
                {
                    Utile.Message.showMessageOK("E14000");
                    return;
                }
                finally
                {
                    dbc.npg.Close();
                }
            }
            else if (update_flag == true || newData_flag == false)
            {
                // 接続インスタンスを作成。
                var dbc2 = new DB.DBConnect();
                //更新用スタッフコードの取得
                index           = currentPage - 1;
                updateStaffCode = StaffDBList[index].staff_code;
                //更新前データの取り込み
                var filterData = StaffDBList[index];
                storeIndex = this.d_tenpo.SelectedIndex;


                //更新前データの取り込み
                m_StaffStaff_store_code         = filterData.staff_store_code;
                m_StaffStaff_code               = filterData.staff_code;
                m_StaffStaff_name               = filterData.staff_name;
                m_StaffStaff_name_kana          = filterData.staff_name_kana;
                m_StaffStaff_login_id           = filterData.login_id;
                m_StaffStaff_password           = filterData.password;
                m_StaffStaff_kengen             = filterData.kengen;
                m_StaffStaff_status             = filterData.status;
                m_StaffStaff_employment         = filterData.employment;
                m_StaffStaff_seibetu            = filterData.seibetu;
                m_StaffStaff_registration_date  = filterData.registration_date;
                m_StaffStaff_registration_staff = filterData.registration_staff;
                m_StaffStaff_update_date        = filterData.update_date;
                m_StaffStaff_update_staff       = filterData.update_staff;
                m_StaffStaff_delete_flag        = filterData.delete_flag;

                //更新用スタッフコードの取得
                index           = currentPage - 1;
                updateStaffCode = StaffDBList[index].staff_code;
                storeIndex      = this.d_tenpo.SelectedIndex;
                updateStoreCode = storeCodeList[storeIndex].store_code;
                // 接続インスタンスを作成。
                var dbc = new DB.DBConnect();
                dbc.npg.Open();
                StringBuilder sb = new StringBuilder();
                using (var transaction = dbc.npg.BeginTransaction())
                {
                    sb.Append("update m_staff set ");
                    if (staff_store_code != m_StaffStaff_store_code)
                    {
                        sb.Append("store_code = '" + staff_store_code + "', ");
                    }
                    if (staff_code != m_StaffStaff_code)
                    {
                        sb.Append("staff_code = '" + staff_code + "', ");
                    }
                    if (staff_name != m_StaffStaff_name)
                    {
                        sb.Append("staff_name = '" + staff_name + "', ");
                    }
                    if (staff_name_kana != m_StaffStaff_name_kana)
                    {
                        sb.Append("staff_name_kana = '" + staff_name_kana + "', ");
                    }
                    if (staff_login_id != m_StaffStaff_login_id)
                    {
                        sb.Append("login_id = '" + staff_login_id + "', ");
                    }
                    if (staff_Hash_password != m_StaffStaff_password)
                    {
                        sb.Append("password = '******', ");
                    }
                    if (staff_kengen != m_StaffStaff_kengen)
                    {
                        sb.Append("permission_class = '" + staff_kengen + "', ");
                    }
                    if (staff_employment != m_StaffStaff_employment)
                    {
                        sb.Append("work_class = '" + staff_employment + "', ");
                    }
                    if (staff_status != m_StaffStaff_status)
                    {
                        sb.Append("status = '" + staff_status + "', ");
                    }
                    if (staff_seibetu != m_StaffStaff_seibetu)
                    {
                        sb.Append("sex = '" + staff_seibetu + "', ");
                    }
                    sb.Append("update_date = '" + nowToday + "', ");
                    sb.Append("update_staff = '" + MainForm.session_m_staff.staff_name + "', ");
                    sb.Append("delete_flag = '" + staff_delete_flag + "' ");
                    sb.Append("where store_code = '" + staff_store_code + "' AND ");
                    sb.Append("staff_code = '" + staff_code + "';");

                    string strsql = sb.ToString();

                    var command = new NpgsqlCommand(strsql, dbc.npg);
                    try
                    {
                        command.ExecuteNonQuery();
                        transaction.Commit();
                    }
                    catch (NpgsqlException)
                    {
                        transaction.Rollback();
                        Utile.Message.showMessageOK("E14001");
                        return;
                    }
                    finally
                    {
                        dbc.npg.Close();
                    }
                }
            }

            //登録後画面初期化し次の登録を始める
            MainForm.Staff_master.PageRefresh();
            //MainForm.backPage(this);
            if (data_flag == false && update_flag == false)
            {
                currentPage++;
                totalPage++;
            }
            else if (data_flag == true && update_flag == false)
            {
                currentPage = StaffDBList.Count + 1;
                totalPage   = StaffDBList.Count + 1;
            }
            else if (data_flag == true && update_flag == true)
            {
                currentPage = StaffDBList.Count;
                totalPage   = StaffDBList.Count;
            }
            //新規データフラグを立てる
            newData_flag = true;
            //データ取得
            ListArrayStaff();
            init_flag   = false;
            update_flag = false;
            Set_initialDisplay();
            t_current_page.Text = (string)currentPage.ToString("0");
            t_total_page.Text   = (string)totalPage.ToString("0");

            pageParent.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 8
0
        private void b_regist_Click(object sender, EventArgs e)
        {
            //必須入力チェック
            chkExist.addControl(d_tenpo);
            chkExist.addControl(t_facility);
            chkExist.addControl(t_facility_code);
            if (chkExist.check("W00000", chkExist.checkControlImportant))
            {
                return;
            }

            //8桁数チェック
            chk8Digit.addControl(t_facility_code);
            if (chk8Digit.check("W00001", chk8Digit.checkTextboxLength, 8))
            {
                return;
            }

            //20桁チェック
            chk20Digit.addControl(t_facility);
            if (chk20Digit.check("W00001", chk20Digit.checkTextboxLength, 20))
            {
                return;
            }

            //キーの設定
            string store_code    = storeCodeList.Find(x => x.store_name == d_tenpo.Text).store_code;
            string facility_code = t_facility_code.Text;

            //登録処理
            bool toroku = false;

            for (var i = 0; i < facilities.Count; i++)
            {
                if (facilities[i].store_code == store_code &&
                    facilities[i].facility_code == facility_code)
                {
                    toroku = true;
                    break;
                }
            }

            if (!toroku)
            {
                //登録処理
                using (var dbc = new DB.DBConnect())
                {
                    dbc.npg.Open();
                    using (var transaction = dbc.npg.BeginTransaction())
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append(@"insert into m_facility values");
                        sb.Append(@"(" +
                                  "'" + store_code + "'," +
                                  "'" + facility_code + "'," +
                                  "'" + t_facility.Text + "'," +
                                  "'" + DateTime.Now.Date + "'," +
                                  "'" + MainForm.session_m_staff.staff_name + "')"
                                  );

                        var command = new NpgsqlCommand(sb.ToString(), dbc.npg);
                        try
                        {
                            command.ExecuteNonQuery();
                            transaction.Commit();
                        }
                        catch (NpgsqlException)
                        {
                            transaction.Rollback();
                            throw;
                        }
                    }
                }
            }
            else
            {
                //更新処理
                using (var dbc = new DB.DBConnect())
                {
                    dbc.npg.Open();
                    using (var transaction = dbc.npg.BeginTransaction())
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append(@"update m_facility set ");
                        sb.Append(@"" +
                                  "store_code = '" + store_code + "'," +
                                  "facility_code = '" + facility_code + "'," +
                                  "facility_name = '" + t_facility.Text + "'," +
                                  "update_date = '" + DateTime.Now.Date + "'," +
                                  "update_staff = '" + MainForm.session_m_staff.staff_name + "'"
                                  );
                        sb.Append(@" where store_code = " + "'" + store_code + "' and " +
                                  "facility_code =" + "'" + facility_code + "'");

                        var command = new NpgsqlCommand(sb.ToString(), dbc.npg);
                        try
                        {
                            command.ExecuteNonQuery();
                            transaction.Commit();
                        }
                        catch (NpgsqlException)
                        {
                            transaction.Rollback();
                            throw;
                        }
                    }
                }
            }

            //登録後、ひとつ前の画面に戻る
            MainForm.Facility_master.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 9
0
        private void b_regist_Click(object sender, EventArgs e)
        {
            //必須入力チェック
            //存在チェック項目の追加
            chkExist.addControl(t_reception_code);
            chkExist.addControl(d_receipt_date);
            chkExist.addControl(t_reception_time);
            chkExist.addControl(d_receipt_staff);
            chkExist.addControl(d_receipt_store);
            chkExist.addControl(d_status);
            chkExist.addControl(t_photographers);
            chkExist.addControl(d_coming_store_category);
            chkExist.addControl(d_motivation);
            chkExist.addControl(d_customer_code);
            if (chkExist.check("W00000", chkExist.checkControlImportant))
            {
                return;
            }

            //受付コードチェック
            chkreceptcode.addControl(t_reception_code);
            if (chkreceptcode.check("W00001", chkreceptcode.checkTextboxLength, 8))
            {
                return;
            }

            //受付時間チェック
            chkrecepttime.addControl(t_reception_time);
            if (chkrecepttime.check("W00001", chkrecepttime.checkTextboxLength, 5))
            {
                return;
            }
            if (chkrecepttime.check("W00003", chkrecepttime.checkTextboxFormat, @"^[0-2][0-9]:[0-5][0-9]$", @"HH:MM"))
            {
                return;
            }

            //撮影人数チェック
            chkphotographers.addControl(t_photographers);
            if (chkphotographers.check("W00001", chkphotographers.checkTextboxLength, 4))
            {
                return;
            }

            if (chkphotographers.check("W00003", chkphotographers.checkTextboxFormat, @"\d+", @"0~9999"))
            {
                return;
            }

            //メモチェック
            //メモチェック
            chkmemo.addControl(t_memo);
            if (chkmemo.check("W00001", chkmemo.checkTextboxLength, 255))
            {
                return;
            }

            //クレームチェック
            //クレームチェック
            chkclaim.addControl(d_claim);
            if (chkclaim.check("W00001", chkclaim.checkTextboxLength, 255))
            {
                return;
            }


            //登録処理
            //キーの設定
            string recept_code = t_reception_code.Text;

            //登録処理
            DB.t_reception reception = new DB.t_reception();
            using (var dbc = new DB.DBConnect())
            {
                dbc.npg.Open();
                using (var transaction = dbc.npg.BeginTransaction())
                {
                    //登録処理
                    var data = dbc.t_reception.FirstOrDefault(x => x.reception_code == recept_code);
                    if (data == null)
                    {
                        reception.reception_code        = recept_code;
                        reception.receipt_date          = d_receipt_date.Value;
                        reception.receipt_time          = TimeSpan.Parse(t_reception_time.Text);
                        reception.status                = (d_status.SelectedIndex + 1).ToString();
                        reception.photographers         = int.Parse(t_photographers.Text);
                        reception.coming_store_category = (d_coming_store_category.SelectedIndex + 1).ToString();
                        reception.customer_code         = d_customer_code.Text != ""? d_customer_code.Text:"00000000";
                        reception.store              = storeCodeList.Find(x => x.store_name == d_receipt_store.Text).store_name;
                        reception.staff              = staffCodeList.Find(x => x.staff_name == d_receipt_staff.Text).staff_name;
                        reception.memo               = t_memo.Text;
                        reception.claim              = d_claim.Text;
                        reception.motivation         = (d_motivation.SelectedIndex + 1).ToString();
                        reception.noprint            = "0";
                        reception.registration_date  = DateTime.Now.Date;
                        reception.registration_staff = MainForm.session_m_staff.staff_name;
                        dbc.t_reception.Add(reception);
                    }
                    else
                    {
                        MessageBox.Show("データがすでに存在してます。");
                        return;
                    }
                    try
                    {
                        dbc.SaveChanges();
                        transaction.Commit();
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                    }
                }
            }
            if (d_customer_code.Text != "")
            {
                //セッション情報の追加
                MainForm.session_t_reception = reception;

                //ヘッダメニュー更新
                MainForm.Header_Menu.LabelReWrite();
            }

            //一つ前に戻る
            pageParent.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 10
0
        //登録
        private void b_regist_Click(object sender, EventArgs e)
        {
            //if (!mod.chackMessage("登録"))
            //    return;

            //入力チェック
            chk.clear();
            chk.addControl(d_tenpo);
            chk.addControl(t_costume_code);
            chk.addControl(t_costume);
            chk.addControl(t_size);
            chk.addControl(d_seibetsu);
            chk.addControl(t_brand);
            chk.addControl(t_rank);
            chk.addControl(d_siyoukahi);
            chk.addControl(t_price1);
            chk.addControl(t_price2);
            chk.addControl(t_price3);
            chk.addControl(t_color);
            chk.addControl(t_age);
            chk.addControl(t_bunrui);
            chk.addControl(t_mitame);
            chk.addControl(t_gara);
            chk.addControl(d_status);
            chk.addControl(t_image_file1);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }

            //桁数チェック
            //衣装コード
            chk.clear();
            chk.addControl(t_costume_code);
            if (chk.check("W00001", chk.checkTextboxLength, 8))
            {
                 
                return;
            }

            //衣装名・ブランド名
            chk.clear();
            chk.addControl(t_costume);
            chk.addControl(t_brand);
            if (chk.check("W00001", chk.checkTextboxLength, 40))
            {
                 
                return;
            }

            //年齢
            chk.clear();
            chk.addControl(t_age);
            if (chk.check("W00001", chk.checkTextboxLength, 2))
            {
                return;
            }

            //価格・色・分類・柄・サイズ・ランク
            chk.clear();
            chk.addControl(t_size);
            chk.addControl(t_rank);
            chk.addControl(t_price1);
            chk.addControl(t_price2);
            chk.addControl(t_price3);
            chk.addControl(t_color);
            chk.addControl(t_bunrui);
            chk.addControl(t_gara);
            if (chk.check("W00001", chk.checkTextboxLength, 10))
            {
                return;
            }

            //見た目
            chk.clear();
            chk.addControl(t_mitame);
            if (chk.check("W00001", chk.checkTextboxLength, 20))
            {
                return;
            }

            //摘要・イメージファイル
            chk.clear();
            chk.addControl(t_tekiyou);
            chk.addControl(t_image_file1);
            chk.addControl(t_image_file2);
            chk.addControl(t_image_file3);
            chk.addControl(t_image_file4);
            if (chk.check("W00001", chk.checkTextboxLength, 255))
            {
                return;
            }

            //貸出店舗・お客様表示用
            chk.clear();
            chk.addControl(t_kashidashi_tenpo);
            chk.addControl(t_customer_display);
            if (chk.check("W00001", chk.checkTextboxLength, 30))
            {
                return;
            }

            //正規表現
            //価格
            chk.clear();
            chk.addControl(t_price1);
            chk.addControl(t_price2);
            chk.addControl(t_price3);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\d{1,10}?\z", @"0~9999999999"))
            {
                return;
            }

            //正規表現
            //年齢
            chk.clear();
            chk.addControl(t_age);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\d{1,3}?\z", @"0~999"))
            {
                return;
            }

            DB.m_costume cos = new m_costume();
            if (totalPage == currentPage - 1)
            {
                //新規登録
                cos.store_code       = DB.m_store.getSingleName(d_tenpo.SelectedItem.ToString()).store_code;
                cos.costume_code     = t_costume_code.Text;
                cos.costume_name     = t_costume.Text;
                cos.size             = t_size.Text;
                cos.sex              = d_seibetsu.SelectedIndex.ToString();
                cos.brand_name       = t_brand.Text;
                cos.rank             = t_rank.Text;
                cos.usability        = d_siyoukahi.SelectedIndex.ToString();
                cos.price1           = int.Parse(t_price1.Text);
                cos.price2           = int.Parse(t_price2.Text);
                cos.price3           = int.Parse(t_price3.Text);
                cos.color            = t_color.Text;
                cos.target_age       = int.Parse(t_age.Text);
                cos.remarks          = t_tekiyou.Text;
                cos.image1           = t_image_file1.Text;
                cos.image2           = t_image_file2.Text;
                cos.image3           = t_image_file3.Text;
                cos.image4           = t_image_file4.Text;
                cos.Class            = t_bunrui.Text;
                cos.appearance       = t_mitame.Text;
                cos.handle           = t_gara.Text;
                d_status.DataSource  = Enum.GetValues(typeof(Utile.Data.衣装ステータス));
                cos.status           = d_status.SelectedIndex.ToString();
                cos.rental_store     = t_kashidashi_tenpo.Text;
                cos.customer_display = t_customer_display.Text;
            }
            else
            {
                //更新
                cos = costumeDBList[currentPage - 1];
                cos.costume_name     = t_costume.Text;
                cos.size             = t_size.Text;
                cos.sex              = d_seibetsu.SelectedIndex.ToString();
                cos.brand_name       = t_brand.Text;
                cos.rank             = t_rank.Text;
                cos.usability        = d_siyoukahi.SelectedIndex.ToString();
                cos.price1           = int.Parse(t_price1.Text);
                cos.price2           = int.Parse(t_price2.Text);
                cos.price3           = int.Parse(t_price3.Text);
                cos.color            = t_color.Text;
                cos.target_age       = int.Parse(t_age.Text);
                cos.remarks          = t_tekiyou.Text;
                cos.image1           = t_image_file1.Text;
                cos.image2           = t_image_file2.Text;
                cos.image3           = t_image_file3.Text;
                cos.image4           = t_image_file4.Text;
                cos.Class            = t_bunrui.Text;
                cos.appearance       = t_mitame.Text;
                cos.handle           = t_gara.Text;
                d_status.DataSource  = Enum.GetValues(typeof(Utile.Data.衣装ステータス));
                cos.status           = d_status.SelectedIndex.ToString();
                cos.rental_store     = t_kashidashi_tenpo.Text;
                cos.customer_display = t_customer_display.Text;
            }

            cos.Command();

            this.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 11
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            chk.clear();

            //必須入力チェック(スタッフが選択時、他の項目がブランクの場合はエラー)
            // 必須チェック
            chk.addControl(co_store);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }

            for (var i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Cells["Staff"].Value == null  ||
                    dataGridView1.Rows[i].Cells["Staff"].Value.ToString() == "")
                {
                    break;
                }

                if (dataGridView1.Rows[i].Cells["StartTime"].Value == null ||
                    dataGridView1.Rows[i].Cells["EndTime"].Value == null ||
                    dataGridView1.Rows[i].Cells["WorkClass"].Value == null)
                {
                    dataGridView1.Rows[i].Selected = true;
                    Utile.Message.showMessageOK("E11005");
                    return;
                }
            }


            //フォーマットチェック(日付: HH: MM) HH:0~23MM:0~59
            for (var i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Cells["Staff"].Value == null ||
                    dataGridView1.Rows[i].Cells["Staff"].Value.ToString() == "")
                {
                    break;
                }

                if (!System.Text.RegularExpressions.Regex.IsMatch(
                        dataGridView1.Rows[i].Cells["StartTime"].Value.ToString(),
                        @"\A[0-2][0-9]:[0-5][0-9]\z"))
                {
                    dataGridView1.Rows[i].Selected = true;
                    var msg = Utile.Message.message["W00003"].Replace("@フォーマット",
                                                                      dataGridView1.Rows[i].Cells["StartTime"].Value.ToString());
                    Utile.Message.showMessageOK("W00003", msg);

                    return;
                }

                if (!System.Text.RegularExpressions.Regex.IsMatch(
                        dataGridView1.Rows[i].Cells["EndTime"].Value.ToString(),
                        @"\A[0-2][0-9]:[0-5][0-9]\z"))
                {
                    dataGridView1.Rows[i].Selected = true;
                    var msg = Utile.Message.message["W00003"].Replace("@フォーマット",
                                                                      dataGridView1.Rows[i].Cells["EndTime"].Value.ToString());
                    Utile.Message.showMessageOK("W00003", msg);
                    return;
                }
            }

            //開始時間 < 終了時間をチェック
            for (var i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Cells["Staff"].Value == null ||
                    dataGridView1.Rows[i].Cells["Staff"].Value.ToString() == "")
                {
                    break;
                }

                if (dataGridView1.Rows[i].Cells["WorkClass"].Value.ToString() == "2")
                {
                    break;
                }

                var StartTime = int.Parse(dataGridView1.Rows[i].Cells["StartTime"].Value.ToString().Substring(0, 2) +
                                          dataGridView1.Rows[i].Cells["StartTime"].Value.ToString().Substring(3, 2));
                var EndTime = int.Parse(dataGridView1.Rows[i].Cells["EndTime"].Value.ToString().Substring(0, 2) +
                                        dataGridView1.Rows[i].Cells["EndTime"].Value.ToString().Substring(3, 2));

                if (dataGridView1.Rows[i].Cells[1].Value == null)
                {
                    break;
                }

                if (StartTime > 2359)
                {
                    dataGridView1.Rows[i].Selected = true;
                    Utile.Message.showMessageOK("E11003");
                    return;
                }
                if (EndTime > 2359)
                {
                    dataGridView1.Rows[i].Selected = true;
                    Utile.Message.showMessageOK("E11003");
                    return;
                }


                if (StartTime >= EndTime)
                {
                    dataGridView1.Rows[i].Selected = true;
                    Utile.Message.showMessageOK("E11002");
                    return;
                }
            }
            //DB処理
            using (var dbc = new DB.DBConnect())
            {
                dbc.npg.Open();
                using (var transaction = dbc.npg.BeginTransaction())
                {
                    try
                    {
                        //削除処理
                        var staff_shift = dbc.m_staff_shift;
                        //var delete_data = dbc.m_staff_shift.Where(x => x.work_day == l_calenderdata && x.store_code==l_store).Select(x=>x.work_day);

                        var delete_data = from ss in dbc.m_staff_shift
                                          where ss.work_day == l_calenderdata & ss.store_code == l_store
                                          select ss;
                        foreach (var data in delete_data)
                        {
                            dbc.m_staff_shift.Remove(data);
                        }

                        dbc.SaveChanges();

                        //登録処理
                        for (var i = 0; i < dataGridView1.Rows.Count; i++)
                        {
                            if (dataGridView1.Rows[i].Cells["Staff"].Value == null ||
                                dataGridView1.Rows[i].Cells["Staff"].Value.ToString() == "")
                            {
                                break;
                            }

                            DB.m_staff_shift staff_Shift = new DB.m_staff_shift();

                            var l_staff_code  = dataGridView1.Rows[i].Cells["StaffCode"].Value.ToString();
                            var register_data = staff_shift.FirstOrDefault(x => x.work_day == l_calenderdata &&
                                                                           x.store_code == l_store &&
                                                                           x.staff_code == l_staff_code);
                            if (register_data == null)
                            {
                                staff_Shift.work_day           = l_calenderdata;
                                staff_Shift.store_code         = l_store;
                                staff_Shift.staff_code         = l_staff_code;
                                staff_Shift.start_time         = TimeSpan.Parse(dataGridView1.Rows[i].Cells["StartTime"].Value.ToString());
                                staff_Shift.end_time           = TimeSpan.Parse(dataGridView1.Rows[i].Cells["EndTime"].Value.ToString());
                                staff_Shift.registration_date  = DateTime.Now.Date;
                                staff_Shift.registration_staff = MainForm.session_m_staff.staff_name;
                                staff_Shift.update_date        = DateTime.Now.Date;
                                staff_Shift.work_class         = dataGridView1.Rows[i].Cells["WorkClass"].Value.ToString();
                                staff_Shift.update_staff       = MainForm.session_m_staff.staff_name;
                                staff_Shift.delete_flag        = "0";
                                dbc.m_staff_shift.Add(staff_Shift);
                                dbc.SaveChanges();
                            }
                            else
                            {
                                Utile.Message.showMessageOK("E11004");
                                transaction.Rollback();
                                return;
                            }
                        }

                        transaction.Commit();
                    }
                    catch (SqlCeException)
                    {
                        Utile.Message.showMessageOK("E11006");
                        transaction.Rollback();
                    }
                }
            }
            //ひとつ前の画面に戻る
            SelfViewing = false;
            pageParent.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 12
0
        private void b_regist_Click(object sender, EventArgs e)
        {
            //入力チェック
            chk.clear();
            chk.addControl(d_Shooting_purpose);
            chk.addControl(d_facility);
            //chk.addControl(t_name);
            //chk.addControl(t_name_kana);
            //chk.addControl(d_sex2);
            //chk.addControl(d_height);
            //chk.addControl(d_foot);
            //chk.addControl(d_sleeve);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }

            //桁数チェック
            //20
            chk.clear();
            chk.addControl(d_facility);
            chk.addControl(t_name);
            if (chk.check("W00001", chk.checkTextboxLength, 20))
            {
                return;
            }
            //40
            chk.clear();
            chk.addControl(t_name_kana);
            if (chk.check("W00001", chk.checkTextboxLength, 40))
            {
                return;
            }
            //4
            chk.clear();
            chk.addControl(d_height);
            chk.addControl(d_foot);
            chk.addControl(d_sleeve);
            if (chk.check("W00001", chk.checkTextboxLength, 4))
            {
                return;
            }
            //フォーマットチェック
            chk.clear();
            chk.addControl(d_height);
            chk.addControl(d_foot);
            chk.addControl(d_sleeve);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\d{1,4}?\z", @"半角数字"))
            {
                return;
            }

            for (int i = 0; d_renral_result.Rows.Count > i; i++)
            {
                if (costumeReservationList[i].costume_reservation_code == "")
                {
                    costumeReservationList[i].costume_reservation_code = DB.t_costume_reservation.getNewcostume_reservation_code();
                }

                costumeReservationList[i].memo = d_renral_result.Rows[i].Cells[11].Value == null ? "" : d_renral_result.Rows[i].Cells[11].Value.ToString();
                if (d_Cancellation_date.Checked)
                {
                    costumeReservationList[i].cancellation_date = d_Cancellation_date.Value;
                }
                else
                {
                    costumeReservationList[i].cancellation_date = null;
                }
                costumeReservationList[i].shooting_purpose = Enum.GetNames(typeof(Utile.Data.撮影目的)).ToList()[d_Shooting_purpose.SelectedIndex];
                costumeReservationList[i].facility         = d_facility.Text;
                costumeReservationList[i].name             = t_name.Text;
                costumeReservationList[i].name_kana        = t_name_kana.Text;
                if (d_sex2.SelectedIndex != -1)
                {
                    costumeReservationList[i].sex = d_sex2.SelectedIndex.ToString();
                }
                else
                {
                    costumeReservationList[i].sex = null;
                }
                if (dt_birthday.Checked)
                {
                    costumeReservationList[i].birthday = dt_birthday.Value;
                }
                else
                {
                    costumeReservationList[i].birthday = null;
                }
                if (d_height.Text != "")
                {
                    costumeReservationList[i].height = int.Parse(d_height.Text);
                }
                else
                {
                    costumeReservationList[i].height = null;
                }
                if (d_foot.Text != "")
                {
                    costumeReservationList[i].foot = int.Parse(d_foot.Text);
                }
                else
                {
                    costumeReservationList[i].foot = null;
                }
                if (d_sleeve.Text != "")
                {
                    costumeReservationList[i].sleeve = int.Parse(d_sleeve.Text);
                }
                else
                {
                    costumeReservationList[i].sleeve = null;
                }

                costumeReservationList[i].Command();

                var res = new DB.t_reservation();
                res.costume_reservation_code  = costumeReservationList[i].costume_reservation_code;
                res.reservation_code          = MainForm.session_t_reception.reception_code;
                res.facility_reservation_code = "        ";

                res.Command();
            }

            pageParent.PageRefresh();
            MainForm.backPage(this);
        }
Ejemplo n.º 13
0
        private void touroku_Click(object sender, EventArgs e)
        {
            //新規登録時の重複チェック
            if (mod.controlCloneList[t_Customer_code.Name].ToString() == "")
            {
                using (var dbc = new DB.DBConnect())
                {
                    //                    var q = from t in dbc.t_facility_reservation
                    //                            where t.facility_reservation_code.Trim() == t_Customer_code.Text
                    var q = from t in dbc.m_customer
                            where t.customer_code == t_Customer_code.Text
                            select t;
                    //登録済みコードかチェック
                    if (q.ToList().Count != 0)
                    {
                        if (Utile.Message.showMessageOKCancel("W09007") == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
            }

            //入力チェック
            chk.clear();
            // 必須チェック
            chk.addControl(t_Customer_code);
            chk.addControl(t_name);
            chk.addControl(t_name_kana);
            chk.addControl(da_Birthday);
            chk.addControl(t_Postal_code);
            chk.addControl(t_Pref_city_town_village_name);
            chk.addControl(t_Address2);
            chk.addControl(t_surname);
            chk.addControl(t_surname_kana);
            if (chk.check("W00000", chk.checkControlImportant))
            {
                return;
            }
            chk.clear();

            // フォーマットチェック
            //  電話番号
            chk.addControl(t_Phone_number1);
            chk.addControl(t_Phone_number2);
            chk.addControl(t_Phone_number3);
            chk.addControl(t_Fax);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\A0\d{1,4}-\d{1,4}-\d{4}\z", "000-0000-0000"))
            {
                return;
            }
            chk.clear();

            //  メールアドレス
            chk.addControl(t_mail);
            if (chk.check("W00003", chk.checkTextboxFormat, @"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
                          @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-0-9a-z]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$", "*****@*****.**"))
            {
                return;
            }
            chk.clear();

            //  郵便番号
            chk.addControl(t_Postal_code);
            if (chk.check("W00003", chk.checkTextboxFormat, @"\A\d\d\d-\d\d\d\d\z", "000-0000"))
            {
                return;
            }
            chk.clear();

            // 桁数チェック
            //  8
            chk.addControl(t_Customer_code);
            chk.addControl(t_Postal_code);
            if (chk.check("W00001", chk.checkTextboxLength, 8))
            {
                return;
            }
            chk.clear();
            //  10
            chk.addControl(t_name);
            chk.addControl(t_surname);
            if (chk.check("W00001", chk.checkTextboxLength, 10))
            {
                return;
            }
            chk.clear();
            //  13
            chk.addControl(t_Phone_number1);
            chk.addControl(t_Phone_number2);
            chk.addControl(t_Phone_number3);
            chk.addControl(t_Fax);
            if (chk.check("W00001", chk.checkTextboxLength, 13))
            {
                return;
            }
            chk.clear();
            //  20
            chk.addControl(t_name_kana);
            chk.addControl(t_surname_kana);
            if (chk.check("W00001", chk.checkTextboxLength, 20))
            {
                return;
            }
            chk.clear();
            //  60
            chk.addControl(t_Pref_city_town_village_name);
            chk.addControl(t_Address2);
            chk.addControl(t_Apartment_mansion);
            chk.addControl(t_Free_item1);
            chk.addControl(t_Free_item2);
            chk.addControl(t_Free_item3);
            if (chk.check("W00001", chk.checkTextboxLength, 60))
            {
                return;
            }
            chk.clear();
            //  255
            chk.addControl(t_mail);
            chk.addControl(t_Remark);
            if (chk.check("W00001", chk.checkTextboxLength, 225))
            {
                return;
            }
            chk.clear();


            //変数に挿入
            address1             = customer.address1 = t_Pref_city_town_village_name.Text;
            address2             = customer.address2 = t_Address2.Text;
            address3             = customer.address3 = t_Apartment_mansion.Text;
            birthday             = customer.birthday = da_Birthday.Value;
            customer_code        = customer.customer_code = t_Customer_code.Text;
            customer.dm_delivery = (ch_DM_Available.Checked ? (int)Utile.Data.DM送付区分.送付可 : (int)Utile.Data.DM送付区分.送付不可).ToString();
            customer.fax_number  = t_Fax.Text;
            customer.free_item1  = t_Free_item1.Text;
            customer.free_item2  = t_Free_item2.Text;
            customer.free_item3  = t_Free_item3.Text;
            mail_address         = customer.mail_address = t_mail.Text;
            name = customer.name = t_name.Text;
            customer.name_kana           = t_name_kana.Text;
            phone_number1                = customer.phone_number1 = t_Phone_number1.Text;
            phone_number2                = customer.phone_number2 = t_Phone_number2.Text;
            phone_number3                = customer.phone_number3 = t_Phone_number3.Text;
            postal_code                  = customer.postal_code = t_Postal_code.Text;
            customer.reasons             = co_Visit_motive.SelectedItem.ToString();
            customer.remarks             = t_Remark.Text;
            customer.sample_availability = (ch_Sample.Checked ? (int)Utile.Data.サンプル可否.送付可 : (int)Utile.Data.サンプル可否.送付不可).ToString();
            sex     = customer.sex = (co_Sex.SelectedIndex == (int)Utile.Data.性別.女 ? (int)Utile.Data.性別.女 : (int)Utile.Data.性別.男).ToString();
            surname = customer.surname = t_surname.Text;
            customer.surname_kana        = t_surname_kana.Text;
            customer.wedding_anniversary = da_Customer_wedding_anniversary.Value;

            if (da_Registration_date.Value != da_Registration_date.MinDate)
            {
                member = new DB.m_member();
                member.customer_code   = t_Customer_code.Text;
                member.date            = da_Registration_date.Value;
                member.membership_type = co_Membership_type.SelectedIndex.ToString();
                member.rank            = co_Rank.SelectedIndex.ToString();
                member.staff           = MainForm.session_m_staff.staff_name;
                member.store           = DB.m_store.getSingle(MainForm.session_m_staff.store_code).store_name;
            }

            foreach (var family in familyList)
            {
                family.Command(delete: true);
            }
            familyList.Clear();

            foreach (var family in dataGridView1.Rows.Cast <DataGridViewRow>())
            {
                if (family.Cells["続柄"].Value == null &&
                    family.Cells["姓"].Value == null &&
                    family.Cells["姓カナ"].Value == null &&
                    family.Cells["名"].Value == null &&
                    family.Cells["名カナ"].Value == null &&
                    family.Cells["誕生日"].Value == null &&
                    family.Cells["性別"].Value == null &&
                    family.Cells["備考"].Value == null)
                {
                    continue;
                }
                DB.m_family data = new DB.m_family();
                data.customer_code = t_Customer_code.Text;
                data.branch_number = family.Index;

                if (family.Cells["続柄"].Value != null)
                {
                    data.relationship = family.Cells["続柄"].Value.ToString();
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                if (family.Cells["姓"].Value != null)
                {
                    data.surname = family.Cells["姓"].Value.ToString();
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                if (family.Cells["姓カナ"].Value != null)
                {
                    data.surname_kana = family.Cells["姓カナ"].Value.ToString();
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                if (family.Cells["名"].Value != null)
                {
                    data.name = family.Cells["名"].Value.ToString();
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                if (family.Cells["名カナ"].Value != null)
                {
                    data.name_kana = family.Cells["名カナ"].Value.ToString();
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                DateTime tmp = DateTime.MinValue;
                if (family.Cells["誕生日"].Value != null)
                {
                    if (DateTime.TryParse(family.Cells["誕生日"].Value.ToString(), out tmp))
                    {
                        data.birthday = tmp;
                    }
                    else
                    {
                        Utile.Message.showMessageOK("I09004");
                        return;
                    }
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                if (family.Cells["性別"].Value != null)
                {
                    if (Utile.Data.性別.女.ToString() == family.Cells["性別"].Value.ToString() || Utile.Data.性別.男.ToString() == family.Cells["性別"].Value.ToString())
                    {
                        data.sex = (family.Cells["性別"].Value.ToString() == Utile.Data.性別.女.ToString() ? (int)Utile.Data.性別.女 : (int)Utile.Data.性別.男).ToString();
                    }
                    else
                    {
                        Utile.Message.showMessageOK("I09005");
                        return;
                    }
                }
                else
                {
                    Utile.Message.showMessageOK("I09003");
                    return;
                }
                if (family.Cells["備考"].Value != null)
                {
                    data.remarks = family.Cells["備考"].Value.ToString();
                }
                else
                {
                    data.remarks = null;
                }

                familyList.Add(data);
            }

            customer.Command();
            if (da_Registration_date.Value != da_Registration_date.MinDate)
            {
                member.Command();
            }
            foreach (var family in familyList)
            {
                family.Command();
            }

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

            Utile.Message.showMessageOK("I09001");
        }
Ejemplo n.º 14
0
        private void setImage(PictureBox pic, TextBox tex)
        {
            var storeName = d_tenpo.SelectedItem.ToString();
            var cosId     = t_costume_code.Text;
            var imgPath   = System.IO.Path.Combine(Costume_Image_Path, storeName, cosId, tex.Text);

            if (System.IO.File.Exists(imgPath))
            {
                try
                {
                    //ファイル表示およびサイズモード設定
                    pic.Image    = System.Drawing.Image.FromFile(imgPath);
                    pic.SizeMode = PictureBoxSizeMode.Zoom;
                }
                catch
                {
                    //画像の破損チェック
                    chk.clear();
                    chk.addControl(tex);
                    chk.check("I15003", chk.checkTextboxFile, null);
                    pic.Image = null;
                    return;
                    //  エラー表示無効なファイルと
                }
            }
            else
            {
                pic.Image = null;
            }
        }
Ejemplo n.º 15
0
        private void b_regist_Click(object sender, EventArgs e)
        {
            if (d_check.Checked)
            {
                // 必須チェック
                chk.clear();
                chk.addControl(d_start_time);
                chk.addControl(d_end_time);
                if (chk.check("W00000", chk.checkControlImportant))
                {
                    return;
                }
                chk.clear();

                //フォーマットチェック
                chk.addControl(d_start_time);
                chk.addControl(d_end_time);
                if (chk.check("W00003", chk.checkTextboxFormat, @"^([0-9]|[0-1][0-9]|[2][0-3]):[0-5][0-9]$", "00:00"))
                {
                    return;
                }
                chk.clear();

                //桁数チェック
                chk.addControl(d_start_time);
                chk.addControl(d_end_time);
                if (chk.check("W00001", chk.checkTextboxLength, 5))
                {
                    return;
                }
                chk.clear();
                chk.addControl(d_tekiyou);
                if (chk.check("W00001", chk.checkTextboxLength, 256))
                {
                    return;
                }
                chk.clear();

                //施設予約登録処理(スケジュール)
                if (facility_reservation.facility_reservation_code == null)
                {
                    facility_reservation.facility_reservation_code = DB.t_facility_reservation.getNewFacility_reservation_code();
                }
                facility_reservation.start_date           = d_start_date.Value;
                facility_reservation.start_time           = TimeSpan.Parse(d_start_time.Text);
                facility_reservation.end_date             = d_end_date.Value;
                facility_reservation.end_time             = TimeSpan.Parse(d_end_time.Text);
                facility_reservation.reservator           = null;
                facility_reservation.remarks              = d_tekiyou.Text;
                facility_reservation.cancellation_date    = null;
                facility_reservation.shooting_purpose     = null;
                facility_reservation.photographer         = null;
                facility_reservation.task_class           = null;
                facility_reservation.selection_start_date = null;
                facility_reservation.selection_start_time = null;
                facility_reservation.selection_end_date   = null;
                facility_reservation.selection_end_time   = null;
                facility_reservation.selector             = null;
                facility_reservation.store_code           = DB.m_store.getSingleName(d_tenpomei.SelectedItem.ToString()).store_code;
                facility_reservation.facility_code        = MainForm.Reservation_timetable.scheduleLabel;
                facility_reservation.order_code           = null; //DOTO:特に入力するものが無いため取りあえずNULLを入れる
                //重複チェック
                using (var dbc = new DB.DBConnect())
                {
                    var frStart = new DateTime(facility_reservation.start_date.Year, facility_reservation.start_date.Month, facility_reservation.start_date.Day,
                                               facility_reservation.start_time.Hours, facility_reservation.start_time.Minutes, 0);
                    var frEnd = new DateTime(facility_reservation.end_date.Year, facility_reservation.end_date.Month, facility_reservation.end_date.Day,
                                             facility_reservation.end_time.Hours, facility_reservation.end_time.Minutes, 0);

                    var q = from t in dbc.t_facility_reservation
                            select t;
                    foreach (var data in q)
                    {
                        var dStart = new DateTime(data.start_date.Year, data.start_date.Month, data.start_date.Day, data.start_time.Hours, data.start_time.Minutes, 0);
                        var dEnd   = new DateTime(data.end_date.Year, data.end_date.Month, data.end_date.Day, data.end_time.Hours, data.end_time.Minutes, 0);
                        if (data.facility_code == facility_reservation.facility_code &&
                            data.store_code == facility_reservation.store_code &&
                            !(dEnd <= frStart || dStart >= frEnd))
                        {
                            Utile.Message.showMessageOK("I03009");
                            return;
                        }
                    }
                }
                facility_reservation.Command();

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

                Utile.Message.showMessageOK("I03003");
            }
            else
            {
                // 必須チェック
                chk.clear();
                chk.addControl(d_tenpomei);
                chk.addControl(d_shisetumei);
                chk.addControl(d_satueisya);
                chk.addControl(d_select_name);
                chk.addControl(d_tasukukubun);
                chk.addControl(d_satsueimokuteki);
                chk.addControl(d_start_time);
                chk.addControl(d_end_time);
                chk.addControl(d_yoyakusya);
                if (chk.check("W00000", chk.checkControlImportant))
                {
                    return;
                }
                chk.clear();

                //フォーマットチェック
                chk.addControl(d_start_time);
                chk.addControl(d_end_time);
                if (d_select_start_time.Text != "")
                {
                    chk.addControl(d_select_start_time);
                }
                if (d_select_end_time.Text != "")
                {
                    chk.addControl(d_select_end_time);
                }
                if (chk.check("W00003", chk.checkTextboxFormat, @"^([0-9]|[0-1][0-9]|[2][0-3]):[0-5][0-9]$", "00:00"))
                {
                    return;
                }
                chk.clear();

                //桁数チェック
                chk.addControl(d_start_time);
                chk.addControl(d_end_time);
                if (d_select_start_time.Text != "")
                {
                    chk.addControl(d_select_start_time);
                }
                if (d_select_end_time.Text != "")
                {
                    chk.addControl(d_select_end_time);
                }
                if (chk.check("W00001", chk.checkTextboxLength, 5))
                {
                    return;
                }
                chk.clear();
                chk.addControl(d_yoyakusya);
                if (chk.check("W00001", chk.checkTextboxLength, 20))
                {
                    return;
                }
                chk.clear();
                chk.addControl(d_tekiyou);
                if (chk.check("W00001", chk.checkTextboxLength, 256))
                {
                    return;
                }
                chk.clear();

                //施設予約登録処理
                if (facility_reservation.facility_reservation_code == null)
                {
                    facility_reservation.facility_reservation_code = DB.t_facility_reservation.getNewFacility_reservation_code();
                }
                facility_reservation.start_date = d_start_date.Value;
                facility_reservation.start_time = TimeSpan.Parse(d_start_time.Text);
                facility_reservation.end_date   = d_end_date.Value;
                facility_reservation.end_time   = TimeSpan.Parse(d_end_time.Text);
                facility_reservation.reservator = d_yoyakusya.Text;
                facility_reservation.remarks    = d_tekiyou.Text;
                if (d_tyushi.Checked)
                {
                    facility_reservation.cancellation_date = d_tyushi.Value;
                }
                else
                {
                    facility_reservation.cancellation_date = null;
                }
                facility_reservation.shooting_purpose = ((Utile.Data.撮影目的)(d_satsueimokuteki.SelectedIndex)).ToString();
                facility_reservation.photographer     = d_satueisya.Text;
                facility_reservation.task_class       = DB.m_task.getSingleName(d_tasukukubun.SelectedItem.ToString()).task_class;
                if (d_select_start_time.Text == "")
                {
                    facility_reservation.selection_start_date = null;
                    facility_reservation.selection_start_time = null;
                }
                else
                {
                    facility_reservation.selection_start_date = d_select_start_date.Value;
                    facility_reservation.selection_start_time = TimeSpan.Parse(d_select_start_time.Text);
                }
                if (d_select_end_time.Text == "")
                {
                    facility_reservation.selection_end_date = null;
                    facility_reservation.selection_end_time = null;
                }
                else
                {
                    facility_reservation.selection_end_date = d_select_end_date.Value;
                    facility_reservation.selection_end_time = TimeSpan.Parse(d_select_end_time.Text);
                }
                facility_reservation.selector      = d_select_name.SelectedItem.ToString();
                facility_reservation.store_code    = DB.m_store.getSingleName(d_tenpomei.SelectedItem.ToString()).store_code;
                facility_reservation.facility_code = DB.m_facility.getSingleName(facility_reservation.store_code, d_shisetumei.SelectedItem.ToString()).facility_code;
                facility_reservation.order_code    = null; //DOTO:特に入力するものが無いため取りあえずNULLを入れる

                //重複チェック
                using (var dbc = new DB.DBConnect())
                {
                    var frStart = new DateTime(facility_reservation.start_date.Year, facility_reservation.start_date.Month, facility_reservation.start_date.Day,
                                               facility_reservation.start_time.Hours, facility_reservation.start_time.Minutes, 0);
                    var frEnd = new DateTime(facility_reservation.end_date.Year, facility_reservation.end_date.Month, facility_reservation.end_date.Day,
                                             facility_reservation.end_time.Hours, facility_reservation.end_time.Minutes, 0);

                    var q = from t in dbc.t_facility_reservation
                            select t;
                    foreach (var data in q)
                    {
                        var dStart = new DateTime(data.start_date.Year, data.start_date.Month, data.start_date.Day, data.start_time.Hours, data.start_time.Minutes, 0);
                        var dEnd   = new DateTime(data.end_date.Year, data.end_date.Month, data.end_date.Day, data.end_time.Hours, data.end_time.Minutes, 0);
                        if (data.facility_code == facility_reservation.facility_code &&
                            data.store_code == facility_reservation.store_code &&
                            !(dEnd <= frStart || dStart >= frEnd))
                        {
                            Utile.Message.showMessageOK("I03009");
                            return;
                        }
                    }
                }
                facility_reservation.Command();



                //予約登録処理
                DB.t_reservation reservation = new DB.t_reservation();
                reservation.reservation_code          = MainForm.session_t_reception.reception_code;
                reservation.facility_reservation_code = facility_reservation.facility_reservation_code;
                reservation.costume_reservation_code  = "        ";
                reservation.Command();

                //撮影データ登録処理
                DB.t_shooting_data shooting_data = DB.t_shooting_data.getSingle(MainForm.session_t_reception.customer_code,
                                                                                d_start_date.Value,
                                                                                MainForm.session_t_reception.reception_code);
                if (shooting_data == null)
                {
                    shooting_data = new DB.t_shooting_data();
                    int    index  = 1;
                    string folder = null;
                    while (true)
                    {
                        folder = d_start_date.Value.ToString("yyyyMMdd") + "-" + index.ToString() + "-" + DB.m_customer.getSingle(MainForm.session_t_reception.customer_code).surname;
                        if (DB.t_shooting_data.chkFolder(folder))
                        {
                            break;
                        }
                        index++;
                    }
                    shooting_data.customer_code  = MainForm.session_t_reception.customer_code;
                    shooting_data.shooting_date  = d_start_date.Value;
                    shooting_data.folder         = folder;
                    shooting_data.select_class   = "2";
                    shooting_data.images         = 0;
                    shooting_data.reception_code = MainForm.session_t_reception.reception_code;
                    shooting_data.Command();

                    // フォルダ作成
                    var photo_root              = System.Configuration.ConfigurationManager.AppSettings["photo_root"];
                    var Photographer_Select     = System.Configuration.ConfigurationManager.AppSettings["Photographer_Select"];
                    var Photographer_Select_dir = System.IO.Path.Combine(photo_root, Photographer_Select);

                    var folderPath = System.IO.Path.Combine(Photographer_Select_dir, folder);
                    folderPath = System.IO.Path.GetFullPath(folderPath);
                    if (System.IO.Directory.Exists(folderPath))
                    {
                        Utile.Message.showMessageOK("I03008");
                    }
                    else
                    {
                        System.IO.Directory.CreateDirectory(folderPath);
                    }
                }

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

                Utile.Message.showMessageOK("I03001");
            }

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