Esempio n. 1
0
 /// <summary>
 /// Function to save the new route
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RouteSP   spRoute   = new RouteSP();
         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 (spRoute.RouteCheckExistence(txtRouteName.Text.Trim(), 0, Convert.ToDecimal(cmbArea.SelectedValue.ToString())) == false)
         {
             decRoute = spRoute.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);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Function to edit already existing route
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RouteSP   spRoute   = new RouteSP();
         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 (spRoute.RouteCheckExistence(txtRouteName.Text.Trim(), decRouteId, Convert.ToDecimal(cmbArea.SelectedValue.ToString())) == false)
         {
             if (spRoute.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);
     }
 }