Esempio n. 1
0
 protected void lnbRemoveImage_Click(object sender, EventArgs e)
 {
     MojoCube.Web.Payment.List list = new MojoCube.Web.Payment.List();
     list.GetData(int.Parse(ViewState["pk_Payment"].ToString()));
     list.ImagePath = string.Empty;
     list.UpdateData(list.pk_Payment);
     imgMain.Attributes.Add("style", "display:none");
     lnbRemoveImage.Visible = false;
 }
Esempio n. 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim() == "")
        {
            AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写标题");
            return;
        }

        MojoCube.Api.File.Upload upload = new MojoCube.Api.File.Upload();
        upload.FilePath = "Payment";
        upload.FileName = MojoCube.Api.Text.Function.DateTimeString(true);
        upload.DoFileUpload(fuImage);

        MojoCube.Web.Payment.List list = new MojoCube.Web.Payment.List();

        //修改
        if (ViewState["pk_Payment"] != null)
        {
            list.GetData(int.Parse(ViewState["pk_Payment"].ToString()));
            list.Title        = txtTitle.Text.Trim();
            list.Subtitle     = txtSubtitle.Text.Trim();
            list.TypeID       = int.Parse(ddlType.SelectedValue);
            list.Gateway      = txtGateway.Text.Trim();
            list.Service      = txtService.Text.Trim();
            list.Account      = txtAccount.Text.Trim();
            list.AppID        = txtAppID.Text.Trim();
            list.Secret       = txtSecret.Text.Trim();
            list.PartnerID    = txtPartnerID.Text.Trim();
            list.KeyCode      = txtKeyCode.Text.Trim();
            list.SignType     = txtSignType.Text.Trim();
            list.InputCharset = txtInputCharset.Text.Trim();
            list.Currency     = txtCurrency.Text.Trim();
            list.Rate         = MojoCube.Web.String.ToDecimal(txtRate.Text.Trim());
            list.Visible      = cbVisible.Checked;
            list.SortID       = MojoCube.Web.String.ToInt(txtSortID.Text.Trim());
            if (upload.IsUpload)
            {
                list.ImagePath = upload.OldFilePath;
                SetImage(list.ImagePath);
            }
            list.ModifyDate   = DateTime.Now.ToString();
            list.ModifyUserID = int.Parse(Session["UserID"].ToString());
            list.UpdateData(list.pk_Payment);
        }
        //新增
        else
        {
            list.Title        = txtTitle.Text.Trim();
            list.Subtitle     = txtSubtitle.Text.Trim();
            list.TypeID       = int.Parse(ddlType.SelectedValue);
            list.Gateway      = txtGateway.Text.Trim();
            list.Service      = txtService.Text.Trim();
            list.Account      = txtAccount.Text.Trim();
            list.AppID        = txtAppID.Text.Trim();
            list.Secret       = txtSecret.Text.Trim();
            list.PartnerID    = txtPartnerID.Text.Trim();
            list.KeyCode      = txtKeyCode.Text.Trim();
            list.SignType     = txtSignType.Text.Trim();
            list.InputCharset = txtInputCharset.Text.Trim();
            list.Description  = string.Empty;
            list.Currency     = txtCurrency.Text.Trim();
            list.Rate         = MojoCube.Web.String.ToDecimal(txtRate.Text.Trim());
            list.Visible      = cbVisible.Checked;
            list.SortID       = MojoCube.Web.String.ToInt(txtSortID.Text.Trim());
            if (upload.IsUpload)
            {
                list.ImagePath = upload.OldFilePath;
                SetImage(list.ImagePath);
            }
            else
            {
                list.ImagePath = string.Empty;
            }
            list.CreateDate         = DateTime.Now.ToString();
            list.CreateUserID       = int.Parse(Session["UserID"].ToString());
            list.ModifyDate         = DateTime.Now.ToString();
            list.ModifyUserID       = 0;
            ViewState["pk_Payment"] = list.InsertData();
        }

        AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功");
    }