Ejemplo n.º 1
0
        protected void BUTTON_Add_Click(object sender, EventArgs e)
        {
            int           AID           = Convert.ToInt32(DROPDOWNLIST_ActionSelect.SelectedValue);
            String        ImageFilePath = "../ImageResource/";
            String        SPath         = MapPath(ImageFilePath);
            DirectoryInfo directory     = new DirectoryInfo(SPath);
            int           FileCount     = directory.GetFiles().Length;
            String        FileName      = ImageFilePath + "img" + FileCount + ".png";
            String        FileName2     = ImageFilePath + "img" + FileCount + ".png";

            FILEUPLOAD_UploadImage.SaveAs(MapPath(FileName));
            int exec = roteUserBLL.InsertByModel(new RoteUserModel()
            {
                AID      = AID,
                RUName   = TEXTBOX_Name.Text,
                RUAge    = Convert.ToInt32(TEXTBOX_Age.Text),
                RUDetail = TEXTBOX_Detail.Text,
                RUImGUrl = FileName,
                RUSex    = DROPDOWNLIST_Sex.SelectedValue == 1.ToString(),
            });

            Response.Write("<script>alert('" + (exec > 0 ? "成功" : "失败") + "');</script>");
            if (exec > 0)
            {
                Response.Redirect("ActionInfo.aspx");
            }
        }
Ejemplo n.º 2
0
        protected void BUTTON_Submit_Click(object sender, EventArgs e)
        {
            String FileName = "";

            if (FILEUPLOAD_UploadImage.FileName == null || FILEUPLOAD_UploadImage.FileName == "")
            {
            }
            else
            {
                String        ImageFilePath = "../ImageResource/";
                String        SPath         = MapPath(ImageFilePath);
                DirectoryInfo directory     = new DirectoryInfo(SPath);
                int           FileCount     = directory.GetFiles().Length;
                FileName = ImageFilePath + "img" + FileCount + ".png";
                FILEUPLOAD_UploadImage.SaveAs(MapPath(FileName));
            }

            int exec = roteUserBLL.UpdateByModel(new RoteUserModel()
            {
                RUID     = RUID(),
                AID      = GetSelectActionID(),
                RUAge    = Convert.ToInt32(TEXTBOX_Age.Text),
                RUDetail = TEXTBOX_Detail.Text,
                RUImGUrl = FileName,
                RUName   = TEXTBOX_Name.Text,
                RUSex    = Convert.ToInt32(DROPDOWNLIST_Sex.SelectedValue) == 1
            });

            Response.Write("<script>alert('" + (exec > 0 ? "成功" : "失败") + "');</script>");
            if (exec > 0)
            {
                Response.Redirect("RoteUserSelect.aspx");
            }
        }