public ActionResult _EditBranch(int id = 0, string name = "", string add = "", string phone = "", string tax = "", string brandcode = "", string shortname = "", string city = "", bool status = false) { // kiểm tra quyền thêm sửa xóa của từng menu , nhớ truyền type tương ứng var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Update); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new BranchBusiness(); Branch item = new Branch(); item.Id = id; item.Name = name; item.AddressName = add; item.Phone = phone; item.Tax_Number = tax; item.Branch_code = brandcode; item.ShortName = shortname; item.City = city; item.is_active = Convert.ToInt32(status); var result = db.BS_EditBrandch(item); // luu log - sửa CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Update.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _EditUnit(string fullName, string note, int branchId = 0, int id = 0) { // kiểm tra quyền thêm sửa var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Update); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new quanlydonviBusiness(); tbl_Unit serviceCustomer = new tbl_Unit(); serviceCustomer.unit_name = fullName; serviceCustomer.description = note; serviceCustomer.id_center = branchId; serviceCustomer.id = id; var result = db.EditUnit(serviceCustomer); CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Update.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { log = "CapNhatThongTinDVT", newtdata = serviceCustomer }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult ChangeStatusBranch(int id, int status = 0) { // kiểm tra quyền thêm sửa xóa của từng menu , nhớ truyền type tương ứng var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Update); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new BranchBusiness(); Branch item = new Branch(); item.Id = id; item.is_active = status; var result = db.BS_ChangeStatusBranch(item); // luu log - sửa CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Update.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _ThemmoiSP(int id_product = 0, int id = 0) { // kiểm tra quyền thêm var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Addnew); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new ManagerCategoryBusiness(); tbl_detail_category item = new tbl_detail_category(); item.id_product = id_product; item.id_category = id; item.isactive = true; var result = db.AddProductToCategory(item); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _EditPage(FormCollection formCollection) { // kiểm tra quyền thêm sửa xóa của từng menu , nhớ truyền type tương ứng var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Update); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new gioithieuwebsiteBusiness(); tbl_gioithieu item = new tbl_gioithieu(); item.id = int.Parse(formCollection.Get("id")); item.noidung = formCollection.Get("noidung"); item.ngaychinhsua = DateTime.Now; item.tennguoisua = user.FullName; var result = db.BS_EditPage(item); // luu log - sửa CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Update.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _AddCategory(string fullName, string note, bool status = false) { // kiểm tra quyền thêm var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Addnew); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new ManagerCategoryBusiness(); tbl_LoaiSP serviceCustomer = new tbl_LoaiSP(); serviceCustomer.category_name = fullName; serviceCustomer.description = note; serviceCustomer.isactive = status; var result = db.AddCategory(serviceCustomer); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = serviceCustomer }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _AddNguonnhap(string fullName, string address, string phone, string code, string note, int branchId = 0) { // kiểm tra quyền thêm var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Addnew); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new quanlynguonnhapBusiness(); sys_nguonnhap serviceCustomer = new sys_nguonnhap(); serviceCustomer.tennguon = fullName; serviceCustomer.diachi = address; serviceCustomer.sdt = phone; serviceCustomer.code = code; serviceCustomer.description = note; serviceCustomer.isactive = true; serviceCustomer.id_center = branchId; var result = db.AddNguonnhap(serviceCustomer); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = serviceCustomer }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _AddCustomer(string fullName, string cmt, string birth, string address, string phone, string note, int branchId = 0) { // kiểm tra quyền thêm var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Addnew); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new CustomerBusiness(); service_customer serviceCustomer = new service_customer(); var getbrand = entity.Branch.FirstOrDefault(m => m.Id == branchId); serviceCustomer.fullname = fullName; serviceCustomer.id_card = cmt; serviceCustomer.address = address; serviceCustomer.mobile = phone; serviceCustomer.note = note; serviceCustomer.status = 1; serviceCustomer.id_center = branchId; serviceCustomer.code_center = getbrand.Branch_code; serviceCustomer.created_by = user.FullName; serviceCustomer.created_at = DateTime.Now; DateTime _birth; if (!string.IsNullOrEmpty(birth)) { if (!DateTime.TryParseExact(birth, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out _birth)) { SystemMessage systemMessage = new SystemMessage(); systemMessage.IsSuccess = false; systemMessage.Message = string.Format(SystemMessageConst.ValidateConst.DateIsNotValid, "Ngày sinh"); return(Json(new { result = systemMessage }, JsonRequestBehavior.AllowGet)); } serviceCustomer.birthday = _birth; } var result = db.AddCustomer(serviceCustomer); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = serviceCustomer }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _xuat_ban_daily(FormCollection formCollection) { // kiểm tra quyền thêm sửa var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Addnew); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } Add_Bill item = new Add_Bill(); item.type = "DL"; item.loaibill = 1; item.data = formCollection.Get("data"); item.billType = formCollection.Get("billType"); item.bonusTotal = long.Parse(formCollection.Get("bonusTotal")); item.total = long.Parse(formCollection.Get("total")); item.discount = long.Parse(formCollection.Get("discount")); item.billNumber = formCollection.Get("billNumber"); item.ngayxuat = formCollection.Get("ngayxuat"); item.nguoixuat = formCollection.Get("nguoixuat"); item.notebill = formCollection.Get("notebill"); item.tenkh = formCollection.Get("tenkh"); item.diachi = formCollection.Get("diachi"); item.nguoidaidien = formCollection.Get("nguoidaidien"); item.dienthoai = formCollection.Get("dienthoai"); item.id_center = user.BranchId; item.id_thaotac = user.Id; item.code_center = user.Code_brand; item.tennguoithaotac = user.FullName; var db = new xuat_dailyBusiness(); var result = db.AddBillProduct(item); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _NhapKho(int id_product = 0, int soluong = 0, int id_nguonnhap = 0, float tongtien = 0, string group_code_product = "", string ngaynhap = "", string mota = "") { // kiểm tra quyền thêm sửa xóa của từng menu , nhớ truyền type tương ứng var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Addnew); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new nhap_tonkhoBussiness(); sys_Nhap item = new sys_Nhap(); System.Globalization.CultureInfo enUS = new System.Globalization.CultureInfo("en-US"); DateTime n_n; DateTime.TryParseExact(ngaynhap, "dd/MM/yyyy", enUS, System.Globalization.DateTimeStyles.None, out n_n); double tb = 0; tb = Math.Round(tongtien / soluong, 0); item.id_product = id_product; item.soluong = soluong; item.id_nguonnhap = id_nguonnhap; item.tongtien = tongtien; item.group_code_product = group_code_product; item.ngaynhap = n_n; item.mota = mota; item.trangthai = true; item.nguoinhap = user.Id; item.id_center = user.BranchId; item.giatrungbinh = tb; var result = db.BS_NhapKho(item); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _EditCustomer(string fullName, string cmt, string birth, string address, string phone, string note, int branchId = 0, int id = 0) { // kiểm tra quyền thêm sửa var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Update); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new CustomerBusiness(); service_customer serviceCustomer = new service_customer(); serviceCustomer.fullname = fullName; serviceCustomer.id_card = cmt; serviceCustomer.address = address; serviceCustomer.mobile = phone; serviceCustomer.note = note; serviceCustomer.id_center = branchId; serviceCustomer.id = id; DateTime _birth; if (!string.IsNullOrEmpty(birth)) { if (!DateTime.TryParseExact(birth, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out _birth)) { SystemMessage systemMessage = new SystemMessage(); systemMessage.IsSuccess = false; systemMessage.Message = string.Format(SystemMessageConst.ValidateConst.DateIsNotValid, "Ngày sinh"); return(Json(new { result = systemMessage }, JsonRequestBehavior.AllowGet)); } serviceCustomer.birthday = _birth; } var result = db.EditCustomer(serviceCustomer); CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Update.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { log = "CapNhatThongTinKH", newtdata = serviceCustomer }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteUnit(int id) { // kiểm tra quyền thêm xóa var sys = CheckActiveMenu.ReturnActive(SystemMessageConst.TypeAction.Delete); if (sys.IsSuccess == false) { return(Json(new { result = sys }, JsonRequestBehavior.AllowGet)); } var db = new quanlydonviBusiness(); var result = db.DeleteUnitById(id); // luu log - xóa CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Delete.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = new { id = id } }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult Xoadonhang(int id_bill) { var db = new danhsachphieuxuatBusiness(); var result = db.BS_Huydonhang(id_bill, user.FullName); Add_Bill item = new Add_Bill(); item.id_center = user.BranchId; item.id_thaotac = user.Id; item.code_center = user.Code_brand; item.tennguoithaotac = user.FullName; item.id_bill = id_bill; item.data = "Hủy đơn hàng"; // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
// _Dell_Bill_Detail ham dung chung trong file banhang.js public ActionResult _Dell_Bill_Detail(FormCollection formCollection) { int id_bill_detail = int.Parse(formCollection.Get("id_bill_dt")); var db = new xuat_dailyBusiness(); var result = db.Xoasanphamkhoidonhang(id_bill_detail); Add_Bill item = new Add_Bill(); item.id_center = user.BranchId; item.id_thaotac = user.Id; item.code_center = user.Code_brand; item.tennguoithaotac = user.FullName; item.id_bill_detail = id_bill_detail; item.data = "Xóa sản phẩm khỏi bill"; // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _AddNewContact(string hoten = "", string diachi = "", string email = "", string sdt = "", string tieude = "Không có tiêu đề", string noidung = "") { var db = new LienheBusiness(); tbl_lienhe item = new tbl_lienhe(); item.hoten = hoten; item.diachi = diachi; item.dienthoai = sdt; item.email = email; item.tieude = tieude; item.noidung = noidung; item.trangthai = 0; item.ngaygui = DateTime.Now; var result = db.BS_AddNewContact(item); // luu log - thêm mới CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Create.ToString(), result.IsSuccess, JsonConvert.SerializeObject(new { data = item }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public ActionResult _XemLichSuNhapHang(int id_product) { int minRow = 0; int maxRow = 0; int.TryParse(HttpContext.Request["start"], out minRow); int length = 10; int.TryParse(HttpContext.Request["length"], out length); maxRow = (minRow + length); int draw = 0; int.TryParse(HttpContext.Request["draw"], out draw); string search = HttpContext.Request["search[value]"].Trim(); int currentPage = (minRow / 10) + 1; var db = new nhap_tonkhoBussiness(); var result = db.LoadLichSu_Nhap(search, currentPage, 10, id_product); // luu log - xem báo cáo var name = Env.GetUserInfo("name"); CheckRuleAndSaveLog.ReturnCheckRuleAndSaveLog(DbLogType.Visit.ToString(), true, JsonConvert.SerializeObject(new { data = new { type = "Xem lịch sử", nguoitao = name } }, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); return(Content(JsonConvert.SerializeObject(new { data = result.Data, draw = draw, recordsFiltered = result.Total, recordsTotal = result.Total }))); }