示例#1
0
 private void initControl(int Id)
 {
     if (Id > 0)
     {
         btn_add.Visible = false;
         btn_edit.Visible = true;
         try
         {
             AdvBSO advBSO = new AdvBSO();
             Adv adv = advBSO.GetAdvById(Id);
             hddAdvID.Value = Convert.ToString(adv.AdvID);
             hddAdvImageThumb.Value = adv.AdvImage;
             uploadPreview.Src = ResolveUrl("~/Upload/Advertising/") + adv.AdvImage;
             txtAdvUrl.Text = adv.AdvUrl;
             txtAdvWidth.Text = Convert.ToString(adv.AdvWidth);
             txtAdvHeight.Text = Convert.ToString(adv.AdvHeight);
             rdbAdvStatus.SelectedValue = Convert.ToString(adv.AdvStatus);
         }
         catch (Exception ex)
         {
             clientview.Text = ex.Message.ToString();
         }
     }
     else
     {
         btn_add.Visible = true;
         btn_edit.Visible = false;
     }
 }
示例#2
0
 private void ViewLogo()
 {
     AdvBSO advBSO = new AdvBSO();
     DataTable table = advBSO.GetAdvAll();
     commonBSO commonBSO = new commonBSO();
     commonBSO.FillToGridView(grvAdv, table);
 }
示例#3
0
 protected void grvAdv_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     int Id = Convert.ToInt32(e.CommandArgument.ToString());
     string cName = e.CommandName.ToLower();
     switch (cName)
     {
         case "_edit":
             Response.Redirect("~/Admin/editadv/" + Id + "/Default.aspx");
             break;
         case "_delete":
             AdvBSO advBSO = new AdvBSO();
             advBSO.DeleteAdv(Id);
             ViewLogo();
             break;
     }
 }
示例#4
0
 protected void btn_add_Click(object sender, EventArgs e)
 {
     try
     {
         Adv adv = ReceiveHtml();
         if (String.IsNullOrEmpty(adv.AdvImage))
         {
             clientview.Text = String.Format(Resources.StringAdmin.CheckImage);
         }
         else
         {
             AdvBSO advBSO = new AdvBSO();
             advBSO.CreateAdv(adv);
             clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
         }
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }