Esempio n. 1
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")
             {
                 RouteSP   spRoute   = new RouteSP();
                 RouteInfo infoRoute = new RouteInfo();
                 infoRoute             = spRoute.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);
     }
 }
        /// <summary>
        /// Function to get particular values from Route table based on the parameter
        /// </summary>
        /// <param name="routeId"></param>
        /// <returns></returns>
        public RouteInfo RouteView(decimal routeId)
        {
            RouteInfo routeinfo = new RouteInfo();

            try
            {
                routeinfo = spRoute.RouteView(routeId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("RT9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(routeinfo);
        }