Ejemplo n.º 1
0
        private void Delete()
        {
            try
            {
                FormHelpers.CursorWait(true);
                var msg = "Deleting";

                if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
                {
                    var yearused = UserSettings.LogInYear;
                    var partno   = mgridListAssy.Rows[mgridListAssy.SelectedCells[0].RowIndex].Cells["colPartNoAssy"].Value.ToString();

                    assy = assybal.GetByID(Convert.ToInt32(yearused), partno.ToString());;
                    if (assybal.Delete(assy))
                    {
                        MessageHelpers.ShowInfo(msg + " Successful!");
                        RefreshGrid();
                        PageManager(1);
                    }
                    else
                    {
                        MessageHelpers.ShowWarning(msg + " Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
Ejemplo n.º 2
0
 private void AssignRecord(Boolean IsSave)
 {
     try
     {
         if (IsSave)
         {
             tbl_000_H_ASSY existassy = new tbl_000_H_ASSY();
             existassy = assybal.GetAll().Where(w => w.YEARUSED == UserSettings.LogInYear && w.PartNo == mtxtPartNo.Text).FirstOrDefault();
             if (existassy == null)
             {
                 assy.CreatedDate = DateTime.Now;
                 assy.CreatedBy   = UserSettings.Username;
                 assy.IsCopied    = false;
                 assy.CopyDate    = DateTime.Now;
                 assy.IsImported  = false;
                 assy.ImportDate  = DateTime.Now;
                 assy.ImportBy    = UserSettings.Username;
             }
             assy.YEARUSED    = UserSettings.LogInYear;
             assy.PartNo      = mtxtPartNo.Text;
             assy.PartName    = mtxtPartName.Text;
             assy.HC          = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtHC.Text, 0));
             assy.Qty         = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtQty.Text, 0));
             assy.RATEPERHOUR = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtRatePerHour.Text, 0));
             assy.IsLocked    = mcbLocked.Checked;
             assy.UpdatedDate = DateTime.Now;
             assy.UpdatedBy   = UserSettings.Username;
         }
         else
         {
             assy = assybal.GetByID(yearused, partno);
             if (assy != null)
             {
                 mtxtPartNo.Text      = assy.PartNo;
                 mtxtPartName.Text    = assy.PartName;
                 mtxtHC.Text          = ((double)assy.HC).ToString();
                 mtxtQty.Text         = ((double)assy.Qty).ToString();
                 mtxtRatePerHour.Text = assy.RATEPERHOUR.ToString();
                 mcbLocked.Checked    = assy.IsLocked;
                 assy.UpdatedDate     = DateTime.Now;
                 assy.UpdatedBy       = UserSettings.Username;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }