示例#1
0
    //保存按键
    protected void Save_Click(object sender, EventArgs e)
    {
        int     typeID    = int.Parse(TypeRadio.SelectedValue);
        int     placeID   = int.Parse(PlaceRadio.SelectedValue);
        string  seat      = SeatText.Text;
        string  describe  = DescribeText.Value;
        byte    grade     = byte.Parse(GradeRadio.SelectedValue);
        char    condition = ConditionRadio.Text[0];
        Clothes clothes   = new Clothes();

        if (clothes.AddOne(typeID, placeID, seat, describe, grade, condition))
        {
            //将临时图片转正
            string id = NewID.Text;
            File.Move("clothes_img/" + id + ".linshi.jpg", "clothes_img/" + id + ".jpg");
            //Response.Write("<script>alert(window.location.host)</script>");
            //是否要继续添加?
            Response.Write("<script>" +
                           "var domain = 'http://' + window.location.host;" +
                           "if (confirm('添加成功,是否要继续添加?'))" +
                           "{window.location.href = domain + '/addone.aspx';}" +
                           "else" +
                           "{window.location.href = domain;}" +
                           "</script>");
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('添加失败');", true);
        }
    }