示例#1
0
    protected void btnDeleteLastLeg_Click(object sender, EventArgs e)
    {
        int lastRowIndex = grdStagePlan.Rows.Count - 1;

        if (grdStagePlan.DataKeys[lastRowIndex]["Status"].ToString().ToLower().Equals("not started") || grdStagePlan.DataKeys[lastRowIndex]["Status"].ToString().ToLower().Equals("noch nicht gestartet"))
        {
            int stagePlanId = Convert.ToInt32(grdStagePlan.DataKeys[lastRowIndex]["StagePlanId"].ToString());
            objClassAdmin.DeleteLastLeg(stagePlanId);
            totalDistance        = 0;
            totalDistanceCovered = 0;
            _BindData();
            grdStagePlan.DataBind();
            if (grdStagePlan.Rows.Count == 0)
            {
                SetStartCity();
            }

            HttpCookie ce1 = new HttpCookie("LegDeleted");
            ce1.Value = "Letzte Etappe gelöscht.";
            Response.Cookies.Add(ce1);
            Response.Redirect("StagePlan.aspx");
        }
        else
        {
            string popupScript = "alert('Leg hat bereits begonnen. Kann nicht gelöscht werden.');";
            ClientScript.RegisterStartupScript(Page.GetType(), "script", popupScript, true);
        }
    }
示例#2
0
    protected void btnDeleteLastLeg_Click(object sender, EventArgs e)
    {
        int lastRowIndex = grdStagePlan.Rows.Count - 1;

        if (grdStagePlan.DataKeys[lastRowIndex]["Status"].ToString().ToLower().Equals("not started"))
        {
            int stagePlanId = Convert.ToInt32(grdStagePlan.DataKeys[lastRowIndex]["StagePlanId"].ToString());
            objClassAdmin.DeleteLastLeg(stagePlanId);
            grdStagePlan.DataBind();
            _BindData();
        }
        else
        {
            string popupScript = "alert('Leg has already started. Cannot delete.');";
            ClientScript.RegisterStartupScript(Page.GetType(), "script", popupScript, true);
        }
    }
示例#3
0
    protected void btnDeleteLastLeg_Click(object sender, EventArgs e)
    {
        try
        {
            int lastRowIndex = grdStagePlan.Rows.Count - 1;

            if (grdStagePlan.DataKeys[lastRowIndex]["Status"].ToString().ToLower().Equals("not started") || grdStagePlan.DataKeys[lastRowIndex]["Status"].ToString().ToLower().Equals("noch nicht gestartet"))
            {
                int stagePlanId = Convert.ToInt32(grdStagePlan.DataKeys[lastRowIndex]["StagePlanId"].ToString());
                objClassAdmin.DeleteLastLeg(stagePlanId);
                totalDistance        = 0;
                totalDistanceCovered = 0;
                //Session["SchoolId"] = ddlSchool.SelectedValue;
                //Session["ClassId"] = ddlClass.SelectedValue;
                _BindData();
                grdStagePlan.DataBind();
                if (grdStagePlan.Rows.Count == 0)
                {
                    SetStartCity();
                }

                HttpCookie ce1 = new HttpCookie("LegDeleted");
                ce1.Value = (string)GetLocalResourceObject("StageLegDeleted");
                Response.Cookies.Add(ce1);
                Response.Redirect("StagePlan.aspx");
            }
            else
            {
                string popupScript = "alert('" + (string)GetLocalResourceObject("LegAlreadyStarted") + "');";
                ClientScript.RegisterStartupScript(Page.GetType(), "script", popupScript, true);
                _BindData();
                grdStagePlan.DataBind();
                Response.Redirect(Request.RawUrl);
            }
        }
        catch (Exception ex)
        {}
    }