protected void CategoryObjectDataSource_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         e.ExceptionHandled = true;
     }
 }
 protected void ods_PersonalProfile_Updated(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         //ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Your profile saved successfully.');", true);
     }
 }
예제 #3
0
 protected void InstructorDetailsDataSource_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.AffectedRows != 0)
     {
         InstructorList.DataBind();
     }
 }
 protected void dsProtocolo_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         Response.Redirect("~/Comunicacion/MantenimientoProtocolo/ConsultarProtocolo.aspx");
     }
 }
예제 #5
0
 protected void ObjectDataSource1_Selected(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
 {
     if (e.OutputParameters["RowCount"] != null)
     {
         HttpContext.Current.Items["RowCount"] = e.OutputParameters["RowCount"];
     }
 }
예제 #6
0
        protected void CallDetailsObjectDataSource_Updated(object sender, ObjectDataSourceStatusEventArgs e)
        {
            if (e.Exception != null)
            {
                var customValidator = new CustomValidator();
                customValidator.IsValid = false;
                customValidator.ErrorMessage = "Update failed: " + e.Exception.InnerException.Message;
                customValidator.ValidationGroup = "sum";
                Page.Validators.Add(customValidator);
                e.ExceptionHandled = true;

            }
            else
            {
                CallListUpdatePanel.Update();
                MiniDetailBasicUpdatePanel.Update();

                CallDetailsView.DataBind();
                this.CallListGridView.DataBind();
                this.CallListGridView.SelectedIndex = -1;
                this.CallMiniDetailFormView.DataBind();
                this.CallMiniMoreDetailsView.DataBind();

                MessageLiteral.Text = "Success </br></br> <p> Call has been successfully updated <br/> ";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "ShowAlertModal();", true);
                CallDetailsView.ChangeMode(DetailsViewMode.Insert);
                Session["EditCallID"] = 0;

            }
        }
 private void CheckForEfExceptions(ObjectDataSourceStatusEventArgs e, string function)
 {
     if (e.Exception.InnerException is DbUpdateConcurrencyException)
     {
         var concurrencyExceptionValidator = new CustomValidator
                                                 {
                                                     IsValid = false,
                                                     ErrorMessage =
                                                         "The record you attempted to edit or delete was modified by another " +
                                                         "user after you got the original value. The edit or delete operation was canceled " +
                                                         "and the other user's values have been displayed so you can " +
                                                         "determine whether you still want to edit or delete this record."
                                                 };
         Page.Validators.Add(concurrencyExceptionValidator);
         e.ExceptionHandled = true;
     }
     else if (e.Exception.InnerException is DbEntityValidationException)
     {
         var concurrencyExceptionValidator = new CustomValidator();
         concurrencyExceptionValidator.IsValid = false;
         StringBuilder errors = new StringBuilder();
         foreach (var err in ((DbEntityValidationException)e.Exception.InnerException).EntityValidationErrors)
         {
             foreach (var msg in err.ValidationErrors)
             {
                 var validator = new CustomValidator();
                 validator.IsValid = false;
                 validator.ErrorMessage = msg.ErrorMessage;
                 Page.Validators.Add(validator);
                 e.ExceptionHandled = true;
             }
         }
     }
 }
 protected void oTerminal_Updated(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         Response.Redirect("~/Terminales/MantenimientoTerminal/ConsultarTerminal.aspx");
     }
 }
 private void ObjectDataSourceEx_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (this.SelectAllCountMethodExecuted)
     {
         this.Count = (int) e.ReturnValue;
     }
 }
 protected void CustomerObjectDataSource_Updated(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         CheckForEfExceptions(e, "update");
     }
 }
예제 #11
0
 protected void ObjectDataSource2_Updated(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
 {
     if (e.ReturnValue is int && (int)e.ReturnValue > 0)
     {
         e.AffectedRows = (int)e.ReturnValue;
     }
 }
예제 #12
0
 /// <summary>
 /// Adds the inserted id to the view state.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ObjectDataSource1_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.ReturnValue != null)
     {
         ViewState.Add("Id", e.ReturnValue.ToString());
     }
 }
예제 #13
0
    protected void OdsProject_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        if (result != 0)
        {
            Project project = new ProjectBLL().GetProjectByProjectID(result);

            UserBLL userBLL = new UserBLL();
            Eisk.BusinessEntities.User user = userBLL.GetUserByUserName((HttpContext.Current.User.Identity).Name);

            if (user != null)
            {
                // ProjectInfo
                TextBox      txtProjectName = (TextBox)formViewProject.FindControl("txtProjectName");
                TextBox      txtClient      = (TextBox)formViewProject.FindControl("txtClient");
                TextBox      txtAddress1    = (TextBox)formViewProject.FindControl("txtAddress1");
                TextBox      txtAddress2    = (TextBox)formViewProject.FindControl("txtAddress2");
                DropDownList ddlCity        = (DropDownList)formViewProject.FindControl("ddlCity");
                TextBox      txtState       = (TextBox)formViewProject.FindControl("txtState");
                TextBox      txtZipCode     = (TextBox)formViewProject.FindControl("txtZipCode");
                TextBox      txtDescription = (TextBox)formViewProject.FindControl("txtDescription");
                TextBox      txtComments    = (TextBox)formViewProject.FindControl("txtComments");

                ProjectInfo projectInfo = new ProjectInfo();
                projectInfo.ProjectName = txtProjectName.Text;
                projectInfo.Client      = txtClient.Text;
                projectInfo.Address1    = txtAddress1.Text;
                projectInfo.Address2    = txtAddress2.Text;
                projectInfo.CityID      = Convert.ToInt32(ddlCity.SelectedValue);
                projectInfo.State       = txtState.Text;
                projectInfo.ZipCode     = txtZipCode.Text.Replace("-", "");
                projectInfo.Description = txtDescription.Text.Substring(0, Math.Min(txtDescription.Text.Length, 5000));
                projectInfo.Comments    = txtComments.Text.Substring(0, Math.Min(txtComments.Text.Length, 5000));

                projectInfo.ProjectID = project.ProjectID;
                projectInfo.ProjectReference.EntityKey = project.EntityKey;

                new ProjectInfoBLL().CreateNewProjectInfo(projectInfo);
                //

                // Group_Projects
                List <Group> groupList = user.Group_Users.Select(instance => instance.Group).ToList();
                Group        group     = groupList[0];

                Group_Projects group_Projects = new Eisk.BusinessEntities.Group_Projects();

                group_Projects.GroupID = group.GroupID;
                group_Projects.GroupReference.EntityKey = group.EntityKey;

                group_Projects.ProjectID = project.ProjectID;
                group_Projects.ProjectReference.EntityKey = project.EntityKey;

                new Group_ProjectsBLL().CreateNewGroup_Projects(group_Projects);
                //
            }

            Response.RedirectToRoute("project-details", new { edit_mode = "edit", Project_id = result.ToString() });
        }
    }
 protected void oPuntoServicio_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception == null)
     {
         Response.Redirect("~/Terminales/MantenimientoPuntoServicio/ConsultarPuntoServicio.aspx");
     }
 }
예제 #15
0
 protected void DepartmentsObjectDataSource_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         CheckForOptimisticConcurrencyException(e, "delete");
     }
 }
예제 #16
0
		protected void odsOrgsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
		{
			if (e.Exception != null)
			{
				messageBox.ShowErrorMessage("GET_ORGS", e.Exception);
				e.ExceptionHandled = true;
			}
		}
		protected void odsSharePointSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
		{
			if (e.Exception != null)
			{
				messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_GET_SITECOLLECTIONS", e.Exception);
				e.ExceptionHandled = true;
			}
		}
 protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         messageBox.ShowErrorMessage("EXCHANGE_DISCLAIMERS_LISTS", e.Exception);
         e.ExceptionHandled = true;
     }
 }
예제 #19
0
 /// <summary>
 /// Send the inserted comment to the predefined mail recepient using the singleton mailmanager
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void odsBlogComment_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     BlogComment insertedComment = (BlogComment)e.ReturnValue;
     if (insertedComment != null)
     {
         MailManager.GetMailManager().SendCommentMessage(insertedComment);
     }
 }
 protected void dsParametroTransformacionCampo_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     EstadoOperacion resultado = (EstadoOperacion)e.ReturnValue;
     if (!resultado.Estado)
     {
         lblMensaje.Text = resultado.Mensaje;
     }
 }
 protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         messageBox.ShowErrorMessage("ORGANZATION_GET_USERS", e.Exception);
         e.ExceptionHandled = true;
     }
 }        
 protected void dsEntidadComunicacion_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     BusinessEntity.EstadoOperacion Estado = ((BusinessEntity.EstadoOperacion)e.ReturnValue);
     if (!Estado.Estado)
     {
         this.lblMensaje.Text = Estado.Mensaje;
     }
 }
 protected void gvGroup_OnRowUpdating(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.ReturnValue.ToString()))
     {
         string script = "<script type=\"text/javascript\">alert('" + e.ReturnValue.ToString() + "');</script>";
         ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script);
     }
 }
예제 #24
0
 protected void odsSchedules_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         ProcessException(e.Exception);
         e.ExceptionHandled = true;
     }
 }
 protected void dsMensaje_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     EstadoOperacion resultado = (EstadoOperacion)e.ReturnValue;
     if (!resultado.Estado)
     {
         this.lblMensaje.Text = resultado.Mensaje;
     }
 }
예제 #26
0
 protected void odsWines_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         this.lblStatus.Text = "Deletion not possible. Make sure there are no depending objects and try again.";
         e.ExceptionHandled = true;
     }
 }
예제 #27
0
 protected void odsPackagesPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         ProcessException(e.Exception.InnerException);
         e.ExceptionHandled = true;
     }
 }
예제 #28
0
 protected void odsServersPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         messageBox.ShowErrorMessage("EXCHANGE_GET_MAILBOXES", e.Exception);
         e.ExceptionHandled = true;
     }
 }
예제 #29
0
 /// <summary>
 /// TODO: Skriv beskrivning till CommentDataSource_Selected.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void CommentDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         AddErrorMessage(Strings.Post_Selecting_Error);
         e.ExceptionHandled = true;
     }
 }
        protected void dsDinamicaCriptografia_Updated(object sender, ObjectDataSourceStatusEventArgs e)
        {
            EstadoOperacion Estado = (EstadoOperacion)e.ReturnValue;

            if (!Estado.Estado)
            {
                this.lblMensaje.Text = Estado.Mensaje;
            }
        }
예제 #31
0
 protected void odsReport_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         ProcessException(e.Exception);
         this.DisableControls = true;
         e.ExceptionHandled = true;
     }
 }
예제 #32
0
파일: Roles.aspx.cs 프로젝트: kenchic/SAF
 protected void odsDatos_Updated(object sender, ObjectDataSourceStatusEventArgs e)
 {
     int resultado;
     resultado = Convert.ToInt32(e.ReturnValue);
     if ((resultado > 0))
         Utilidad.MostrarResultadoOperacionBd(ref rgDatos, ((Clases.Mensaje)Session["mensajes"]).ActualizarBien, true);
     else
         Utilidad.MostrarResultadoOperacionBd(ref rgDatos, ((Clases.Mensaje)Session["mensajes"]).ActualizarMal + ". " + ((BaseDatos.Comandos)Session["ejecutorBD"]).UltimoError, false);
 }
예제 #33
0
    protected void OdsScientificName_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        if (result != 0)
        {
            Response.RedirectToRoute(new { edit_mode = "edit", ScientificName_id = result.ToString() });
        }
    }
예제 #34
0
파일: Default.aspx.cs 프로젝트: uncas/hibes
 private void IssuesDataSource_Deleted(object sender
     , ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         lblInfo.Text = Resources.Phrases.FailedIssueDeletion;
         e.ExceptionHandled = true;
     }
 }
