protected void ButtonUpdate_Click(object sender, EventArgs e) { string softName = TextBox_Name.Text.Trim(); string softPrice = TextBox_Price.Text.Trim(); string freeTime = TextBox_Time.Text.Trim(); softPrice = ScTool.FormatPrice(softPrice, 2); // 对金额进行格式化 bool isAuthor = UserType == 2 ? true : SoftInfo.IsAuthor(DB, softName, author); if (isAuthor) { string ext = "msg()msg;freeTimes(" + freeTime + ")freeTimes;author(" + LabelAccount.Text + ")author"; string result = SoftInfo.Update2(DB, softName, softPrice, "", "", ext); if (result.Equals("success")) { Label_tip.Text = "已修改!" + result; } else { Label_tip.Text = "修改失败!" + result; } showTable(DivTable.Controls, DB, TAB, author, UserType); } else { Label_tip.Text = "修改失败!" + "您当前没有软件:" + softName; } }
protected void ButtonDelet_Click(object sender, EventArgs e) { string softName = TextBox_Name.Text.Trim(); bool isAuthor = UserType == 2 ? true : SoftInfo.IsAuthor(DB, softName, author); if (isAuthor) { bool result = SoftInfo.Delet2(DB, softName); Label_tip.Text = result ? "已删除!" : "删除失败!"; showTable(DivTable.Controls, DB, TAB, author, UserType); } else { Label_tip.Text = "删除失败!" + "您当前没有软件:" + softName; } }
protected void ButtonAdd_Click(object sender, EventArgs e) { string softName = TextBox_Name.Text.Trim(); string softPrice = TextBox_Price.Text.Trim(); string freeTime = TextBox_Time.Text.Trim(); softPrice = ScTool.FormatPrice(softPrice, 2); // 对金额进行格式化 string ext = "msg()msg;freeTimes(" + freeTime + ")freeTimes;author(" + LabelAccount.Text + ")author"; string result = SoftInfo.Add(DB, softName, softPrice, "", "", ext); if (!result.Equals("") && !result.StartsWith("fail")) { Label_tip.Text = "已添加!" + result; } else { Label_tip.Text = "添加失败!" + result; } showTable(DivTable.Controls, DB, TAB, author, UserType); }
protected void Page_Load(object sender, EventArgs e) { UserType = UserTool.UserType(Session); // 获取当前登录的用户类型信息 author = Request["p"]; if (author == null || author.Equals("")) { author = UserTool.GetAccount(Session); // 获取登录的用户名 } if (author != null && !author.Equals("")) { LabelAccount.Text = author; DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); SoftInfo.confirmOrderTab(DB); showTable(DivTable.Controls, DB, TAB, author, UserType); } }