コード例 #1
0
 private void Import()
 {
     try
     {
         FormHelpers.CursorWait(true);
         GetExclData(mtxtFilePath.Text);
         var chk_itm = itmbal.GetByID(UserSettings.LogInYear, dttemp.Rows[0][1].ToString());
         if (!mcbOverWrite.Checked)
         {
             msg = "This process will import components to the current logged in year. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (chk_itm == null)
                 {
                     if (itmbal.Save(ItemToSave()))
                     {
                         tmpcombal.DistributeCompo(UserSettings.LogInYear, dttemp.Rows[0][1].ToString(), UserSettings.Username);
                         MessageHelpers.ShowInfo(msgval_success);
                         this.Close();
                     }
                 }
                 else
                 {
                     MessageHelpers.ShowInfo(msgval_nochanges);
                     this.Close();
                 }
             }
         }
         else
         {
             msg = "This process will remove the existing components and replace it. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (chk_itm != null)
                 {
                     if (itmbal.Delete(chk_itm))
                     {
                         DeleteSub(chk_itm.ItemNo);
                     }
                 }
                 if (itmbal.Save(ItemToSave()))
                 {
                     tmpcombal.DistributeCompo(UserSettings.LogInYear, dttemp.Rows[0][1].ToString(), UserSettings.Username);
                     MessageHelpers.ShowInfo(msgval_success);
                     this.Close();
                 }
             }
         }
         MyCaller_itm.RefreshGrid();
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #2
0
 public void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var    ino    = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colItemNo"].Value.ToString();
         string itemno = ino;
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var DeletingisSuccess = false;
             var msg = "Deleting";
             item = itembal.GetByID(yused, itemno);
             if (itembal.Delete(item))
             {
                 DeleteSub(itemno);
                 DeletingisSuccess = true;
             }
             if (DeletingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }