protected void btnok_Click(object sender, EventArgs e)
    {
        string strPath = Server.MapPath("\\ScenicImg");
        string savefilename = "";
        if (fuwj.HasFile)
        {
            string fileExt = System.IO.Path.GetExtension(fuwj.FileName);
            if (fileExt == ".jpg" || fileExt == ".gif" || fileExt == ".png")
            {
                try
                {
                    var filename = DateTime.Now.ToString("MMddhhmmss") + DateTime.Now.Millisecond.ToString() + fileExt;
                    savefilename = filename;
                    fuwj.SaveAs(strPath + "\\" + filename);
                }
                catch
                {

                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "alert('只允许上传jpg,gif,png格式的文件');", true);
                return;
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "alert('请选择上传的文件');", true);
            return;
        }

        Model.ScenicAdmin user = new BLL.BLLMembership().GetScenicAdmin((Guid)CurrentUser.ProviderUserKey);
        Model.Scenic scenic = user.Scenic;
        ContractImg ci = new ContractImg();
        ci.Imgloc = savefilename;
        ci.Scenic = scenic;
        if (bllscenic.GetContractImg(scenic.Id) != null)
        {
            ci.Id = bllscenic.GetContractImg(scenic.Id).Id;
        }
        ci.ScenicModule = ScenicModule.SellOnLine;
        bllscenic.UploadContractImg(ci);
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string paramId = Request["id"];
        int scenicId;
        if (!int.TryParse(paramId, out scenicId))
        {
            ErrHandler.Redirect(ErrType.ParamIllegal);
        }
        scenic = bllScenic.GetScenicById(scenicId);
        contractimg = bllScenic.GetContractImg(scenic.Id);
        BindPrice();
        //lblyj.Text = bllticketprice.GetTicketPriceByScenicandtypeid(scenic.Id, 1).Price.ToString("0");
        //lblydj.Text = bllticketprice.GetTicketPriceByScenicandtypeid(scenic.Id, 2).Price.ToString("0");
        //lblyhj.Text = bllticketprice.GetTicketPriceByScenicandtypeid(scenic.Id, 3).Price.ToString("0");
        if (contractimg!=null)
            ContractImg.ImageUrl = "/ScenicImg/" + contractimg.Imgloc;

        if (!IsPostBack)
        {
            LoadOnLineCheck();
        }
    }
Beispiel #3
0
 public void UploadContractImg(ContractImg contractimg)
 {
     IScenic.UploadContractImg(contractimg);
 }
Beispiel #4
0
 public void UploadContractImg(ContractImg contractimg)
 {
     session.Flush();
     session.Clear();
     session.SaveOrUpdate(contractimg);
     session.Flush();
 }