public ActionResult Addrq() { ValidateRequest = false; string a = Request.QueryString["a"]; if (Session["giohang"]== null) { Response.Write("Ban chua lua chon san pham !"); } else { List<Request_Stationery> ls = new List<Request_Stationery>(); foreach( GiohangModel gm in (List<GiohangModel>)Session["giohang"] ) { Request_Stationery s = new Request_Stationery(); s.ProductId = gm.Productid; s.Quantity = gm.Soluong; ls.Add(s); } string chuoi = ""; Employee el = (Employee)Session["Employee"];//form Request_StationeryModel rsm = new Request_StationeryModel(); Request r = new Request(); string[] kq = a.Split('|'); chuoi += kq[0] + kq[1] + kq[2]; r.RequestName = kq[0]; r.RequestContent = kq[1]; r.Description = kq[2]; r.DateDispatch = DateTime.Now; r.Accept = true; r.State = "1"; r.CatalogRQId = Convert.ToInt32(kq[3]); r.EmployeeNumber = el.EmployeeNumber; rsm.inserdata(r); int a1 = r.RequestId; foreach( Request_Stationery r1 in ls ) { r1.RequestId = a1; rsm.insert2(r1); } Response.Write(ls.Count); RequestModel rm = new RequestModel(); string ixep = el.RegistrationNumber; Employee xep = rsm.informationxep(ixep); DataClassesStationeryDataContext dtdc = new DataClassesStationeryDataContext(); Config c1 = dtdc.Configs.First(); if (rm.Send(el.Email, xep.Email, kq[0], kq[1], c1.Type,Convert.ToInt32(c1.Ports), c1.MailNetwork, c1.Password)) { Redirect("Default1/MyRequest10"); } } return null; }
public ActionResult test() { DataClassesStationeryDataContext dtdc = new DataClassesStationeryDataContext(); ViewModel vm = new ViewModel(); if (Session["Employee"] == null) { return RedirectToAction("Login", "Default1"); } return View(); }
//mo ve view Request public ActionResult Index() { DataClassesStationeryDataContext dtdc = new DataClassesStationeryDataContext(); ViewModel vm = new ViewModel(); if(Session["Employee"]==null) { return RedirectToAction("Login" , "Default1"); } ViewData["sanpham"] = s.ListStationery(); CatalogeModel clm = new CatalogeModel(); ViewData["dsachcata"] = clm.Listcataloge(); ViewData["count"] = s1.count(); return View(); }