Beispiel #1
0
 public ActionResult Location_Search(string p_keysearch, int p_CurrentPage)
 {
     try
     {
         decimal _total_record = 0;
         string  p_to          = "";
         string  p_from        = CommonFuc.Get_From_To_Page(p_CurrentPage, ref p_to);
         if (p_keysearch == "" || p_keysearch == null)
         {
             p_keysearch = "ALL";
         }
         LocationBL          _bl  = new LocationBL();
         List <LocationInfo> _lst = _bl.Location_Search(p_keysearch, ref _total_record, p_from, p_to);
         string htmlPaging        = NaviCommon.CommonFuc.Get_HtmlPaging <LocationInfo>((int)_total_record, p_CurrentPage, "tỉnh/ thành");
         ViewBag.Paging    = htmlPaging;
         ViewBag.List      = _lst;
         ViewBag.SumRecord = _total_record;
         return(PartialView("~/Areas/ModuleBaseData/Views/Location/_Partial_ListLocation.cshtml"));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(PartialView("~/Areas/ModuleBaseData/Views/Location/_Partial_ListLocation.cshtml"));
     }
 }
 public ManagerMenu(LocationBL locationBL, OrderBL orderBL, InventoryBL inventoryBL, CustomerBL customerBL)
 {
     this.locationBL  = locationBL;
     this.orderBL     = orderBL;
     this.inventoryBL = inventoryBL;
     this.customerBL  = customerBL;
 }
Beispiel #3
0
 public InventoryMenu(LocationBL locBL, ProductBL prodBL, OrderBL orderBL, CustomerBL customerBL)
 {
     _locBL      = locBL;
     _prodBL     = prodBL;
     _orderBL    = orderBL;
     _customerBL = customerBL;
 }
Beispiel #4
0
        public ActionResult Index()
        {
            LocationBL LocationBL = new LocationBL();

            LocationBL.EmailID = User.Identity.Name;
            return(View("Index", "_HomeLayout", LoginViewModel));
        }
        private void SAVEButton_Click(object sender, EventArgs e)
        {
            Location aLocation = new Location();

            aLocation.LocationName = locationNameTextBox.Text;
            aLocation.Details      = detailsTextBox.Text;
            // aBus.NoOfSeat = int.Parse(noOfSeatTextBox.Text);
            LocationBL locationBLOBj = new LocationBL();
            bool       result        = locationBLOBj.SaveNewLocationBL(aLocation);

            if (result)
            {
                MessageBox.Show("Succesfuly added new Location!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                this.PopulateGridView();
                IntitialButtonMood();
                CleanTextBar();
            }

            else
            {
                DialogResult dialog = MessageBox.Show("Please fill all the text", "ERROR", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

                if (dialog == DialogResult.Cancel)
                {
                    this.Close();
                }
            }
        }
Beispiel #6
0
 public CustomerMenu(CustomerBL customerBL, OrderBL newOrder, LocationBL locationBL)
 {
     _customerBL      = customerBL;
     _orderBL         = newOrder;
     _locationBL      = locationBL;
     _inputValidation = new InputValidation();
 }
 public ManagerMenu(LocationBL locationbl, CustomerBL customerBL, OrderBL orderBL)
 {
     _locationBL      = locationbl;
     _customerBL      = customerBL;
     _orderBL         = orderBL;
     _inputValidation = new InputValidation();
 }
Beispiel #8
0
        public Decimal Import_file_excel(HttpPostedFileBase fileImport)
        {
            try
            {
                DataSet _ds = new DataSet();
                if (fileImport != null && fileImport.ContentLength > 0)
                {
                    if (!fileImport.FileName.EndsWith(".xls") && !fileImport.FileName.EndsWith(".xlsx"))
                    {
                        return(-3);
                    }
                    else
                    {
                        Stream           stream = fileImport.InputStream;
                        IExcelDataReader reader = null;

                        if (fileImport.FileName.EndsWith(".xls"))
                        {
                            reader = ExcelReaderFactory.CreateBinaryReader(stream);
                        }
                        else if (fileImport.FileName.EndsWith(".xlsx"))
                        {
                            reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                        }

                        _ds = reader.AsDataSet();
                        reader.Close();
                    }
                }
                if (_ds != null)
                {
                    _ds.Tables[0].Rows[0].Delete();//xóa dòng title
                    _ds.AcceptChanges();
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in _ds.Tables[0].Rows)
                        {
                            LocationInfo obj_info = new LocationInfo();
                            obj_info.Parent_Name = dr[0] == null ? "" : dr[0].ToString();
                            obj_info.Parent_Id   = dr[1] == null ? 0 : decimal.Parse(dr[1].ToString());
                            obj_info.Name        = dr[2] == null ? "" : dr[2].ToString();
                            obj_info.Code        = dr[3] == null ? "" : dr[3].ToString();
                            LocationBL obj_bl = new LocationBL();
                            obj_bl.Location_Insert(obj_info);
                        }
                    }
                    else
                    {
                        return(-4);//không có dữ liệu
                    }
                }
                return(1);
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(-1);
            }
        }
        private void PopulateGridView()
        {
            DataTable  dt            = new DataTable();
            LocationBL locationBLOBj = new LocationBL();

            dt = locationBLOBj.GetExistingdBusBL();
            locationDataGridView.DataSource = dt;
        }
