Ejemplo n.º 1
0
        public void InsertChildItem(ListItem loaitincha, List <AdminLoaiTinInfo> list)
        {
            AdminLoaiTinController control = new AdminLoaiTinController();
            AdminLoaiTinInfo       Info    = control.GetAdminLoaiTins(int.Parse(loaitincha.Value));

            string[] s = loaitincha.Text.Split(' ');
            foreach (AdminLoaiTinInfo loaitin in list)
            {
                if (loaitin.Cha != 0)
                {
                    if (loaitin.Cha == int.Parse(loaitincha.Value))
                    {
                        ListItem childNode = new ListItem();
                        childNode.Value = loaitin.ID.ToString();
                        if (Info.Cha != 0)
                        {
                            childNode.Text = s[0] + "--- " + loaitin.Ten;
                        }
                        else
                        {
                            childNode.Text = "--- " + loaitin.Ten;
                        }
                        this.ddlLoaiTin.Items.Add(childNode);
                        InsertChildItem(childNode, list);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void LoadData()
 {
     if (Request["action"] != null)
     {
         AdminLoaiTinController control = new AdminLoaiTinController();
         AdminLoaiTinInfo       cv      = control.GetAdminLoaiTins(int.Parse(Request["action"]));
         this.tbxTieuDe.Text            = cv.Ten;
         this.tbxCha.Text               = cv.Cha.ToString();
         this.tbxThuTu.Text             = cv.ThuTu.ToString();
         this.ddlNguonTin.SelectedValue = cv.NguonTin.ToString();
         this.ddlNgonNgu.SelectedValue  = cv.Lang;
         this.cbxTinhTrang.Checked      = cv.TinhTrang;
     }
 }
Ejemplo n.º 3
0
        protected void lbtnGhiLai_Click(object sender, EventArgs e)
        {
            AdminLoaiTinController control = new AdminLoaiTinController();

            // UPDATE
            if (Request["action"] != null)
            {
                AdminLoaiTinInfo cv = control.GetAdminLoaiTins(int.Parse(Request["action"]));

                cv.Ten       = this.tbxTieuDe.Text.Trim();
                cv.Cha       = Convert.ToInt32(this.tbxCha.Text.Trim());
                cv.ThuTu     = Convert.ToInt32(this.tbxThuTu.Text.Trim());
                cv.NgayTao   = DateTime.Now;
                cv.NguonTin  = Convert.ToInt32(this.ddlNguonTin.SelectedValue.Trim());
                cv.Lang      = this.ddlNgonNgu.SelectedValue.Trim();
                cv.TinhTrang = this.cbxTinhTrang.Checked;

                try
                {
                    control.UpdateAdminLoaiTin(cv);
                    this.lblThongBao.Text = "Ghi lại thành công";
                }
                catch (Exception ex)
                {
                    this.lblThongBao.Text = "Có lỗi: " + ex.ToString();
                }
            }
            else // INSERT
            {
                AdminLoaiTinInfo cv = new AdminLoaiTinInfo();

                cv.Ten       = this.tbxTieuDe.Text.Trim();
                cv.Cha       = Convert.ToInt32(this.tbxCha.Text.Trim());
                cv.ThuTu     = Convert.ToInt32(this.tbxThuTu.Text.Trim());
                cv.NgayTao   = DateTime.Now;
                cv.NguonTin  = Convert.ToInt32(this.ddlNguonTin.SelectedValue.Trim());
                cv.Lang      = this.ddlNgonNgu.SelectedValue.Trim();
                cv.TinhTrang = this.cbxTinhTrang.Checked;
                try
                {
                    control.AddAdminLoaiTin(cv);
                    this.lblThongBao.Text = "Ghi lại thành công";
                }
                catch (Exception ex)
                {
                    this.lblThongBao.Text = "Có lỗi: " + ex.ToString();
                }
            }
        }
Ejemplo n.º 4
0
 protected void gvAdminLoaiTin_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteLoaiTin")
     {
         int loaitinid = Convert.ToInt32(e.CommandArgument);
         AdminLoaiTinController control = new AdminLoaiTinController();
         AdminLoaiTinInfo       loaitin = control.GetAdminLoaiTins(loaitinid);
         if (loaitin != null)
         {
             try
             {
                 control.DeleteAdminLoaiTin(loaitinid);
                 this.lblThongBao.Text = "Loại tin đã xóa thành công.";
                 LoadList();
             }
             catch (Exception ex)
             {
                 Exceptions.ProcessModuleLoadException(this, ex);
                 this.lblThongBao.Text = "Loại tin đã xóa không thành công.";
             }
         }
     }
 }