示例#1
0
        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;
            }
        }
示例#2
0
        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);
        }