Esempio n. 1
0
 private void RightBannerForm_Load(object sender, EventArgs e)
 {
     SetEditColumnIntoDataGrid();                        // Insert Edeit column into datagridview
     dataGridRightBanner.AutoGenerateColumns = true;     // create gridview as auto generate columns.
     RightBannerController.GetData(dataGridRightBanner); // call data industrial into grid.
     dataGridRightBanner.SelectedRows[0].Selected = true;
     dataGridRightBanner.AutoResizeColumns();            //Auto resize columns
 }
Esempio n. 2
0
        private void dataGridRightBanner_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            selectRightbanner = new RightBannerModel();

            setRightModelModel(dataGridRightBanner.SelectedRows[0]);
            if (e.ColumnIndex == 0 && e.RowIndex >= 0)
            {
                RightBannerController.CallAddEditForm(new AddRightBanner(selectRightbanner)); // call form as edit data form.
                ReloadDataGridView();                                                         // Reload data in datagridview
            }
        }
Esempio n. 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (model == null)                                               // add Industrial mode
     {
         model              = new models.RightBannerModel();          //new model to assign data
         model.adsMember    = comboCusAdd.SelectedValue.ToString();   // set province id
         model.cateId       = comboCategory.SelectedValue.ToString(); //set english name
         model.ProfileEn    = txtProfileEng.Text.Trim();              // set thai name
         model.ProfileTh    = txtProfileThai.Text.Trim();             // set japan name
         model.ProfileJp    = txtProfileJP.Text.Trim();               // set search name
         model.CompanyEn    = txtCompanyEng.Text.Trim();              // set province id
         model.CompanyTh    = txtCompanyThai.Text.Trim();             //set english name
         model.CompanyJp    = txtCompanyJP.Text.Trim();               // set thai name
         model.ContactEn    = txtConEng.Text.Trim();                  // set japan name
         model.ContactTh    = txtConThai.Text.Trim();                 // set search name
         model.ContactJp    = txtConJapan.Text.Trim();                // set japan name
         model.Uri          = txtURL.Text.Trim();                     // set search name
         model.ActiveDate   = dateActiveDAte.Text.Trim();             // set japan name
         model.InActiveDate = dateInactiveDate.Text.Trim();           // set search name
         RightBannerController.InsertData(model);                     // call update method
     }
     else // update (edit) Industrial mode
     {
         model              = new models.RightBannerModel();          //new model to assign data
         model.adsMember    = comboCusAdd.SelectedValue.ToString();   // set province id
         model.cateId       = comboCategory.SelectedValue.ToString(); //set english name
         model.ProfileEn    = txtProfileEng.Text.Trim();              // set thai name
         model.ProfileTh    = txtProfileThai.Text.Trim();             // set japan name
         model.ProfileJp    = txtProfileJP.Text.Trim();               // set search name
         model.CompanyEn    = txtCompanyEng.Text.Trim();              // set province id
         model.CompanyTh    = txtCompanyThai.Text.Trim();             //set english name
         model.CompanyJp    = txtCompanyJP.Text.Trim();               // set thai name
         model.ContactEn    = txtConEng.Text.Trim();                  // set japan name
         model.ContactTh    = txtConThai.Text.Trim();                 // set search name
         model.ContactJp    = txtConJapan.Text.Trim();                // set japan name
         model.Uri          = txtURL.Text.Trim();                     // set search name
         model.ActiveDate   = dateActiveDAte.Text.Trim();             // set japan name
         model.InActiveDate = dateInactiveDate.Text.Trim();           // set search name
         RightBannerController.UpdateData(model);
     }
 }
Esempio n. 4
0
        private void AddRightBanner_Load(object sender, EventArgs e)
        {
            RightBannerController.SetCustomerBox(comboCusAdd);   //set province data into combobox
            RightBannerController.SetcomboCategoryBox(comboCategory);

            if (model != null) //check model has data?
            {
                /* set Model into data */
                comboCusAdd.SelectedValue   = model.adsMember; //set selected value province.
                comboCategory.SelectedValue = model.cateId;    //set name english.
                txtProfileEng.Text          = model.ProfileEn; //set name thai.
                txtProfileThai.Text         = model.ProfileTh; //set name japan.
                txtProfileJP.Text           = model.ProfileJp; //set search name.
                txtCompanyEng.Text          = model.CompanyEn; //set name thai.
                txtCompanyThai.Text         = model.CompanyTh; //set name japan.
                txtCompanyJP.Text           = model.CompanyJp; //set search name.
                txtConEng.Text        = model.ContactEn;       //set name thai.
                txtConThai.Text       = model.ContactTh;       //set name japan.
                txtConJapan.Text      = model.ContactJp;       //set search name.
                txtURL.Text           = model.Uri;             //set name thai.
                dateActiveDAte.Text   = model.ActiveDate;      //set name japan.
                dateInactiveDate.Text = model.InActiveDate;    //set search name
            }
        }
Esempio n. 5
0
 // Reload data When Add/Edit form was closed
 public void ReloadDataGridView()
 {
     RightBannerController.GetData(dataGridRightBanner); // call data industrial into grid.
 }
Esempio n. 6
0
 private void btnAddForm_Click(object sender, EventArgs e)
 {
     RightBannerController.CallAddEditForm(new AddRightBanner()); // call form as add data form.
     ReloadDataGridView();                                        // Reload data in datagridview
 }