Exemple #1
0
    /// <summary>
    /// 确认修改工程
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        //修改工程信息

        int    ID          = int.Parse(Request.QueryString["id"].ToString());
        string ProjectName = tb_ProjectName.Text;

        if (ProjectName == "")
        {
            SmallScript.MessageBox(Page, "工程名不能为空!");
            return;
        }
        if (ProjectOperation.CheckProjectNameExist(ProjectName, ID) == true)
        {
            SmallScript.MessageBox(Page, "工程名重复。");
            return;
        }

        int    Type        = Convert.ToInt32(db_Type.SelectedItem.Value);
        string description = tb_description.Text;

        try
        {
            ProjectOperation.EditProject(ProjectName, description, Type, ID);
        }
        catch
        {
            SmallScript.MessageBox(Page, "修改失败!");
            return;
        }

        SmallScript.MessageBox(Page, "修改工程成功。");
        SmallScript.goRedirect(Response, Session, "跳转到工程列表 ", "~/admin/ProjectList.aspx");
        return;
    }
Exemple #2
0
    /// <summary>
    /// 添加按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        /*初始化工程,并设置属性*/
        ProjectEntity pe = new ProjectEntity();

        pe.ProjectName = tb_ProjectName.Text;
        if (pe.ProjectName == "")
        {
            SmallScript.MessageBox(Page, "请输入工程名!");
            return;
        }
        if (ProjectOperation.CheckProjectNameExist(pe.ProjectName, -1) == true)
        {
            SmallScript.MessageBox(Page, "已存在该名称的工程。请使用其他名称。");
            return;
        }
        pe.Tid         = int.Parse(ddl_Type.SelectedValue);
        pe.Uid         = int.Parse(Session["uid"].ToString());
        pe.UpTime      = DateTime.Now;
        pe.Description = Server.HtmlEncode(tb_Description.Text);
        /*添加工程,并返回是否成功*/
        if (pe.ProjectName == "")
        {
            SmallScript.goRedirect(Response, Session, "工程信息请填写完整!", "/admin/addproject.aspx");
            return;
        }
        if (ProjectOperation.AddProject(pe) == true)
        {
            SmallScript.goRedirect(Response, Session, "工程已成功添加!", "/admin/projectlist.aspx");
        }
        else
        {
            SmallScript.MessageBox(Page, "添加工程失败!");
        };
    }