Beispiel #10
0
        void PoupulateLocationGrid()
        {
            LocationBL      locationTypeBL = new LocationBL();
            List <Location> lstLocation    = locationTypeBL.GetLocation();

            if (lstLocation != null)
            {
                dgvLocation.DataSource = lstLocation;
            }
        }
Beispiel #11
0
        public JsonResult Approve(int id)
        {
            var response   = new ResponseModel();
            var locationBL = new LocationBL();

            locationBL.Appove(id);
            response.Code    = SystemStatusCode.Success.GetHashCode();
            response.Message = "Bạn đã duyệt thông tin địa điểm thành công !";
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Beispiel #12
0
        public static IMenu GetMenu(string menuType)
        {
            //configure
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json")
                                .Build();

            //connect
            string connectionString = configuration.GetConnectionString("StoreAppDB");
            //Console.WriteLine(connectionString);

            //option
            DbContextOptions <StoreAppDBContext> options = new DbContextOptionsBuilder <StoreAppDBContext>()
                                                           .UseSqlServer(connectionString)
                                                           .Options;

            //context
            var context = new StoreAppDBContext(options);

            IRepository        repo            = new RepoDB(context);
            IValidationService inputValidation = new ValidationService();
            ICustomerBL        customerBL      = new CustomerBL(repo);
            ILocationBL        locationBL      = new LocationBL(repo);
            IProductBL         productBL       = new ProductBL(repo);
            IInventoryBL       inventoryBL     = new InventoryBL(repo);
            IOrderBL           orderBL         = new OrderBL(repo);

            switch (menuType.ToLower())
            {
            case "main":
                return(new MainMenu());

            case "branch":
                return(new BranchMenu(locationBL, inputValidation));

            case "product":
                return(new ProductMenu(productBL, inputValidation));

            case "inventory":
                return(new InventoryMenu(locationBL, productBL, inventoryBL, orderBL, inputValidation));

            case "customer":
                return(new CustomerMenu(customerBL));

            case "order":
                return(new OrderMenu(customerBL, locationBL, productBL, inventoryBL, orderBL, inputValidation));

            default:
                return(null);
            }
        }
Beispiel #13
0
        public ActionResult StoreInfoEdit(string storeDetail, string type)
        {
            dynamic storeData = JsonConvert.DeserializeObject(storeDetail);

            var location = AppHelper.LocationMapFormJson(storeData, type);

            var updatedLocation = LocationBL.Update(location, type);

            updatedLocation = LocationBL.ApplyTimeFormat(updatedLocation, TimeFormat.Hours12);

            return(PartialView("_StoreDetail", updatedLocation));
            //  return null;
        }
Beispiel #14
0
        //Drink drink = new Drink();

        public void Start()
        {
            bool startMenu = true;

            do
            {
                Console.WriteLine("Welcome to Dozen! Are you a manager or a customer?");
                Console.WriteLine("[0] Customer Menu");
                Console.WriteLine("[1] Manager");
                Console.WriteLine("[2] Exit");

                //get user input
                Console.WriteLine("Enter a number: ");
                string userInput       = Console.ReadLine();
                var    drinkrepo       = new DrinkRepositoryDB();
                var    mapper          = new Mapper();
                var    customerRepo    = new CustomerRepoDB(context, mapper);
                var    customerBL      = new CustomerBL(customerRepo);
                var    locationRepo    = new LocationRepositoryDB(context, mapper);
                var    locationBL      = new LocationBL(locationRepo);
                var    orderRepoDB     = new OrderRepositoryDB(context, mapper);
                var    orderBL         = new OrderBL(orderRepoDB);
                var    inventoryRepoDB = new InventoryRepoDB(context, mapper);
                var    inventoryBL     = new InventoryBL(inventoryRepoDB);
                var    drinkBL         = new DrinkBL(drinkrepo);
                switch (userInput)
                {
                case "0":


                    CustomerMenu customerMenu = new CustomerMenu(drinkBL, customerBL, locationBL, orderBL, inventoryBL);
                    customerMenu.Start();
                    break;

                case "1":
                    ManagerMenu managerMenu = new ManagerMenu(locationBL, orderBL, inventoryBL, customerBL);
                    managerMenu.Start();
                    break;

                case "2":
                    startMenu = false;
                    break;

                default:
                    Console.WriteLine("Invalid input! Try again");
                    break;
                }
            } while (startMenu);
        }
Beispiel #15
0
        // GET: ModuleBaseData/Location
        public ActionResult LocationDisplay()
        {
            List <LocationInfo> list = new List <LocationInfo>();

            try
            {
                LocationBL _bl           = new LocationBL();
                decimal    _total_record = 0;
                list = _bl.Location_Search("ALL", ref _total_record);
                string htmlPaging = NaviCommon.CommonFuc.Get_HtmlPaging <LocationInfo>((int)_total_record, 1, "tỉnh/ huyện");
                ViewBag.Paging    = htmlPaging;
                ViewBag.List      = list;
                ViewBag.SumRecord = _total_record;
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
            }
            return(View("~/Areas/ModuleBaseData/Views/Location/LocationDisplay.cshtml"));
        }
Beispiel #16
0
        public JsonResult Get(int?page, int?limit, string sortBy, string direction, string name, string state, string areaManager)
        {
            int total;
            var predicate = PredicateBuilder.True <LocationModel>();


            if (!string.IsNullOrWhiteSpace(name))
            {
                predicate = predicate.And(q => q.Name.Contains(name));
            }

            if (!string.IsNullOrWhiteSpace(state))
            {
                predicate = predicate.And(q => q.PhysicalAddress.State != null && q.PhysicalAddress.State.Contains(state));
            }

            if (!string.IsNullOrWhiteSpace(areaManager))
            {
                predicate = predicate.And(q => q.Email != null && q.Email.Contains(areaManager));
            }

            List <LocationModel> records = null;

            if (page.HasValue && limit.HasValue)
            {
                int start = (page.Value - 1) * limit.Value;
                records = LocationBL.GetAll().AsQueryable().Where(predicate).OrderBy(o => o.Id).Skip(start).Take(limit.Value).ToList();
            }
            else
            {
                records = LocationBL.GetAll().AsQueryable().Where(predicate).OrderBy(o => o.Id).ToList();
            }

            total = LocationBL.GetAll().AsQueryable().Where(predicate).Count();

            return(this.Json(new { records, total }, JsonRequestBehavior.AllowGet));
        }
Beispiel #17
0
        public ActionResult Index()
        {
            AppModel appModel = new AppModel()
            {
                AreaManagers = new List <string>(), States = new List <string>()
            };

            try
            {
                appModel.StoreDetails = LocationBL.GetAll();

                if (appModel.StoreDetails != null)
                {
                    appModel.States = appModel.StoreDetails.Select(o => o.PhysicalAddress.State).Distinct().ToList();
                    //TODO
                    //Area Manager mapped with AdminEmail
                    appModel.AreaManagers = appModel.StoreDetails.Select(o => o.Email).Distinct().ToList();
                }
            }
            catch (Exception ex)
            {
            }
            return(View(appModel));
        }
        private void deleteButton_Click_1(object sender, EventArgs e)
        {
            Location aLocation = new Location();

            aLocation.LocationName = locationNameTextBox.Text;
            aLocation.Details      = detailsTextBox.Text;
            // aBus.NoOfSeat = int.Parse(noOfSeatTextBox.Text);
            LocationBL locationBLOBj = new LocationBL();
            bool       result        = locationBLOBj.DeleteALocationBL(aLocation);

            if (result)
            {
                MessageBox.Show("Succesfuly Deleted", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                this.PopulateGridView();
                IntitialButtonMood();
                CleanTextBar();
            }

            else
            {
                MessageBox.Show("Something wrong!", "Aleart", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public List <EKATTE> GetAllEKATTEs()
        {
            List <EKATTE> list = new LocationBL().GetAllEKATTEs();

            return(list);
        }
        public CallContext LocationSave(Location entity, CallContext resultContext)
        {
            CallContext resContext = new LocationBL().EntitySave <Location>(entity, resultContext);

            return(resContext);
        }
        public LocationView GetLocationViewById(string entityID)
        {
            LocationView locationView = new LocationBL().GetLocationViewById(Int32.Parse(entityID));

            return(locationView);
        }
        public List <LocationView> GetLocationViewsByMunicipalityId(string municipalityID)
        {
            List <LocationView> list = new LocationBL().GetLocationViewsByMunicipalityId(Int32.Parse(municipalityID));

            return(list);
        }
        public List <LocationView> GetAllLocationViews()
        {
            List <LocationView> list = new LocationBL().GetAllLocationViews();

            return(list);
        }
        public Location GetLocationById(string entityID)
        {
            Location location = new LocationBL().GetLocationById(Int32.Parse(entityID));

            return(location);
        }
Beispiel #25
0
        public static FASM_Enums.InfoMessages SaveLocation(ref Location eLocation)
        {
            LocationBL LocationBL = new LocationBL();

            return(LocationBL.SaveLocation(ref eLocation));
        }
Beispiel #26
0
        public static DataTable GetLocation()
        {
            LocationBL LocationBL = new LocationBL();

            return(LocationBL.GetLocation());
        }
Beispiel #27
0
        public static void LoadLocation(ref Location eLocation)
        {
            LocationBL LocationBL = new LocationBL();

            LocationBL.LoadLocation(ref eLocation);
        }
        public List <EKATTE> GetEKATTEsByMunicipalityId(string municipalityID)
        {
            List <EKATTE> list = new LocationBL().GetEKATTEsByMunicipalityId(Int32.Parse(municipalityID));

            return(list);
        }
Beispiel #29
0
        public static FASM_Enums.InfoMessages DeleteLocation(Int32 LocationId)
        {
            LocationBL LocationBL = new LocationBL();

            return(LocationBL.DeleteLocation(LocationId));
        }
        public EKATTE GetEKATTEById(string entityID)
        {
            EKATTE eKATTE = new LocationBL().GetEKATTEById(Int32.Parse(entityID));

            return(eKATTE);
        }