Exemplo n.º 1
0
 private void mbtnChange_Click(object sender, EventArgs e)
 {
     try
     {
         FormHelpers.CursorWait(true);
         ChangePass();
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 2
0
 private void CopyItem()
 {
     try
     {
         FormHelpers.CursorWait(true);
         if (!mcbOverWrite.Checked)
         {
             msg = "This process will copy previous items from the selected year to the current logged in year. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (metroRadioButton2.Checked)
                 {
                     CopyByItem(false);
                 }
                 else
                 {
                     CopyByYear(false);
                 }
                 this.Close();
             }
         }
         else
         {
             msg = "This process will remove the existing items and replace it. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (metroRadioButton2.Checked)
                 {
                     CopyByItem(true);
                 }
                 else
                 {
                     CopyByYear(true);
                 }
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 3
0
        private void GetComponents()
        {
            try
            {
                FormHelpers.CursorWait(true);
                var itemno    = BPSUtilitiesV1.NZ(mtxtItemNo.Text, "").ToString();
                var partscode = BPSUtilitiesV1.NZ(mtxtPartCode.Text, "").ToString();
                ListHelper.FillMetroCombo(mcboCatCode, catbal.GetAll().Select(i => new { i.CATCODE, i.CATDESC }).
                                          Where(w => w.CATCODE == "BULK").Distinct().ToList(), "CATCODE", "CATCODE");
                var catcode = BPSUtilitiesV1.NZ(mcboCatCode.SelectedValue, "").ToString();
                item = itembal.GetWithCat(UserSettings.LogInYear, itemno, catcode);

                GetRefCompDetails();
                if (item != null && item.itemCom.Count > 0)
                {
                    if (partscode != "")
                    {
                        itemcom = item.itemCom.Where(w => w.PartNo == partscode).OrderBy(o => o.ItemAddress).FirstOrDefault();
                        if (itemcom != null)
                        {
                            var sourceTable = item.itemCom.Where(w => w.ItemAddress.StartsWith(itemcom.ItemAddress) && w.ItemAddress != itemcom.ItemAddress).ToList();
                            using (var reader = ObjectReader.Create(sourceTable,
                                                                    "DocID",
                                                                    "MatCode",
                                                                    "MatDescription",
                                                                    "ItemUsage",
                                                                    "UnitPrice",
                                                                    "Amount",
                                                                    "Address"))
                            {
                                dt.Load(reader);
                                mgridMatList.DataSource = dt;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
Exemplo n.º 4
0
 public void CloseAllChildForm()
 {
     try
     {
         foreach (var frm in this.MdiChildren)
         {
             if (!frm.Name.ToLower().Equals("frmMenus"))
             {
                 frm.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
Exemplo n.º 5
0
 private void Init_Form()
 {
     try
     {
         var strheader = "User Group";
         switch (MyState)
         {
             case FormState.Add:
                 usrgrp.GroupID = Guid.NewGuid().ToString();
                 LockFields(false);
                 strheader += " - New";
                 break;
             case FormState.Edit:
             case FormState.View:
             case FormState.Delete:
                 AssignRecord(false);
                 LockFields(false);
                 if (MyState == FormState.View)
                 {
                     LockFields(true);
                     mbtnSave.BackgroundImage = PWCOSTINGV1.Properties.Resources.editicon;
                     strheader += " - View";
                     mbtnSave.Focus();
                 }
                 else if (MyState == FormState.Delete)
                 {
                     LockFields(true);
                     mbtnSave.Text = "Delete";
                     strheader += " - Delete";
                     mbtnSave.Focus();
                 }
                 else
                 {
                     mtxtGroupCode.ReadOnly = true;
                     mbtnSave.BackgroundImage = PWCOSTINGV1.Properties.Resources.saveicon1;
                     strheader += " - Edit";
                 }
                 break;
         }
         this.Text = strheader;
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
Exemplo n.º 6
0
        private void mbtnOk_Click(object sender, EventArgs e)
        {
            try
            {
                FormHelpers.CursorWait(true);
                if (IsValid())
                {
                    var _user = userbal.LogMeIn(mtxtUsername.Text, mtxtPassword.Text);
                    if (_user != null)
                    {
                        //Get the computer name and ip
                        System.Net.IPHostEntry host;
                        UserSettings.ComputerName = System.Net.Dns.GetHostName();
                        host = System.Net.Dns.GetHostEntry(UserSettings.ComputerName);
                        if (host.AddressList.Count() > 0)
                        {
                            UserSettings.ComputerIP = System.Net.Dns.GetHostByName(UserSettings.ComputerName).AddressList[0].ToString();
                        }
                        //end here

                        AssignPrevLoginnedYear(true);
                        AssignPrevLoginnedUser(true);
                        PWCOSTINGV1.Properties.Settings.Default.Save();

                        UserSettings.Username        = _user.Username;
                        UserSettings.CurrentUser     = _user;
                        UserSettings.LogInYear       = int.Parse(mcboLogYear.SelectedValue.ToString());
                        UserSettings.ServerName      = PWCOSTINGV1.Properties.Settings.Default.strServerName;
                        UserSettings.DatabaseName    = PWCOSTINGV1.Properties.Settings.Default.strDBName;
                        UserSettings.IsAuthenticated = true;
                        MyCaller.AuthenticateUser();
                        MyCaller.Show();
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
Exemplo n.º 7
0
 private void mbtnTestConnection_Click(object sender, EventArgs e)
 {
     try
     {
         FormHelpers.CursorWait(true);
         TestConnection();
         Preloader.Preload();
         MessageHelpers.ShowInfo("Test connection successful.");
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 8
0
        private void toolStriptxtSearch_TextChanged(object sender, EventArgs e)
        {
            string strtosearch = tstxtSearch.Text;

            try
            {
                switch (KindOfList)
                {
                case "ITEM":
                    (mgridList.DataSource as DataTable).DefaultView.RowFilter = string.Format("ItemNo LIKE '{0}%' or Description LIKE '{0}%'", BPSolutionsTools.BPSUtilitiesV1.NZ(strtosearch, ""));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
        }
Exemplo n.º 9
0
 private void QuoteItem(string itemno)
 {
     try
     {
         FormHelpers.CursorWait(true);
         if (itembal.QuoteItem(yused, itemno))
         {
             MessageHelpers.ShowInfo("Quotation Successful!");
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 10
0
 public void SearchGrid()
 {
     try
     {
         string strtosearch = toolStriptxtSearch.Text;
         try
         {
             (mgridList.DataSource as DataTable).DefaultView.RowFilter = string.Format("UserGroupCode LIKE '%{0}%' or UserGroupDesc LIKE '%{0}%'", BPSolutionsTools.BPSUtilitiesV1.NZ(strtosearch, ""));
         }
         catch (Exception ex)
         {
             MessageHelpers.ShowError(ex.Message);
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
 private void mbtnPreview_Click(object sender, EventArgs e)
 {
     try
     {
         string itemno = mtxtItemNo.Text;
         FormHelpers.CursorWait(true);
         PreviewFPR(itemno, "rpt_PreviewItemDetails.rpt", "sp_ItemDetailsMain");
         PreviewF2017("rpt_StandardCostingF2017.rpt");
         PreviewFSMT("rpt_StandardCostingFSMT.rpt", "sp_SMTRaw2017");
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 12
0
        private void ShowEntryForm(FormState Mystate)
        {
            try
            {
                var frm = new frmFXandSP();
                switch (Mystate)
                {
                case FormState.Add:
                    break;

                case FormState.Edit:
                case FormState.View:
                    try
                    {
                        if (mgridList1.SelectedRows != null)
                        {
                            var fxsptype    = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colRecType1"].Value.ToString();
                            var fxspeffdate = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colEffectiveDate1"].Value.ToString();
                            frm.RecType       = fxsptype;
                            frm.EffectiveDate = fxspeffdate;
                        }
                    }
                    catch
                    {
                        if (mgridList2.SelectedRows != null)
                        {
                            var fxsptype    = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colRecType2"].Value.ToString();
                            var fxspeffdate = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colEffectiveDate2"].Value.ToString();
                            frm.RecType       = fxsptype;
                            frm.EffectiveDate = fxspeffdate;
                        }
                    }
                    break;
                }
                frm.MyState  = Mystate;
                frm.MyCaller = this;
                FormHelpers.ShowForm(frm, (MetroForm)this.MdiParent);
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
        }
Exemplo n.º 13
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);
     }
 }
Exemplo n.º 14
0
        private void Init_Form()
        {
            try
            {
                var strheader = this.Text;
                switch (MyState)
                {
                case FormState.Add:
                    LockFields(false);
                    strheader += " - New";
                    break;

                case FormState.Edit:
                case FormState.Delete:
                case FormState.View:
                    AssignRecord(false);
                    LockFields(false);
                    if (MyState == FormState.View)
                    {
                        LockFields(true);
                        mbtnSave.Text = "Edit";
                        strheader    += " - View";
                        mbtnSave.Focus();
                    }
                    else
                    {
                        mtxtMoldNo.ReadOnly = true;
                        mbtnSave.Text       = "Update";
                        strheader          += " - Edit";
                    }
                    break;
                }
                this.Text = strheader;
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
        }
Exemplo n.º 15
0
        private void Init_Form()
        {
            try
            {
                var strheader = "FX and SP";
                switch (MyState)
                {
                case FormState.Add:
                    LockFields(false, true);
                    strheader += " - New";
                    this.mcboType.SelectedIndex = 0;
                    break;

                case FormState.Edit:
                case FormState.View:
                    AssignRecord(false);
                    LockFields(true, false);
                    if (MyState == FormState.View)
                    {
                        mbtnSave.Text = "Edit";
                        strheader    += " - View";
                        mbtnSave.Focus();
                    }

                    else
                    {
                        mtxtRate.ReadOnly = false;
                        mbtnSave.Text     = "Update";
                        strheader        += " - Edit";
                    }
                    break;
                }
                this.Text = strheader;
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
        }
Exemplo n.º 16
0
 public void RefreshGrid()
 {
     try
     {
         var       list        = usergroupbal.GetAll().OrderBy(m => m.UserGroupDesc).ToList();
         DataTable usrgrpTable = new DataTable();
         using (var reader = ObjectReader.Create(list,
                                                 "GroupID",
                                                 "UserGroupCode",
                                                 "UserGroupDesc",
                                                 "IsActive"))
         {
             usrgrpTable.Load(reader);
             mgridList.DataSource = usrgrpTable;
         }
         Grid.ListCheck(mgridList, listTS);
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
Exemplo n.º 17
0
        private static void TestConnection()
        {
            Thread t = new Thread(new ThreadStart(Loading));

            t.Start(); //open splash
            try
            {
                CompanyBAL compbal;
                compbal = new CompanyBAL();
                AppSettings.CompanyProfile = compbal.GetByID(1);
                AppSettings.AppConnected   = true;
                Preloader.Preload(); //Preload Report
                //Cache.Refresh();
                t.Abort();           //close splash
            }
            catch (Exception ex)
            {
                t.Abort(); //close splash
                MessageHelpers.ShowError(ex.Message);
                AppSettings.AppConnected = false;
            }
        }
Exemplo n.º 18
0
 private void mbtnViewList_Click(object sender, EventArgs e)
 {
     try
     {
         FormHelpers.CursorWait(true);
         var frm = new frm_DynamicList();
         frm.KindOfList         = "CAT";
         frm.Text               = "List of Categories in Year " + selyear.ToString();
         frm.IsPrevious         = true;
         frm.PreviousYear       = selyear;
         frm.MyCaller_CopierCat = this;
         FormHelpers.ShowDialog(frm);
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 19
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);
     }
 }
Exemplo n.º 20
0
 private void mgridList_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         foreach (DataGridViewRow row in mgridList.Rows)
         {
             if (row.IsNewRow)
             {
                 continue;
             }
             if (BPSolutionsTools.BPSUtilitiesV1.NZ(mgridList.Rows[e.RowIndex].Cells["colSubProcessCode"].Value, "").ToString() != "")
             {
                 if (mgridList.Rows[e.RowIndex].Cells["colSubProcessCode"].ReadOnly == false)
                 {
                     if (codelist().Contains(mgridList.Rows[e.RowIndex].Cells["colSubProcessCode"].Value.ToString()))
                     {
                         MessageHelpers.ShowError("Code already taken!");
                         mgridList.Rows.RemoveAt(e.RowIndex);
                         break;
                     }
                 }
                 Grid.UniqueRow(mgridList, "colSubProcessCode");
             }
             if (BPSolutionsTools.BPSUtilitiesV1.NZ(mgridList.Rows[e.RowIndex].Cells["colItemDesc"].Value, "").ToString() != "")
             {
                 if (descrplist().Contains(mgridList.Rows[e.RowIndex].Cells["colItemDesc"].Value.ToString()))
                 {
                     MessageHelpers.ShowError("Description already taken!");
                     mgridList.Rows.RemoveAt(e.RowIndex);
                     break;
                 }
                 Grid.UniqueRow(mgridList, "colItemDesc");
             }
         }
     }
     catch
     {
     }
 }
Exemplo n.º 21
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);
     }
 }
Exemplo n.º 22
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);
     }
 }
Exemplo n.º 23
0
 private void mbtnImport_Click(object sender, EventArgs e)
 {
     try
     {
         if (mtxtFilePath.Text != "")
         {
             FormHelpers.CursorWait(true);
             Import();
         }
         else
         {
             throw new Exception("Filepath cannot be empty!");
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 24
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageHelpers.ShowQuestion("Are you sure you want to save settings?") == System.Windows.Forms.DialogResult.Yes)
         {
             FormHelpers.CursorWait(true);
             TestConnection();
             PWCOSTINGV1.Properties.Settings.Default.Save();
             MessageHelpers.ShowInfo("Connection Settings updated successfully.");
             AppSettings.AppConnected = true;
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Exemplo n.º 25
0
        private void Init_Form()
        {
            try
            {
                var strheader = "My Company";
                switch (MyState)
                {
                case FormState.Add:
                    LockFields(false);
                    break;

                case FormState.Edit:
                case FormState.View:
                    AssignRecord(false);
                    LockFields(false);
                    if (MyState == FormState.View)
                    {
                        LockFields(true);
                        strheader += " - View";
                        mbtnSave.BackgroundImage = global::PWCOSTINGV1.Properties.Resources.editicon;
                        mbtnSave.Focus();
                    }
                    else
                    {
                        mbtnSave.BackgroundImage = global::PWCOSTINGV1.Properties.Resources.saveicon1;
                        strheader += " - Edit";
                    }
                    break;
                }
                this.Text = strheader;
                mTCCompany.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
        }
Exemplo n.º 26
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);
     }
 }
Exemplo n.º 27
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);
     }
 }
Exemplo n.º 28
0
 public void RefreshGrid()
 {
     try
     {
         var       list      = Sectionbal.GetAll().Distinct().OrderBy(m => m.SECTIONDESC).ToList();
         DataTable sectTable = new DataTable();
         using (var reader = ObjectReader.Create(list,
                                                 "RecID",
                                                 "SECTIONCODE",
                                                 "SECTIONDESC",
                                                 "IsActive"))
         {
             sectTable.Load(reader);
             mgridList.DataSource = sectTable;
         }
         dgvorig.DataSource = mgridList.DataSource;
         Grid.ListCheck(mgridList, listTS);
         tslblRowCount.Text = "Number of Records:    " + list.Count + "       ";
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
 }
Exemplo n.º 29
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);
     }
 }
Exemplo n.º 30
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);
     }
 }