protected void btn_Save_Click(object sender, EventArgs e)
        {
            if (imgName.HasFile)
            {
                if (!Library.FileLib.isPicByFileName(imgName.PostedFile.FileName))
                {
                    Library.Script.ClientMsg("无效的图片,请重新选择.");
                    return;
                }
            }

            PartnerEntity cat = new PartnerEntity();
            cat.Title = txtTitle.Text;
            cat.Abbr = txtAbs.Text;
            cat.Description = txtDesc.Text;
            int sort = 0;
            int.TryParse(txt_Sort.Text, out sort);
            cat.Sort = sort;
            cat.IsShow = chx_isShow.Checked;
            cat.AdminId = logic.sysAdmin.AdminID;
            cat.Url = txtURL.Text;
            if (id != 0)
            {
                if (imgName.HasFile)
                {
                    if (hdCurrentImageFileName.Value != "")
                    {
                        try
                        {
                            Library.FileLib.Del(Library.Resource.UploadPath + Library.Resource.FileOriginal + "/" + hdCurrentImageFileName.Value);
                        }
                        catch
                        {
                        }
                    }
                    cat.ImgName = Library.ImgLib.getUploadFilenameNotMakeThumb(imgName.PostedFile);
                }
                else
                {
                    cat.ImgName = hdCurrentImageFileName.Value;
                }

                cat.Pid = id;
                logic.partner.update(cat);
            }
            else
            {
                if (imgName.HasFile)
                {
                    cat.ImgName = Library.ImgLib.getUploadFilenameNotMakeThumb(imgName.PostedFile);
                }
                logic.partner.insert(cat);

            }

            Library.Script.ClientMsgUrl("保存成功!", "partnerList.aspx");
        }
Beispiel #2
0
 public static void insert(PartnerEntity partner)
 {
     DbHelper.ExecuteNonQuery("p_Partner_insert",
         partner.AdminId,
         partner.Title,
         partner.Abbr,
         partner.Description,
         partner.ImgName,
         partner.Url,
         partner.Sort,
         partner.IsShow
     );
 }
Beispiel #3
0
 public static PartnerEntity getById(int pid)
 {
     DataRow dr = DbHelper.ExecuteDataRow("p_partner_getById", pid);
     PartnerEntity partner = new PartnerEntity();
     if (dr != null)
     {
         partner.Pid = int.Parse(dr["pid"].ToString());
         partner.AdminId = int.Parse(dr["adminId"].ToString());
         partner.Title = dr["title"].ToString();
         partner.Abbr = dr["abbr"].ToString();
         partner.Description = dr["description"].ToString();
         partner.ImgName = dr["imgName"].ToString();
         partner.Url = dr["url"].ToString();
         partner.Sort = Convert.ToInt32(dr["sort"]);
         partner.IsShow = Convert.ToBoolean(dr["isShow"]);
         partner.InputDt = DateTime.Parse(dr["inputDt"].ToString());
     }
     return partner;
 }
Beispiel #4
0
 public static void update(PartnerEntity partner)
 {
     Partner.update(partner);
 }
Beispiel #5
0
 public static void insert(PartnerEntity partner)
 {
     Partner.insert(partner);
 }