Пример #1
0
        protected void gv_ChinhSach_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row             = gv_ChinhSach.Rows[e.RowIndex];
            string      chinhSachID     = gv_ChinhSach.DataKeys[e.RowIndex].Value.ToString();
            TextBox     edit_tb_noiDung = row.FindControl("edit_tb_noiDung") as TextBox;
            RadioButton edit_opt1       = row.FindControl("edit_opt1") as RadioButton;

            ChinhSach cs = new ChinhSach();

            cs.Id              = int.Parse(chinhSachID);
            cs.NoiDung         = edit_tb_noiDung.Text;
            cs.ChinhSachApDung = edit_opt1.Checked ? 1 : 0;
            cs.ShopWatch_id    = int.Parse(FV_ShopWatch.DataKey.Value.ToString());

            try
            {
                if (b.UpdateChinhSach(cs))
                {
                    gv_ChinhSach.ShowFooter = true;
                    gv_ChinhSach.EditIndex  = -1;
                    this.fetchDataToChinhSachGridView();
                }
            }
            catch (Exception ex)
            {
                this.errorAlert(ex.Message);
            }
        }
Пример #2
0
        public ActionResult Chinhsach(int id)
        {
            //var chinhsach = from chs in data.ChinhSaches
            //                select chs;
            ChinhSach chinhsach = data.ChinhSaches.SingleOrDefault(m => m.MaKhachSan == id);

            return(PartialView(chinhsach));
        }
Пример #3
0
        private void navBarItem11_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            panelControl1.Controls.Clear();
            ChinhSach cs = new ChinhSach();

            cs.Dock = DockStyle.Fill;
            panelControl1.Controls.Add(cs);
            btnSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
        }
        public ActionResult ChiTietChinhSach(int?id)
        {
            ChinhSach cs = db.ChinhSaches.SingleOrDefault(n => n.MaChinhSach == id);

            if (cs == null)
            {
                return(HttpNotFound());
            }
            return(View(cs));
        }
Пример #5
0
 public bool UpdateChinhSach(ChinhSach _cs)
 {
     try
     {
         return(dal.UpdateChinhSach(_cs));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #6
0
 public int InsertChinhSach(ChinhSach _cs)
 {
     try
     {
         return(dal.InsertChinhSach(_cs));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
        public ActionResult ChinhSuaCS(int?id)
        {
            //lấy sản phẩm theo id ra để chỉnh sửa
            if (id == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            ChinhSach cs = db.ChinhSaches.SingleOrDefault(n => n.MaChinhSach == id);

            if (cs == null)
            {
                return(HttpNotFound());
            }

            return(View(cs));
        }
Пример #8
0
 public static Dictionary <string, object> InsertNewRecord(string noi_dung, string chinh_sach, string shopWatchID)
 {
     try
     {
         var       responseData = new Dictionary <string, object>();
         ChinhSach cs           = new ChinhSach();
         cs.NoiDung         = noi_dung;
         cs.ChinhSachApDung = int.Parse(chinh_sach);
         cs.ShopWatch_id    = int.Parse(shopWatchID);
         responseData.Add("status_code", staticBus.InsertChinhSach(cs));
         responseData.Add("message", "Thêm mới thành công");
         return(responseData);
     }
     catch (Exception e)
     {
         var exception = new Dictionary <string, object>();
         exception.Add("status_code", 0);
         exception.Add("message", e.Message);
         return(exception);
     }
 }
Пример #9
0
        private void label7_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ChinhSach cs = new ChinhSach();

            cs.Show();
        }
 public ActionResult ChinhSuaCS(ChinhSach model)
 {
     db.Entry(model).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("QuanLyChinhSach"));
 }