public ActionResult Index(NhaCungCap ncc, string moTa, HttpPostedFileBase file)
        {
            var tk = Session["TaiKhoan"] as KhachHang;

            if (tk == null)
            {
                return(View("../Login/Index"));
            }
            else
            {
                if (tk.LoaiTK != "Admin")
                {
                    return(View("../Home/Index"));
                }
                else
                {
                    if (Session["UpdateNCC"] == null)
                    {
                        var db = new NhaCungCapDAO();
                        db.InsertNCC(ncc, moTa, file);
                        Session["ListNCC"] = null;
                        return(RedirectToAction("Reset", "NhaCungCap", new { area = "Admin" }));
                    }
                    else
                    {
                        var db   = new NhaCungCapDAO();
                        var ncc1 = Session["UpdateNCC"] as NhaCungCap;
                        db.UpdateNCC(ncc1.IdNCC, ncc, moTa, file);
                        Session["UpdateNCC"] = null;
                        Session["ListNCC"]   = null;
                        return(RedirectToAction("Reset", "NhaCungCap", new { area = "Admin" }));
                    }
                }
            }
        }
Esempio n. 2
0
        private void btnThemNCC_Click(object sender, EventArgs e)
        {
            NHACUNGCAP n = new NHACUNGCAP();

            n.TEN    = txtTenNCC.Text;
            n.DIACHI = txtDiaChiNCC.Text;
            n.SDT    = txtSdtNCC.Text;
            nccDAO.InsertNCC(n);
            txtTenNCC.Text    = "";
            txtDiaChiNCC.Text = "";
            txtSdtNCC.Text    = "";
            MessageBox.Show("Thêm thành công!");
            setCBB_HSX_NCC_Source();
        }
Esempio n. 3
0
 public static void InsertNCC(NhaCungCapDTO ncc)
 {
     NhaCungCapDAO.InsertNCC(ncc);
 }