예제 #35
0
    protected void OdsUserInfo_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        User user = new UserBLL().GetUserByUserName((HttpContext.Current.User.Identity).Name);

        if (e.ReturnValue != null)
        {
            Response.RedirectToRoute("userinfo-details", new { edit_mode = "view", userinfo_id = user.UserID });
        }
    }
예제 #36
0
    protected void OdsEmployeeDetails_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        if (result != 0)
        {
            Session["ShowInsertSuccess"] = true;
            Response.RedirectToRoute(new { edit_mode = "edit", employee_id = result.ToString() });
        }
    }
예제 #37
0
    protected void OdsOrganism_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        string projectID = (this.RouteData.Values["project_id"] as string);

        if (result != 0)
        {
            Response.RedirectToRoute("commonname-details", new { edit_mode = "edit", project_id = projectID, organism_id = result, scientificname_id = Page.RouteData.Values["scientificname_id"] as string, commonname = "edit" });
        }
    }
예제 #38
0
 protected void odsnc_Selected(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
 {
     try
     {
         /*DataTable dt = ((DataSet)e.ReturnValue).Tables[0];
          * Session[_nameSessionData] = dt;*/
         Session[_nameList] = new List <Documents_Trans>();
     }
     catch
     { }
 }
예제 #39
0
    protected void OdsOrderDetails_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        //getting the result
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        if (result != 0)
        {
            Message = "Insert successful.";
            //We can ignore the line below, if we need to return just after the insertion operation
            WebManager.UpdateItemId(result.ToString(System.Globalization.CultureInfo.CurrentCulture.NumberFormat), formViewEmployee);
        }
        else
        {
            Message = "Error while inserting.";
        }
    }
예제 #40
0
    protected void OdsProject_Organism_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        //string lat = "";
        //string lon = "";
        if (result != 0)
        {
            Project_Organisms       project_Organisms       = new Project_OrganismsBLL().GetProject_OrganismsByProjectOrganismID(result);
            ProjectInfoTreeLocation projectInfoTreeLocation = new ProjectInfoTreeLocationBLL().GetProjectInfoTreeLocationsByProjectID(project_Organisms.ProjectID)[0];
            bool fromInventory = false;

            UserBLL userBLL = new UserBLL();
            Eisk.BusinessEntities.User user = userBLL.GetUserByUserName((HttpContext.Current.User.Identity).Name);

            if (user != null)
            {
                // TreeDetail
                TextBox     txtVaras      = (TextBox)formViewTlProject_Organism.FindControl("txtVaras");
                HiddenField hfDap         = (HiddenField)formViewTlProject_Organism.FindControl("hfDap");
                TextBox     txtDap        = (TextBox)formViewTlProject_Organism.FindControl("txtDap");
                TextBox     txtDapCounter = (TextBox)formViewTlProject_Organism.FindControl("txtDapCounter");
                TextBox     txtHeight     = (TextBox)formViewTlProject_Organism.FindControl("txtHeight");
                TextBox     txtCommentary = (TextBox)formViewTlProject_Organism.FindControl("txtCommentary");

                Label   lblNumber = (Label)formViewTlProject_Organism.FindControl("lblNumber");
                TextBox txtX      = (TextBox)formViewTlProject_Organism.FindControl("txtX");
                TextBox txtY      = (TextBox)formViewTlProject_Organism.FindControl("txtY");
                TextBox txtLat    = (TextBox)formViewTlProject_Organism.FindControl("txtLat");
                TextBox txtLon    = (TextBox)formViewTlProject_Organism.FindControl("txtLon");

                RadioButtonList rblActionProposed = (RadioButtonList)formViewTlProject_Organism.FindControl("rblActionProposed");
                RadioButtonList rblCondition      = (RadioButtonList)formViewTlProject_Organism.FindControl("rblCondition");

                // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                // Edgardo Ramos - 20130928
                CheckBox chkLittoral     = (CheckBox)formViewTlProject_Organism.FindControl("chkLittoral");
                CheckBox chkMaritimeZone = (CheckBox)formViewTlProject_Organism.FindControl("chkMaritimeZone");
                // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                TreeDetail treeDetail = new TreeDetail();

                if (!string.IsNullOrEmpty(txtVaras.Text) && txtVaras.Text != "0") // Is Cepa
                {
                    treeDetail.Dap         = 0;
                    treeDetail.Dap_Counter = 0;
                }
                else if (txtDapCounter.Text == "1") // Solo un Dap
                {
                    //treeDetail.Dap = Convert.ToDecimal(txtDap.Text);// new DapBLL().GetDap(0);
                    //treeDetail.Dap_Counter = Convert.ToInt32(txtDapCounter.Text); //new DapBLL().GetDapCount(0);
                    treeDetail.Dap         = Convert.ToDecimal(hfDap.Value); // new DapBLL().GetDap(0);
                    treeDetail.Dap_Counter = Convert.ToInt32(1);             //new DapBLL().GetDapCount(0);
                }
                else // Mas de un Dap
                {
                    string[] daps     = hfDap.Value.Split(',');
                    double   dapTotal = 0;
                    foreach (string dap in daps)
                    {
                        dapTotal += Convert.ToDouble(dap);
                    }//dapTotal;// new DapBLL().GetDap(0);
                    treeDetail.Dap         = Convert.ToDecimal(Math.Round(Math.Sqrt(Math.Pow(dapTotal, 2D) / Convert.ToDouble(daps.Count())) * 100) / 100);
                    treeDetail.Dap_Counter = Convert.ToInt32(txtDapCounter.Text); //new DapBLL().GetDapCount(0);
                }

                treeDetail.Varas = Convert.ToInt32(string.IsNullOrEmpty(txtVaras.Text) ? "0" : txtVaras.Text);

                treeDetail.Height     = Convert.ToDecimal(txtHeight.Text);
                treeDetail.Commentary = (txtCommentary.Text.Length > txtCommentary.MaxLength) ? txtCommentary.Text.Substring(0, txtCommentary.MaxLength) : txtCommentary.Text;

                treeDetail.Number = Convert.ToInt32(lblNumber.Text);


                // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                // Edgardo Ramos - 20130928
                decimal         dec;
                RadioButtonList rblPosition = (RadioButtonList)formViewTlProject_Organism.FindControl("rblPosition");

                if (rblPosition.SelectedValue == "0") // Nad83
                {
                    treeDetail.X = decimal.TryParse(txtX.Text, out dec) ? Convert.ToDecimal(txtX.Text) : 0;
                    treeDetail.Y = decimal.TryParse(txtY.Text, out dec) ? Convert.ToDecimal(txtY.Text) : 0;

                    if (treeDetail.X != 0 && treeDetail.Y != 0)
                    {
                        Dictionary <string, object> anewpointObj = Utility.ConvertToLatLng(treeDetail.X.ToString(), treeDetail.Y.ToString(), @"~/App_Resources/client-scripts/tl/");

                        treeDetail.Lat = Convert.ToDecimal(anewpointObj["y"]);
                        txtLat.Text    = treeDetail.Lat.ToString();
                        treeDetail.Lon = Convert.ToDecimal(anewpointObj["x"]);
                        txtLon.Text    = treeDetail.Lon.ToString();
                    }
                    else
                    {
                        treeDetail.Lat = 0;
                        treeDetail.Lon = 0;
                    }
                }
                else // StatePlanes
                {
                    treeDetail.Lat = decimal.TryParse(txtLat.Text, out dec) ? Convert.ToDecimal(txtLat.Text) : 0;
                    treeDetail.Lon = decimal.TryParse(txtLon.Text, out dec) ? Convert.ToDecimal(txtLon.Text) : 0;

                    if (treeDetail.Lat != 0 && treeDetail.Lon != 0)
                    {
                        Dictionary <string, object> anewpointObj = Utility.ConvertToStatePlane(treeDetail.Lon.ToString(), treeDetail.Lat.ToString(), @"~/App_Resources/client-scripts/tl/");

                        treeDetail.X = Convert.ToDecimal(anewpointObj["x"]);
                        txtX.Text    = treeDetail.X.ToString();
                        treeDetail.Y = Convert.ToDecimal(anewpointObj["y"]);
                        txtY.Text    = treeDetail.Y.ToString();
                    }
                    else
                    {
                        treeDetail.X = 0;
                        treeDetail.Y = 0;
                    }
                }

                //treeDetail.X = Convert.ToDecimal(txtX.Text);
                //treeDetail.Y = Convert.ToDecimal(txtY.Text);
                //treeDetail.Lat = Convert.ToDecimal(txtLat.Text);
                //treeDetail.Lon = Convert.ToDecimal(txtLon.Text);

                treeDetail.Littoral     = chkLittoral.Checked;
                treeDetail.MaritimeZone = chkMaritimeZone.Checked;

                // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                treeDetail.CreatedDate   = DateTime.Now;
                treeDetail.CreatorUserID = user.UserID;
                treeDetail.EditedDate    = DateTime.Now;
                treeDetail.EditorUserID  = user.UserID;

                ActionProposed actionProposed = new ActionProposedBLL().GetActionProposedByActionProposedID(Convert.ToInt32(rblActionProposed.SelectedValue));
                treeDetail.ActionProposedID = actionProposed.ActionProposedID;
                treeDetail.ActionProposedReference.EntityKey = actionProposed.EntityKey;

                Condition condition = new ConditionBLL().GetConditionByConditionID(Convert.ToInt32(rblCondition.SelectedValue));
                treeDetail.ConditionID = condition.ConditionID;
                treeDetail.ConditionReference.EntityKey = condition.EntityKey;

                treeDetail.ProjectOrganismID = project_Organisms.ProjectOrganismID;
                treeDetail.Project_OrganismsReference.EntityKey = project_Organisms.EntityKey;

                int treeDetailID = new TreeDetailBLL().CreateNewTreeDetail(treeDetail);

                if (treeDetail.Varas != null && treeDetail.Varas > 0) // Is Cepa
                {
                    //
                }
                else if (txtDapCounter.Text == "1") // Solo un Dap
                {
                    Dap dap = new Dap();
                    dap.DapValue      = Convert.ToDecimal(hfDap.Value);
                    dap.TreeDetailsID = treeDetailID;
                    dap.TreeDetailReference.EntityKey = treeDetail.EntityKey;

                    new DapBLL().CreateNewDap(dap);
                }
                else // Mas de un Dap
                {
                    string[] daps = hfDap.Value.Split(',');
                    foreach (string dapString in daps)
                    {
                        Dap dap = new Dap();
                        dap.DapValue      = Convert.ToDecimal(dapString);
                        dap.TreeDetailsID = treeDetailID;
                        dap.TreeDetailReference.EntityKey = treeDetail.EntityKey;

                        new DapBLL().CreateNewDap(dap);
                    }
                }

                fromInventory = Convert.ToDecimal(projectInfoTreeLocation.X) == Convert.ToDecimal(treeDetail.X) && Convert.ToDecimal(projectInfoTreeLocation.Y) == Convert.ToDecimal(treeDetail.Y);
                //
            }

            if (fromInventory)
            {
                Response.RedirectToRoute("tl-treeinventory", new { project_id = RouteData.Values["project_id"] });
            }
            else
            {
                Response.RedirectToRoute("tl", new { Project_id = RouteData.Values["Project_id"] });
                Response.RedirectLocation += "?poid=" + project_Organisms.ProjectOrganismID + "&lat=0&lon=0";
            }

            //Response.RedirectToRoute("tl-tree-details_edit", new { edit_mode = "edit", project_id = Page.RouteData.Values["project_id"] as string, project_organism_id = result });
        }
    }
