Пример #1
0
 /// <summary>
 /// Function to fill the Area combobox
 /// </summary>
 public void AreaComboFill()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllRoute.AreafillInRoute();
         cmbArea.DataSource = listObj[0];
         cmbArea.ValueMember = "areaId";
         cmbArea.DisplayMember = "areaName";
         cmbArea.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RT1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #2
0
 /// <summary>
 /// creating a default route under the creating area
 /// </summary>
 public void RouteNACreateUnderTheArea()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         RouteInfo infoRoute = new RouteInfo();
         infoRoute.RouteName = "NA";
         infoRoute.AreaId = decAreaId;
         infoRoute.Narration = txtNarration.Text.Trim();
         infoRoute.Extra1 = string.Empty;
         infoRoute.Extra2 = string.Empty;
         infoRoute.ExtraDate = DateTime.Today;
         BllRoute.RouteAdd(infoRoute);
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
 /// <summary>
 /// Area combobox fill for Search
 /// </summary>
 public void AreaComboFillSearch()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllRoute.AreafillInRoute();
         DataRow dr = listObj[0].NewRow();
         dr[1] = "All";
         listObj[0].Rows.InsertAt(dr, 0);
         cmbAreaSearch.DataSource = listObj[0];
         cmbAreaSearch.ValueMember = "areaId";
         cmbAreaSearch.DisplayMember = "areaName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("RT2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
        /// <summary>
        /// On double clicking on the datagridview, It displays the details of the rack to edit or delete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvRoute_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    if (dgvRoute.Rows[e.RowIndex].Cells["dgvtxtRouteName"].Value.ToString() != "NA")
                    {
                        RouteBll BllRoute = new RouteBll();
                        RouteInfo infoRoute = new RouteInfo();
                        infoRoute = BllRoute.RouteView(Convert.ToDecimal(dgvRoute.CurrentRow.Cells["dgvtxtRouteId"].Value.ToString()));
                        decRouteId = Convert.ToDecimal(dgvRoute.CurrentRow.Cells["dgvtxtRouteId"].Value.ToString());
                        txtRouteName.Text = infoRoute.RouteName;
                        cmbArea.SelectedValue = infoRoute.AreaId.ToString();
                        txtNarration.Text = infoRoute.Narration;
                        btnSave.Text = "Update";
                        btnDelete.Enabled = true;
                        txtRouteName.Focus();

                    }
                    else
                    {
                        Messages.InformationMessage("Default Route cannot update or delete");
                        Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("RT19" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #5
0
 /// <summary>
 /// Function to save the new route
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         RouteInfo infoRoute = new RouteInfo();
         infoRoute.RouteName = txtRouteName.Text.Trim();
         infoRoute.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         infoRoute.Narration = txtNarration.Text.Trim();
         infoRoute.Extra1 = String.Empty;
         infoRoute.Extra2 = String.Empty;
         if (BllRoute.RouteCheckExistence(txtRouteName.Text.Trim(), 0, Convert.ToDecimal(cmbArea.SelectedValue.ToString())) == false)
         {
             decRoute = BllRoute.RouteAddParticularFields(infoRoute);
             {
                 Messages.SavedMessage();
                 Clear();
                 GridFill();
                 if (frmCustomerobj != null)
                 {
                     this.Close();
                 }
             }
         }
         else
         {
             Messages.InformationMessage(" Route name already exist");
             txtRouteName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RT4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
0
 /// <summary>
 /// Function to fill all Routes in datagridview based on the search key
 /// </summary>
 public void GridFill()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllRoute.RouteSearch(txtRouteNameSearch.Text.Trim(), cmbAreaSearch.Text.ToString());
         dgvRoute.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("RT3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #7
0
 /// <summary>
 /// Function to edit already existing route
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         RouteInfo infoRoute = new RouteInfo();
         infoRoute.RouteName = txtRouteName.Text.Trim();
         infoRoute.AreaId = Convert.ToDecimal(cmbArea.SelectedValue.ToString());
         infoRoute.Narration = txtNarration.Text.Trim();
         infoRoute.Extra1 = String.Empty;
         infoRoute.Extra2 = String.Empty;
         infoRoute.RouteId = decRouteId;
         if (BllRoute.RouteCheckExistence(txtRouteName.Text.Trim(), decRouteId, Convert.ToDecimal(cmbArea.SelectedValue.ToString())) == false)
         {
             if (BllRoute.RouteEditing(infoRoute))
             {
                 Messages.UpdatedMessage();
                 GridFill();
                 Clear();
             }
             else if (infoRoute.RouteId == 1)
             {
                 Messages.InformationMessage("Cannot update");
                 Clear();
                 txtRouteName.Focus();
             }
         }
         else
         {
             Messages.InformationMessage(" Route name already exist");
             txtRouteName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RT5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #8
0
 /// <summary>
 /// Function to Delete the Route
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         if (BllRoute.RouteDeleting(decRouteId) == -1)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Messages.DeletedMessage();
             GridFill();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RT7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 ///Function to fill route combobox
 /// </summary> 
 public void RouteComboFill()
 {
     try
     {
         if (cmbArea.Items.Count > 0)
         {
             if (cmbArea.SelectedIndex != -1)
             {
                 if (cmbArea.SelectedValue.ToString() != "System.Data.DataRowView" && cmbArea.Text != "System.Data.DataRowView")
                 {
                     RouteBll BllRoute = new RouteBll();
                     List<DataTable> listObjRoute = new List<DataTable>();
                     listObjRoute = BllRoute.RouteViewByArea(Convert.ToDecimal(cmbArea.SelectedValue.ToString()));
                     cmbRoute.DataSource = listObjRoute[0];
                     cmbRoute.ValueMember = "routeId";
                     cmbRoute.DisplayMember = "routeName";
                     cmbRoute.SelectedIndex = 0;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Route combobox
 /// </summary>
 public void RouteViewForComboFill()
 {
     try
     {
         RouteBll BllRoute = new RouteBll();
         List<DataTable> listObj = BllRoute.RouteViewForComboFill();
         cmbRoute.DataSource = listObj[0];
         cmbRoute.DisplayMember = "routeName";
         cmbRoute.ValueMember = "routeId";
         cmbRoute.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }