Ejemplo n.º 1
0
        public bool Update(zstftModel M)
        {
            int row = 0;

            try
            {
                string         sql   = "update zstft set Category=@Category,Address=@Address,Picture=@Picture,LogName=@LogName,Remark=@Remark,Title=@Title,ProvinceName=@ProvinceName,Sort=@Sort where Id=@Id";
                SqlParameter[] Paras = new SqlParameter[] {
                    new SqlParameter("@Category", SqlDbType.VarChar, 50),
                    new SqlParameter("@Address", SqlDbType.VarChar, 200),
                    new SqlParameter("@LogName", SqlDbType.VarChar, 50),
                    new SqlParameter("@Picture", SqlDbType.VarChar, 200),
                    new SqlParameter("@Remark", SqlDbType.VarChar, 500),
                    new SqlParameter("@Title", SqlDbType.VarChar, 200),
                    new SqlParameter("@ProvinceName", SqlDbType.VarChar, 50),
                    new SqlParameter("@Sort", SqlDbType.Int),
                    new SqlParameter("@Id", SqlDbType.Int, 4)
                };

                Paras[0].Value = M.Category;
                Paras[1].Value = M.Address;
                Paras[2].Value = M.LogName;
                Paras[3].Value = M.Picture;
                Paras[4].Value = M.Remark;
                Paras[5].Value = M.Title;
                Paras[6].Value = M.ProvinceName;
                Paras[7].Value = M.Sort;
                Paras[8].Value = M.Id;
                row            = crm.ExecuteSql(sql, Paras);
                if (row > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        public bool Add(zstftModel M)
        {
            int row = 0;

            try
            {
                string         sql   = "insert into zstft(Title,Category,Address,LogName,PublishTime,Picture,Remark,ProvinceName,Sort) values(@Title,@Category,@Address,@LogName,@PublishTime,@Picture,@Remark,@ProvinceName,@Sort)";
                SqlParameter[] Paras = new SqlParameter[] {
                    new SqlParameter("@Title", SqlDbType.VarChar, 200),
                    new SqlParameter("@Category", SqlDbType.VarChar, 50),
                    new SqlParameter("@Address", SqlDbType.VarChar, 200),
                    new SqlParameter("@LogName", SqlDbType.VarChar, 50),
                    new SqlParameter("@PublishTime", SqlDbType.DateTime),
                    new SqlParameter("@Picture", SqlDbType.VarChar, 200),
                    new SqlParameter("@Remark", SqlDbType.VarChar, 500),
                    new SqlParameter("@ProvinceName", SqlDbType.VarChar, 50),
                    new SqlParameter("@Sort", SqlDbType.Int)
                };
                Paras[0].Value = M.Title;
                Paras[1].Value = M.Category;
                Paras[2].Value = M.Address;
                Paras[3].Value = M.LogName;
                Paras[4].Value = M.PublishTime;
                Paras[5].Value = M.Picture;
                Paras[6].Value = M.Remark;
                Paras[7].Value = M.ProvinceName;
                Paras[8].Value = M.Sort;
                row            = crm.ExecuteSql(sql, Paras);
                if (row > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }
Ejemplo n.º 3
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        string     ErrorMsg    = "";
        string     strFileName = "";
        zstftModel M           = new zstftModel();

        M.Id           = Convert.ToInt32(Request.QueryString["Id"]);
        M.Title        = txtTitle.Value.Trim();
        M.Address      = txtAddress.Value.Trim();
        M.Category     = txtCategory.SelectedValue;
        M.ProvinceName = Province.SelectedValue;
        M.Sort         = (String.IsNullOrEmpty(txtSort.Value.Trim())) ? 0 : Convert.ToInt32(txtSort.Value.Trim());
        M.LogName      = bp.LoginName;
        M.PublishTime  = DateTime.Now;
        M.Remark       = txtRemark.Value.Trim();
        HttpPostedFile Files = HttpContext.Current.Request.Files[0];

        strFileName = Regex.Match(this.Img.ImageUrl, @"[0-9]*?\.(jpg|gif|png)").Value;
        if (Files.FileName != "")
        {
            strFileName = GetSaveImgPath(ViewState["Category"].ToString()) + strFileName;
            strFileName = Tz888.BLL.zstft.UpFile.SaveFile(Files, GetSaveImgPath(M.Category), ref ErrorMsg, 500, "jpg|gif|png", 1, strFileName, 155, 116);
        }

        if (strFileName == "" && ErrorMsg != "")
        {
            Tz888.Common.MessageBox.Show(this.Page, ErrorMsg);
        }
        else
        {
            M.Picture = strFileName;
            if (bll.Update(M))
            {
                Tz888.Common.MessageBox.ShowAndHref("修改成功!", "Managezstft.aspx");
            }
            else
            {
                Tz888.Common.MessageBox.Show(this.Page, "修改失败!");
            }
        }
    }
Ejemplo n.º 4
0
    protected void BtnSvae_Click(object sender, EventArgs e)
    {
        string     ErrorMsg    = "";
        string     strFileName = "";
        zstftModel M           = new zstftModel();

        M.Title        = txtTitle.Value.Trim();
        M.Address      = txtAddress.Value.Trim();
        M.Category     = txtCategory.SelectedValue;
        M.ProvinceName = Province.SelectedValue;
        M.LogName      = bp.LoginName;
        M.Sort         = (String.IsNullOrEmpty(txtSort.Value.Trim())) ? 0 : Convert.ToInt32(txtSort.Value.Trim());
        M.PublishTime  = DateTime.Now;
        M.Remark       = txtRemark.Value.Trim();
        HttpPostedFile Files = HttpContext.Current.Request.Files[0];

        if (Files.FileName != "")
        {
            strFileName = Tz888.BLL.zstft.UpFile.SaveFile(Files, GetImgPath(M.Category), ref ErrorMsg, 500, "jpg|gif|png", 0, "", 155, 116);
        }
        if (strFileName != "" && ErrorMsg != "")
        {
            Tz888.Common.MessageBox.Show(this.Page, ErrorMsg);
        }
        else
        {
            M.Picture = strFileName;
            if (bll.Add(M))
            {
                Tz888.Common.MessageBox.ShowAndHref("添加成功!", "Managezstft.aspx");
            }
            else
            {
                Tz888.Common.MessageBox.Show(this.Page, "添加失败!");
            }
        }
    }
Ejemplo n.º 5
0
 public bool Update(zstftModel M)
 {
     return(dal.Update(M));
 }
Ejemplo n.º 6
0
 public bool Add(zstftModel M)
 {
     return(dal.Add(M));
 }