예제 #41
0
    protected void OdsProject_Details_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
    {
        int integer;
        int result = Convert.ToInt32(e.ReturnValue, System.Globalization.CultureInfo.CurrentCulture.NumberFormat);

        if (result != 0)
        {
            Project project = new ProjectBLL().GetProjectByProjectID(result);

            UserBLL userBLL = new UserBLL();
            Eisk.BusinessEntities.User user = userBLL.GetUserByUserName((HttpContext.Current.User.Identity).Name);

            if (user != null)
            {
                // ProjectInfoTreeLocation
                TextBox         txtX       = (TextBox)formViewTlProject.FindControl("txtX");
                TextBox         txtY       = (TextBox)formViewTlProject.FindControl("txtY");
                TextBox         txtLat     = (TextBox)formViewTlProject.FindControl("txtLat");
                TextBox         txtLon     = (TextBox)formViewTlProject.FindControl("txtLon");
                TextBox         txtParking = (TextBox)formViewTlProject.FindControl("txtParking");
                RadioButtonList rblCalc    = (RadioButtonList)formViewTlProject.FindControl("rblCalc");
                TextBox         txtAcres   = (TextBox)formViewTlProject.FindControl("txtAcres");
                DropDownList    ddlDistanceBetweenTrees = (DropDownList)formViewTlProject.FindControl("ddlDistanceBetweenTrees");
                TextBox         txtLots0              = (TextBox)formViewTlProject.FindControl("txtLots0");
                TextBox         txtLots1              = (TextBox)formViewTlProject.FindControl("txtLots1");
                TextBox         txtLots2              = (TextBox)formViewTlProject.FindControl("txtLots2");
                TextBox         txtLots3              = (TextBox)formViewTlProject.FindControl("txtLots3");
                RadioButtonList rblSocialInterest     = (RadioButtonList)formViewTlProject.FindControl("rblSocialInterest");
                RadioButtonList rblPreviouslyImpacted = (RadioButtonList)formViewTlProject.FindControl("rblPreviouslyImpacted");

                ProjectInfoTreeLocation projectInfoTreeLocation = new ProjectInfoTreeLocation();
                projectInfoTreeLocation.X                  = Convert.ToDecimal(txtX.Text);
                projectInfoTreeLocation.Y                  = Convert.ToDecimal(txtY.Text);
                projectInfoTreeLocation.Lat                = Convert.ToDecimal(txtLat.Text);
                projectInfoTreeLocation.Lon                = Convert.ToDecimal(txtLon.Text);
                projectInfoTreeLocation.Parkings           = Convert.ToInt32(txtParking.Text);
                projectInfoTreeLocation.Acres              = Convert.ToDecimal(txtAcres.Text);
                projectInfoTreeLocation.SocialInterest     = rblSocialInterest.SelectedValue == "1";
                projectInfoTreeLocation.PreviouslyImpacted = rblPreviouslyImpacted.SelectedValue == "1";

                projectInfoTreeLocation.Mitigation = Convert.ToInt32(rblCalc.SelectedValue);
                if (rblCalc.SelectedValue == "0")
                {
                    projectInfoTreeLocation.Lots0 = projectInfoTreeLocation.Lots1 = projectInfoTreeLocation.Lots2 = projectInfoTreeLocation.Lots3 = 0;
                }
                else
                {
                    projectInfoTreeLocation.Lots0 = Int32.TryParse(txtLots0.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.Lots1 = Int32.TryParse(txtLots1.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.Lots2 = Int32.TryParse(txtLots2.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.Lots3 = Int32.TryParse(txtLots3.Text, out integer) ? integer : 0;
                    projectInfoTreeLocation.DistanceBetweenTrees = null;
                }

                projectInfoTreeLocation.ProjectID = project.ProjectID;
                projectInfoTreeLocation.ProjectReference.EntityKey = project.EntityKey;

                new ProjectInfoTreeLocationBLL().CreateNewProjectInfoTreeLocation(projectInfoTreeLocation);
                //
            }

            Response.RedirectToRoute(new { edit_mode = "edit", Project_id = result.ToString() });
        }
    }
 protected virtual new void OnInserted(ObjectDataSourceStatusEventArgs e)
 {
 }