コード例 #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   = mgridListVP.Rows[mgridListVP.SelectedCells[0].RowIndex].Cells["colPartNoVP"].Value.ToString();

                    vp = vpbal.GetByID(Convert.ToInt32(yearused), partno.ToString());;
                    if (vpbal.Delete(vp))
                    {
                        MessageHelpers.ShowInfo(msg + " Successful!");
                        RefreshGrid();
                        PageManager(1);
                    }
                    else
                    {
                        MessageHelpers.ShowWarning(msg + " Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
コード例 #2
0
 private void SaveRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         if (IsValid())
         {
             AssignRecord(true);
             if (compbal.Update(comp))
             {
                 MessageHelpers.ShowInfo("Update Successful!");
                 MyState = FormState.View;
                 Init_Form();
             }
             else
             {
                 MessageHelpers.ShowWarning("Update Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #3
0
 private Boolean IsValid()
 {
     try
     {
         var blnIsvalid = err.CheckAndShowSummaryErrorMessage();
         if (!mtxtPassword.Text.Equals(mtxtConfirmPassword.Text))
         {
             throw new Exception("Password does not match!");
         }
         if (mtxtUsername.Text.Length < MaxUsernameLenght)
         {
             throw new Exception("Username must be greater than " + MaxUsernameLenght.ToString() + " characters!");
         }
         if (mtxtPassword.Text.Length < MaxPasswordLength)
         {
             throw new Exception("Password must be greater than " + MaxPasswordLength.ToString() + " characters!");
         }
         return(blnIsvalid);
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowWarning(ex.Message);
         return(false);
     }
 }
コード例 #4
0
        private void SaveRecord()
        {
            try
            {
                FormHelpers.CursorWait(true);
                if (IsValid())
                {
                    var isSuccess = false;
                    var msg       = "";
                    AssignRecord(true);
                    switch (MyState)
                    {
                    case FormState.Add:
                        msg        = "Saving";
                        usr.UserID = Guid.NewGuid().ToString();
                        if (userbal.Save(usr))
                        {
                            isSuccess = true;
                        }
                        break;

                    case FormState.Edit:
                        msg = "Updating";
                        if (userbal.Update(usr))
                        {
                            isSuccess = true;
                        }
                        break;

                    case FormState.Delete:
                        msg = "Deleting";
                        if (userbal.Delete(usr))
                        {
                            isSuccess = true;
                        }
                        break;
                    }
                    if (isSuccess)
                    {
                        MessageHelpers.ShowInfo(msg + " Successful!");
                        MyCaller.RefreshGrid();
                        this.Close();
                    }
                    else
                    {
                        MessageHelpers.ShowWarning(msg + " Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
コード例 #5
0
 private Boolean IsValid()
 {
     try
     {
         return(err.CheckAndShowSummaryErrorMessage());
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowWarning(ex.Message);
         return(false);
     }
 }
コード例 #6
0
 private void SaveRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         mgridRights.CommitEdit(DataGridViewDataErrorContexts.Commit);
         if (IsValid())
         {
             var strmsg = "";
             var blnsuccess = false;
             AssignRecord(true);
             if (MyState == FormState.Add)
             {
                 strmsg = "Saving Failed!";
                 if (usrgrpbal.Save(usrgrp))
                 {
                     strmsg = "Saving Successful!";
                     blnsuccess = true;
                 }                 
             }
             if (MyState == FormState.Edit)
             {
                 strmsg = "Updating Failed!";
                 if (usrgrpbal.Update(usrgrp))
                 {
                     strmsg = "Updating Successful!";
                     blnsuccess = true;
                 }                        
             }                    
             if (blnsuccess)
             {
                 MessageHelpers.ShowInfo(strmsg);
                 MyCaller.RefreshGrid();
                 MyCaller.Focus();
                 this.Close();
             }
             else
             {
                 MessageHelpers.ShowWarning(strmsg);
             }
             
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #7
0
        private void SaveRecord()
        {
            try
            {
                FormHelpers.CursorWait(true);
                if (IsValid())
                {
                    var isSuccess = false;
                    var msg       = "";
                    AssignRecord(true);
                    switch (MyState)
                    {
                    case FormState.Add:
                        msg = "Saving";
                        if (pibal.Save(pi))
                        {
                            isSuccess = true;
                        }
                        break;

                    case FormState.Edit:
                        msg = "Updating";
                        if (pibal.Update(pi))
                        {
                            isSuccess = true;
                        }
                        break;
                    }
                    if (isSuccess)
                    {
                        MessageHelpers.ShowInfo(msg + " Successful!");
                        MyCaller.Init_Form();
                        this.Close();
                    }
                    else
                    {
                        MessageHelpers.ShowWarning(msg + " Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
コード例 #8
0
        public void DeleteRecord()
        {
            var fxsptype    = "";
            var fxspeffdate = "";

            try
            {
                if (mgridList1.SelectedRows != null)
                {
                    fxsptype    = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colRecType1"].Value.ToString();
                    fxspeffdate = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colEffectiveDate1"].Value.ToString();
                }
            }
            catch
            {
                if (mgridList2.SelectedRows != null)
                {
                    fxsptype    = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colRecType2"].Value.ToString();
                    fxspeffdate = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colEffectiveDate2"].Value.ToString();
                }
            }
            string rectype       = fxsptype;
            string effectivedate = fxspeffdate;

            if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
            {
                var isSuccess = false;
                var msg       = "Deleting";
                fxsp = FXSPbal.GetByID(rectype, Convert.ToDateTime(effectivedate));
                if (FXSPbal.Delete(fxsp))
                {
                    isSuccess = true;
                }
                if (isSuccess)
                {
                    MessageHelpers.ShowInfo(msg + " Successful!");
                    RefreshGrid();
                }
                else
                {
                    MessageHelpers.ShowWarning(msg + " Failed!");
                }
            }
        }
コード例 #9
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     try
     {
         FormHelpers.CursorWait(true);
         if (mgMenuList.Rows.Count > 0)
         {
             var lst = new List <tbl_000_USERGROUP_MENUS>();
             foreach (DataGridViewRow drow in mgMenuList.Rows)
             {
                 Boolean blnSelected = (Boolean)drow.Cells["colCheckBox"].Value;
                 if (blnSelected == true)
                 {
                     lst.Add(new tbl_000_USERGROUP_MENUS()
                     {
                         MenuID = (int)drow.Cells["colMenuID"].Value, MenuName = drow.Cells["colMenuName"].Value.ToString(),
                         CanAdd = true, CanEdit = true, CanView = true, CanDelete = true, CanPreview = true, CanPrint = true
                     });
                 }
             }
             if (lst.Count > 0)
             {
                 UserGroupCaller.AddRights(lst);
                 this.Close();
             }
             else
             {
                 MessageHelpers.ShowWarning("Please select at least 1 record!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #10
0
 public void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var    year     = UserSettings.LogInYear;
         int    yearused = year;
         var    no       = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colPartNo"].Value.ToString();
         string partno   = no;
         if (MessageHelpers.ShowQuestion("Are you sure want to delete record?") == DialogResult.Yes)
         {
             var isSuccess = false;
             var msg       = "Deleting";
             com = combal.GetByID(yearused, partno);
             if (combal.Delete(com))
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #11
0
 public void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var categorycode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colCATCODE"].Value.ToString();
         var cyearused    = UserSettings.LogInYear;
         int yearused     = Convert.ToInt32(cyearused);
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var isSuccess = false;
             var msg       = "Deleting";
             cat = Categorybal.GetByID(categorycode, yearused);
             if (Categorybal.Delete(cat))
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #12
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);
     }
 }
コード例 #13
0
 private void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var ino = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colItemNo"].Value.ToString();
         var pno = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colPartNo"].Value.ToString();
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var isSuccess = false;
             var msg       = "Deleting";
             wip = wipbal.GetByID(UserSettings.LogInYear, ino, pno);
             if (wipbal.Delete(wip))
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
コード例 #14
0
 private void SaveRecord()
 {
     try
     {
         if (IsValid())
         {
             AssignRecord();
             if (yearbal.Save(year))
             {
                 MessageHelpers.ShowInfo("Saving Successful!");
                 MyCaller.RefreshGrid();
                 this.Close();
             }
             else
             {
                 MessageHelpers.ShowWarning("Saving Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
コード例 #15
0
 public void DeleteRecord()
 {
     try
     {
         var    sectioncode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colMODRCCode"].Value.ToString();
         string scode       = sectioncode;
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var DeletingisSuccess = false;
             var msg = "Deleting";
             modrc = mrbal.GetByID(sectioncode);
             if (mrbal.Delete(modrc))
             {
                 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);
     }
 }
コード例 #16
0
 public void RemoveYear()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var recyear = mgridYearList.SelectedRows[0].Cells["colYear"].Value.ToString();
         if (MessageHelpers.ShowQuestion("Are you sure you want to remove this year?") == DialogResult.Yes)
         {
             var RemovingisSuccess = false;
             var msg = "Removing";
             fxsp = yearbal.CheckFXSPYear(Convert.ToInt32(recyear));
             cat  = yearbal.CheckCatYear(Convert.ToInt32(recyear));
             if (yearbal.Remove(Convert.ToInt32(recyear)))
             {
                 RemovingisSuccess = true;
             }
             if (RemovingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }