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 _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 _LoadListBranch()
        {
            var db     = new BranchBusiness();
            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 result = db.BS_GetAllBranch(search, currentPage, 10);

            return(Content(JsonConvert.SerializeObject(new
            {
                data = result.Data,
                draw = draw,
                recordsFiltered = result.Total,
                recordsTotal = result.Total
            })));
        }
        public ActionResult EditBranch(int id)
        {
            var db     = new BranchBusiness();
            var result = db.BS_GetBranchByID(id);

            ViewBag.id = id;
            return(PartialView(result));
        }
 public CodigosController(MardisContext mardisContext,
                          RedisCache distributedCache,
                          ILoggerFactory _loggerFactory)
 {
     _taskCampaignBusiness     = new TaskCampaignBusiness(mardisContext, distributedCache);
     _BranchBusiness           = new BranchBusiness(mardisContext);
     _CodigoReservadosBusiness = new CodigoReservadosBusiness(mardisContext);
     _logger = _loggerFactory.CreateLogger("Mardis.Engine.Services");
 }
 public BranchController(UserManager <ApplicationUser> userManager,
                         IHttpContextAccessor httpContextAccessor,
                         MardisContext mardisContext,
                         ILogger <BranchController> logger,
                         ILogger <ServicesFilterController> loggeFilter,
                         IMemoryCache memoryCache,
                         RedisCache distributedCache)
     : base(userManager, httpContextAccessor, mardisContext, logger)
 {
     TableName             = CBranch.TableName;
     ControllerName        = CBranch.Controller;
     _cache                = memoryCache;
     _branchBusiness       = new BranchBusiness(mardisContext);
     _branchImageBusiness  = new BranchImageBusiness(mardisContext);
     _taskCampaignBusiness = new TaskCampaignBusiness(mardisContext, distributedCache);
     _countryBusiness      = new CountryBusiness(mardisContext, memoryCache);
     _provinceBusiness     = new ProvinceBusiness(mardisContext, memoryCache);
     _districtBusiness     = new DistrictBusiness(mardisContext);
     _parishBusiness       = new ParishBusiness(mardisContext);
     _sectorBusiness       = new SectorBusiness(mardisContext);
     _smsBusiness          = new SmsBusiness(mardisContext);
 }
 public OrdersController(MardisContext mardisContext)
 {
     _branchBusiness = new BranchBusiness(mardisContext);
     _mardisContext  = mardisContext;
 }