阅读全文http://www.cckan.net/forum.php?mod=viewthread&tid=32
try
{
//((Image)gvGradeUser.FindControl(ImageGrade)).ImageUrl.ToString().Trim();
//根据等级的编修改
int enbale = 0;
if (ddlStart.Text.ToString().Trim() == "正常")
{
enbale = 0;
}
else
{
enbale = 1;
}
//图片存在时
if (FtxtFlileName.HasFile)
{
FtxtFlileName.SaveAs(Server.MapPath("../GradeImage/") + FtxtFlileName.FileName.ToString().Trim());
if (objCusGradelevelService.SetOneGradelevelInfo(Convert.ToInt32(lblcode.Text.ToString().Trim()), txtName.Text.ToString().Trim(), Convert.ToInt32(txtJiFenFanWei.Text.ToString().Trim()), enbale, "~/PersonnelManagement/GradeImage/" + FtxtFlileName.FileName.ToString().Trim(), txtText.Text.ToString().Trim()))
{
lblMessage.Visible = true;
lblMessage.Text = "修改成功";
}
else
{
lblMessage.Visible = true;
lblMessage.Text = "修改失败";
}
}
//图片不存在时
else
{
if (objCusGradelevelService.SetOneGradelevelInfoNoimage(Convert.ToInt32(lblcode.Text.ToString().Trim()), txtName.Text.ToString().Trim(), Convert.ToInt32(txtJiFenFanWei.Text.ToString().Trim()), enbale, txtText.Text.ToString().Trim()))
{
lblMessage.Visible = true;
lblMessage.Text = "修改成功";
}
else
{
lblMessage.Visible = true;
lblMessage.Text = "修改失败";
}
}
dt_GradeUser = objCusGradelevelService.GetAllGradelevelInfo();
dtGradeUser();
btnAdd.Visible = true;
btnClearUpdate.Visible = false;
btnUpdate.Visible = false;
}
catch (Exception)
{
lblMessage.Visible = true;
lblMessage.Text = "修改失败";
}