public void EditManufacturer()
        {
            string submit = "Update";

            Manufacture manufacturer = new Manufacture();

            {
                manufacturer.Manufacturer_Name = "Sony";
                manufacturer.Level             = 32;
            }

            mockManufacturerRepository.Setup(m => m.EditExistingManufacturer(manufacturer)).Returns(true);

            var manufacturerlist = new ManufacturerViewModels();

            {
                manufacturer.Manufacturer_Id   = 4;
                manufacturer.Manufacturer_Name = "Sony";
                manufacturer.Level             = 32;
            }
            manufacturerlist.Manufacturer = manufacturer;

            // Now invoke the Index action.
            var actionResult = manufacturercontroller.Index(submit, manufacturerlist, null);

            // Validate the expected result.
            ViewResult expectedResult = new ViewResult();

            Assert.IsNotNull(actionResult);
            //(branchList, (actionResult.Model as BranchViewModels).BranchList);
        }
Ejemplo n.º 2
0
        private void XMLGenerate_SAPUpdate(ManufacturerViewModels model)
        {
            try
            {
                ApplicationUser currentUser = ApplicationUserManager.GetApplicationUser(User.Identity.Name, HttpContext.GetOwinContext());

                //unique id generation
                Guid   GuidRandomNo = Guid.NewGuid();
                string UniqueID     = GuidRandomNo.ToString();

                //fill viewmodel
                Viewmodel_ModifyManufacturer xmlEditManufacture = new Viewmodel_ModifyManufacturer();
                xmlEditManufacture.UniqueID = UniqueID.ToString();
                xmlEditManufacture.old_manufacturer_Name = Temp_manufacture.ToString().Trim();
                xmlEditManufacture.New_manufacturer_Name = model.Manufacturer.Manufacturer_Name;
                xmlEditManufacture.LastModifyUser        = currentUser.Id.ToString();                 // "2";   //GetUserId()
                xmlEditManufacture.LastModifyBranch      = currentUser.Modified_Branch_Id.ToString(); // "2"; //GetBranchId();
                xmlEditManufacture.LastModifyDateTime    = DateTime.Now.ToString();

                //generate xml
                manufacturerRepository.GenerateXML(xmlEditManufacture, UniqueID);
            }
            catch (Exception ex)
            {
                ExceptionHandler.LogException(ex);
                ViewBag.AppErrorMessage = ex.Message;
            }
        }
Ejemplo n.º 3
0
        private void XMLGenerate_SAPInsert(ManufacturerViewModels model)
        {
            try
            {
                ApplicationUser currentUser = ApplicationUserManager.GetApplicationUser(User.Identity.Name, HttpContext.GetOwinContext());

                //unique id generation
                Guid   GuidRandomNo = Guid.NewGuid();
                string UniqueID     = GuidRandomNo.ToString();

                //fill view model
                Viewmodel_AddManufacturer xmlAddManufacture = new Viewmodel_AddManufacturer();
                xmlAddManufacture.UniqueID          = UniqueID.ToString();
                xmlAddManufacture.manufacturer_Name = model.Manufacturer.Manufacturer_Name;
                xmlAddManufacture.CreatedUser       = currentUser.Id.ToString();                // "1";  //GetUserId()
                xmlAddManufacture.CreatedBranch     = currentUser.Created_Branch_Id.ToString(); // "1";//GetBranchId();
                xmlAddManufacture.CreatedDateTime   = DateTime.Now.ToString();

                //generate xml
                manufacturerRepository.GenerateXML(xmlAddManufacture, UniqueID);
            }
            catch (Exception ex)
            {
                ExceptionHandler.LogException(ex);
                ViewBag.AppErrorMessage = ex.Message;
            }
        }
        public void saveManufacturer()
        {
            string submit = "Save";

            /*
             *  First identify the repository methods which are invoked form Index action. Then Setup the mock
             *  for all the identified methods.
             *
             *  Then invoke the Controller's Index action with necessary input parameters and ensure that you have
             *  invoked the Index action for all the different cases (code blocks) available in that, which should
             *  cover all the blocks/statements in the Index action.
             *
             */
            #region Arrange
            // Prepare the return data for GetAllQuotation() method.
            Manufacture manufacturer = new Manufacture();
            {
                manufacturer.Manufacturer_Id   = 3;
                manufacturer.Manufacturer_Name = "Sony";
                manufacturer.Level             = 22;
            }

            mockManufacturerRepository.Setup(m => m.AddNewManufacturer(manufacturer)).Returns(true);

            var manufacturerlist = new ManufacturerViewModels();
            {
                manufacturer.Manufacturer_Id   = 3;
                manufacturer.Manufacturer_Name = "Sony";
                manufacturer.Level             = 22;
            }
            manufacturerlist.Manufacturer = manufacturer;

            #endregion

            // Now invoke the Index action.
            //var actionResult = manufacturercontroller.Index(submit, manufacturerlist) as ViewResult;
            var actionResult = manufacturercontroller.Index(submit, manufacturerlist, null);

            // Validate the expected result.
            ViewResult expectedResult = new ViewResult();

            Assert.IsNotNull(actionResult);
            //Assert.AreEqual(manufacturerlist, (actionResult.Model as ManufacturerViewModels).ManufacturerList);
        }
Ejemplo n.º 5
0
        // GET: Manufacturer
        public ActionResult Index(string searchColumn, string searchQuery)
        {
            try
            {
                LogHandler.WriteLog("Manufacturer Index page requested by #UserId");
                var qList = manufacturerRepository.GetAllManufacturer();
                //var qList = manufacturerRepository.GetFilterManufacturer(searchColumn, searchQuery, Guid.Empty);   //GetUserId();

                ManufacturerViewModels model = new ManufacturerViewModels();
                model.ManufacturerList = qList;

                return(View(model));
            }
            catch (Exception ex)
            {
                ExceptionHandler.LogException(ex);
                ViewBag.AppErrorMessage = ex.Message;
                return(View("Error"));
            }
        }