示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id;

        if (!IsPostBack)
        {
            if (int.TryParse(Request ["file_id"], out id))
            {
                GetLaneFileForEditResponse response = Utils.LocalWebService.GetLaneFileForEdit(Master.WebServiceLogin, id);
                DBLanefile file = response.Lanefile;
                txtEditor.Text = file.contents;
                txtRoles.Text  = file.additional_roles;

                if (file.original_id != null)
                {
                    cmdSave.Visible = false;                     // Don't allow editing previous versions of a file
                }
                foreach (DBLane lane in response.Lanes)
                {
                    lstLanes.Items.Add(lane.lane);
                }
            }
            else
            {
                txtEditor.Text = "Invalid file id.";
            }
        }
    }
示例#2
0
    protected void cmdSave_Click(object sender, EventArgs e)
    {
        int id;

        if (int.TryParse(Request ["file_id"], out id))
        {
            GetLaneFileForEditResponse response = Utils.LocalWebService.GetLaneFileForEdit(Master.WebServiceLogin, id);
            response.Lanefile.contents         = txtEditor.Text;
            response.Lanefile.additional_roles = txtRoles.Text;

            Utils.LocalWebService.EditLaneFile(Master.WebServiceLogin, response.Lanefile);

            if (Request.UrlReferrer != null && Request.UrlReferrer.LocalPath.Contains("ViewLaneFileHistory.aspx"))
            {
                Response.Redirect("ViewLaneFileHistory.aspx?id=" + Request ["file_id"], false);
            }
            else
            {
                Response.Redirect("EditLane.aspx?lane_id=" + Request ["lane_id"], false);
            }
        }
        else
        {
            Response.Redirect("EditLane.aspx?lane_id=" + Request ["lane_id"], false);
        }
    }
示例#3
0
    protected void cmdSave_Click(object sender, EventArgs e)
    {
        int id;

        try {
            if (int.TryParse(Request ["file_id"], out id))
            {
                GetLaneFileForEditResponse response = Master.WebService.GetLaneFileForEdit(Master.WebServiceLogin, id);
                response.Lanefile.contents = txtEditor.Text;
                Master.WebService.EditLaneFile(Master.WebServiceLogin, response.Lanefile);

                if (Request.UrlReferrer != null && Request.UrlReferrer.LocalPath.Contains("ViewLaneFileHistory.aspx"))
                {
                    Response.Redirect("ViewLaneFileHistory.aspx?id=" + Request ["file_id"], false);
                }
                else
                {
                    Response.Redirect("EditLane.aspx?lane_id=" + Request ["lane_id"], false);
                }
            }
            else
            {
                Response.Redirect("EditLane.aspx?lane_id=" + Request ["lane_id"], false);
            }
        } catch (Exception ex) {
            Response.Write(ex.ToString().Replace("\n", "<br/>"));
        }
    }