public void xoaCauHinhEmail(string id, string userId) { try { if (string.IsNullOrEmpty(id)) { Clients.Caller.DeletedResult(false); } else { var dv = xlDonVi.Doc(id); dv.CauHinhEmail = new CauHinhEmail(); dv.IdNguoiCapNhat = userId; Clients.Caller.DeletedResult(xlDonVi.CapNhat(dv)); } } catch (Exception) { Clients.Caller.DeletedResult(false); } }
public ActionResult ChinhSua(FormCollection collection) { if (SessionManager.CheckSession(ConstantValues.SessionKeyCurrentUser)) { if (!string.IsNullOrEmpty(collection["save"].ToString())) { string id = collection["donViId"].ToString(); if (string.IsNullOrEmpty(id)) { return(RedirectToAction("Index", "DonVi")); } var model = new DonViModel(); DonVi donVi = xlDonVi.Doc(id); model.DonViHienTai = donVi; if (donVi == null) { return(RedirectToAction("Index", "DonVi")); } NotifyModel thongBao = new NotifyModel(); try { var user = (NguoiDung)SessionManager.ReturnSessionObject(ConstantValues.SessionKeyCurrentUser); donVi.Ten = collection["ten"].ToString(); donVi.DiaChi = collection["diaChi"].ToString(); donVi.DienThoai = collection["dienThoai"].ToString(); donVi.Email = collection["email"].ToString(); donVi.Fax = collection["fax"].ToString(); //donVi.HoTenLanhDao = collection["hoTenLanhDao"].ToString(); //donVi.DienThoaiLanhDao = collection["dienThoaiLanhDao"].ToString(); //donVi.EmailLanhDao = collection["emailLanhDao"].ToString(); if (collection["donViTrucThuoc"].ToString() == "0") { donVi.IdDonViTrucThuoc = "0"; donVi.Cap = 1; } else { var dvTrucThuoc = xlDonVi.Doc(collection["donViTrucThuoc"].ToString()); donVi.IdDonViTrucThuoc = dvTrucThuoc.Id.ToString(); donVi.Cap = dvTrucThuoc.Cap + 1; } donVi.IdNguoiCapNhat = user.Id.ToString(); HttpPostedFileBase file = Request.Files["logoDonVi"]; if (file.FileName != null && file.FileName != "") { if (file.ContentLength > 0) { string savedFileName = ""; string savedFilePath = UploadFile.getFullFilePath(UploadFile.DonViDirectory, file.FileName, out savedFileName); file.SaveAs(savedFilePath); donVi.Logo = "/" + UploadFile.DonViDirectory + savedFileName; } } if (xlDonVi.CapNhat(donVi)) { thongBao.TypeNotify = "alert-success"; thongBao.Message = "Cập nhật thông tin thành công"; } else { thongBao.TypeNotify = "alert-danger"; thongBao.Message = "Cập nhật thông tin thất bại!"; } } catch (Exception) { thongBao.TypeNotify = "alert-danger"; thongBao.Message = "Cập nhật thông tin thất bại!"; } ViewBag.ThongBao = thongBao; model.DanhSachDonVi = xlDonVi.DocDanhSachTuDonViCha(currentUser.IdDonVi, (bool)Session[ConstantValues.SessionKeyVaiTro]); return(View("ChinhSua", model)); } return(RedirectToAction("Index", "DonVi")); } if (Request.Url != null) { SessionManager.RegisterSession(ConstantValues.SessionKeyUrl, Request.Url.AbsolutePath); } return(RedirectToAction("Index", "Login")); }