1 try
2 {
3 //((Image)gvGradeUser.FindControl(ImageGrade)).ImageUrl.ToString().Trim();
4 //根据等级的编修改
5 int enbale = 0;
6 if (ddlStart.Text.ToString().Trim() == "正常")
7 {
8 enbale = 0;
9 }
10 else
11 {
12 enbale = 1;
13 }
14 //图片存在时
15 if (FtxtFlileName.HasFile)
16 {
17 FtxtFlileName.SaveAs(Server.MapPath("../GradeImage/") + FtxtFlileName.FileName.ToString().Trim());
18 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()))
19 {
20 lblMessage.Visible = true;
21 lblMessage.Text = "修改成功";
22
23 }
24 else
25 {
26 lblMessage.Visible = true;
27 lblMessage.Text = "修改失败";
28 }
29
30 }
31 //图片不存在时
32 else
33 {
34 if (objCusGradelevelService.SetOneGradelevelInfoNoimage(Convert.ToInt32(lblcode.Text.ToString().Trim()), txtName.Text.ToString().Trim(), Convert.ToInt32(txtJiFenFanWei.Text.ToString().Trim()), enbale, txtText.Text.ToString().Trim()))
35 {
36 lblMessage.Visible = true;
37 lblMessage.Text = "修改成功";
38 }
39 else
40 {
41 lblMessage.Visible = true;
42 lblMessage.Text = "修改失败";
43 }
44 }
45 dt_GradeUser = objCusGradelevelService.GetAllGradelevelInfo();
46 dtGradeUser();
47 btnAdd.Visible = true;
48 btnClearUpdate.Visible = false;
49 btnUpdate.Visible = false;
50 }
51 catch (Exception)
52 {
53 lblMessage.Visible = true;
54 lblMessage.Text = "修改失败";
55 }
请发表评论