コード例 #1
0
ファイル: DataTypeViewModel.cs プロジェクト: mortend/uno
 public DataTypeViewModel(DocumentIdViewModel id,
                          DocumentUriViewModel uri,
                          TitlesViewModel titlesViewModel,
                          SyntaxViewModel syntaxViewModel,
                          DocumentReferenceViewModel @base,
                          LocationViewModel location,
                          InheritanceViewModel inheritance,
                          ParametersViewModel parameters,
                          ReturnsViewModel returns,
                          UxClassPropertiesViewModel uxProperties,
                          ValuesViewModel values,
                          CommentViewModel comment,
                          DocumentReferenceViewModel declaredIn,
                          ImplementedInterfacesViewModel implementedInterfaces,
                          AttributesViewModel attributes,
                          IEntity underlyingEntity)
     : base(id, uri, titlesViewModel, syntaxViewModel, comment, declaredIn, underlyingEntity)
 {
     Base                  = @base;
     Location              = location;
     Inheritance           = inheritance;
     Parameters            = parameters;
     Returns               = returns;
     UxProperties          = uxProperties;
     Values                = values;
     ImplementedInterfaces = implementedInterfaces;
     Attributes            = attributes;
 }
コード例 #2
0
 public string DeleteAttributes([Bind(Exclude = "Name,Caption,AttributeType,CSValues,EntityType,ConfigurableYN,FilterYN,MandatoryYN,ComparableYN")] AttributesViewModel attributesObj)
 {
     if (!ModelState.IsValid)
     {
         if (attributesObj.ID != 0)
         {
             try
             {
                 OperationsStatusViewModel operationsStatus             = new OperationsStatusViewModel();
                 OperationsStatusViewModel OperationsStatusViewModelObj = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_attributeBusiness.DeleteAttributes(attributesObj.ID));
                 if (OperationsStatusViewModelObj.StatusCode == 1)
                 {
                     return(JsonConvert.SerializeObject(new { Result = "OK", Record = OperationsStatusViewModelObj }));
                 }
                 else
                 {
                     return(JsonConvert.SerializeObject(new { Result = "Error", Record = OperationsStatusViewModelObj }));
                 }
             }
             catch (Exception ex)
             {
                 return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
             }
         }
     }
     return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = "Please Select attribute" }));
 }
コード例 #3
0
 public string DeleteEvent([Bind(Exclude = "Name,RelatedCategories")] AttributesViewModel attributesObj)
 {
     if (!ModelState.IsValid)
     {
         if (attributesObj.ID != 0)
         {
             try
             {
                 OperationsStatusViewModel operationsStatus             = new OperationsStatusViewModel();
                 OperationsStatusViewModel OperationsStatusViewModelObj = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_eventBusiness.DeleteEvent(attributesObj.ID));
                 if (OperationsStatusViewModelObj.StatusCode == 1)
                 {
                     return(JsonConvert.SerializeObject(new { Result = "OK", Record = OperationsStatusViewModelObj }));
                 }
                 else
                 {
                     return(JsonConvert.SerializeObject(new { Result = "Error", Record = OperationsStatusViewModelObj }));
                 }
             }
             catch (Exception ex)
             {
                 return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
             }
         }
     }
     return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = "Please Select attribute" }));
 }
コード例 #4
0
        public AttributesViewModel GetAttribute(string caId)
        {
            var context   = new SGModel();
            var products  = new SGRepository <Products>(context).GetAll();
            var catagorys = new SGRepository <Catagory>(context).GetAll();
            var classes   = new SGRepository <Models.Class>(context).GetAll();
            var pas       = new SGRepository <Product_Attributes>(context).GetAll();

            var result = from p in products
                         join cl in classes on p.ClassID equals cl.ID
                         join ca in catagorys on cl.CatagoryID equals ca.ID
                         join p_a in pas on p.ID equals p_a.PID
                         where ca.ID == caId
                         select new { p, cl, ca, p_a };

            List <RangeViewModel>     rangeViewModels     = new List <RangeViewModel>();
            List <ColorItemViewModel> colorItemViewModels = new List <ColorItemViewModel>();
            List <NormalViewModel>    normalViewModels    = new List <NormalViewModel>();

            rangeViewModels.Add(new RangeViewModel
            {
                Title = "價錢",
                max   = 10000, //(int?)result.Max(x => x.p.Price) ,
                min   = 30     //(int?)result.Min(x => x.p.Price)
            });
            colorItemViewModels.AddRange(result.GroupBy(x => x.p.Color).Select(x =>
                                                                               new ColorItemViewModel()
            {
                Name      = x.Key,
                ColorCode = "#ccc"
            }
                                                                               ));
            normalViewModels.AddRange(result.GroupBy(x => x.p_a.Name).Select(x =>
                                                                             new NormalViewModel
            {
                Title      = x.Key,
                Attributes = x.Select(y => new SubClassViewModel {
                    Name = y.p_a.Value
                }).Distinct().ToList()
            }
                                                                             ));

            AttributesViewModel attributesViewModel = new AttributesViewModel
            {
                ColorList = new List <ColorViewModel>()
                {
                    new ColorViewModel()
                    {
                        Title         = "顏色",
                        ColorItemList = colorItemViewModels
                    }
                },
                RangeList = rangeViewModels,
                OtherList = normalViewModels
            };

            return(attributesViewModel);
        }
コード例 #5
0
 public string GetAllAttributes(AttributesViewModel attributesObj)
 {
     try
     {
         List <AttributesViewModel> attributeList = Mapper.Map <List <Attributes>, List <AttributesViewModel> >(_attributeBusiness.GetAllAttributes());
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = attributeList }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
     }
 }
コード例 #6
0
 public string GetAttributes(string ID)
 {
     try
     {
         OperationsStatusViewModel operationsStatus = new OperationsStatusViewModel();
         AttributesViewModel       attribute        = Mapper.Map <Attributes, AttributesViewModel>(_attributeBusiness.GetAttributes(Int32.Parse(ID), Mapper.Map <OperationsStatusViewModel, OperationsStatus>(operationsStatus)));
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = attribute }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
     }
 }
コード例 #7
0
        // GET: Attributes
        public ViewResult Index()
        {
            var model = new AttributesViewModel();

            model.Agility      = 5;
            model.Awareness    = 5;
            model.Coordination = 5;
            model.Intelligence = 5;
            model.Mental       = 5;
            model.Personality  = 5;
            model.Physique     = 5;
            model.Strength     = 5;

            return(View(model));
        }
コード例 #8
0
        public ActionResult searchAttrbutetes(string Select, string name, string BtnSubmit, int?page)
        {
            if (BtnSubmit != "Attributes")
            {
                RedirectToAction("view");
            }
            if (name == null || name == "")
            {
                return(RedirectToAction("Attributes"));
            }
            //如果BtnSubmit是触发的搜索按键
            AttributesViewModel attributesViewModel = new AttributesViewModel();

            attributesViewModel.IsSearch = true;
            attributesViewModel.UserName = Session["User"].ToString();//继承的,显示右边的用户名

            CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer();

            //第几页
            int pageNumber = page ?? 1;
            //每页显示多少条
            int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]);

            //attributesViewModel.commodities = commodityBusinessLayer.GetCommodity(Select, name).ToPagedList(pageNumber, pageSize);
            List <Commodity>         commodities        = commodityBusinessLayer.GetCommodity(Select, name);
            List <CommPathViewModel> commPathViewModels = new List <CommPathViewModel>();
            string path;

            foreach (var com in commodities)
            {
                path = Server.MapPath("/image/");
                if (!System.IO.File.Exists(path))
                {
                    //如果不存在这个文件,则创建
                    BarCode barCode = new BarCode();
                    barCode.Code(com.Co_bar_code, path);
                }
                commPathViewModels.Add(new CommPathViewModel()
                {
                    commodity = com, path = "/image/" + com.Co_bar_code + ".jpg"
                });
            }
            attributesViewModel.commPathViewModels = commPathViewModels.ToPagedList(pageNumber, pageSize);

            attributesViewModel.commoditie = new Commodity();

            return(View("Attributes", attributesViewModel));
        }
コード例 #9
0
 public string InsertUpdateAttributes(AttributesViewModel attributesObj)
 {
     if (ModelState.IsValid)
     {
         OperationsStatusViewModel OperationsStatusViewModelObj = null;
         if (attributesObj.ID == 0) //Create Attribute
         {
             try
             {
                 attributesObj.commonObj             = new LogDetailsViewModel();
                 attributesObj.commonObj.CreatedBy   = _commonBusiness.GetUA().UserName;
                 attributesObj.commonObj.CreatedDate = _commonBusiness.GetCurrentDateTime();
                 OperationsStatusViewModelObj        = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_attributeBusiness.InsertAttributes(Mapper.Map <AttributesViewModel, Attributes>(attributesObj)));
             }
             catch (Exception ex)
             {
                 return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
             }
         }
         else //Update Attribute
         {
             try
             {
                 attributesObj.commonObj             = new LogDetailsViewModel();
                 attributesObj.commonObj.UpdatedBy   = _commonBusiness.GetUA().UserName;
                 attributesObj.commonObj.UpdatedDate = _commonBusiness.GetCurrentDateTime();
                 OperationsStatusViewModelObj        = Mapper.Map <OperationsStatus, OperationsStatusViewModel>(_attributeBusiness.UpdateAttributes(Mapper.Map <AttributesViewModel, Attributes>(attributesObj)));
             }
             catch (Exception ex)
             {
                 return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
             }
         }
         if (OperationsStatusViewModelObj.StatusCode == 1)
         {
             return(JsonConvert.SerializeObject(new { Result = "OK", Record = OperationsStatusViewModelObj }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new { Result = "Error", Record = OperationsStatusViewModelObj }));
         }
     }
     return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = "Please Check the values" }));
 }
コード例 #10
0
        public IActionResult ChangeAttributes(Guid id)
        {
            var employee = _unitOfWork.EmployeeSpecial.Get(id);

            var allAttributes = _unitOfWork.Attribute.GetAll().ToList();

            var chosenAttributes = _unitOfWork.EmployeeSpecialAttribute
                                   .GetAll(includeProperties: "Attribute")
                                   .Select(u => u.Attribute).ToList();

            var attributes = new AttributesViewModel()
            {
                AllAttributes = allAttributes,
                MyAttributes  = chosenAttributes,
                Employee      = employee
            };

            return(View(attributes));
        }
コード例 #11
0
ファイル: BusinessMapper.cs プロジェクト: padman91/Aug31st
        /// <summary>
        /// Business model to View model mapper
        /// </summary>
        /// <param name="attributes"></param>
        /// <returns></returns>
        public static List <AttributesViewModel> AttributesBusinessModelToAttributesViewModel(List <AttributesBusinessModel> attributes)
        {
            List <AttributesViewModel> attributesViewModels = new List <AttributesViewModel>();

            foreach (AttributesBusinessModel attr in attributes)
            {
                AttributesViewModel attribute = new AttributesViewModel();
                attribute.AttributeId          = attr.AttributeId;
                attribute.AttributeCode        = attr.AttributeCode;
                attribute.AttributeName        = attr.AttributeName;
                attribute.AttributeDescription = attr.AttributeDescription;
                attribute.Control        = attr.Control;
                attribute.RecordStatus   = attr.RecordStatus;
                attribute.AttributeType  = attr.AttributeType;
                attribute.AttributeValue = attr.AttributeValue;
                attributesViewModels.Add(attribute);
            }
            return(attributesViewModels);
        }
コード例 #12
0
        public ActionResult searchUser(string Select, string uname, string BtnSubmit)
        {
            //如果BtnSubmit是触发的搜索按键
            AttributesViewModel attributesViewModel = new AttributesViewModel();

            attributesViewModel.UserName = Session["User"].ToString();//继承的,显示右边的用户名

            //个人信息页面视图模型
            InformationBusinessLayer informationBusinessLayer = new InformationBusinessLayer();
            string name     = Session["User"].ToString();
            string password = Session["Password"].ToString();
            InformationViewModel informationViewModel = informationBusinessLayer.getInformationViewModel(name, password, Select, uname);

            S_select       = Select;
            S_name         = uname;
            IsSearchPeople = true;

            //S_users = informationViewModel.users;

            return(View("Information", informationViewModel));
        }
コード例 #13
0
        //[HttpGet]
        public ActionResult Attributes(int?page)
        {
            AttributesViewModel attributesViewModel = new AttributesViewModel();

            attributesViewModel.IsSearch = false;
            attributesViewModel.UserName = Session["User"].ToString();

            CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer();

            //第几页
            int pageNumber = page ?? 1;
            //每页显示多少条
            int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]);

            List <Commodity>         commodities        = commodityBusinessLayer.GetCommodity();
            List <CommPathViewModel> commPathViewModels = new List <CommPathViewModel>();
            string path;

            foreach (var com in commodities)
            {
                path = Server.MapPath("/image/");
                if (!System.IO.File.Exists(path))
                {
                    //如果不存在这个文件,则创建
                    BarCode barCode = new BarCode();
                    barCode.Code(com.Co_bar_code, path);
                }
                commPathViewModels.Add(new CommPathViewModel()
                {
                    commodity = com, path = "/image/" + com.Co_bar_code + ".jpg"
                });
            }
            attributesViewModel.commPathViewModels = commPathViewModels.ToPagedList(pageNumber, pageSize);
            //attributesViewModel.commodities = commodities.ToPagedList(pageNumber, pageSize);

            attributesViewModel.commoditie = new Commodity();

            return(View("Attributes", attributesViewModel));
        }
コード例 #14
0
ファイル: MemberViewModel.cs プロジェクト: mortend/uno
 public MemberViewModel(DocumentIdViewModel id,
                        DocumentUriViewModel uri,
                        TitlesViewModel titles,
                        SyntaxViewModel syntax,
                        LocationViewModel location,
                        DocumentReferenceViewModel declaredIn,
                        ParametersViewModel parameters,
                        ReturnsViewModel returns,
                        UxMemberPropertiesViewModel uxProperties,
                        ValuesViewModel values,
                        MemberFlagsViewModel flags,
                        CommentViewModel comment,
                        AttributesViewModel attributes,
                        IEntity underlyingEntity)
     : base(id, uri, titles, syntax, comment, declaredIn, underlyingEntity)
 {
     Location     = location;
     Parameters   = parameters;
     Returns      = returns;
     UxProperties = uxProperties;
     Flags        = flags;
     Values       = values;
     Attributes   = attributes;
 }
コード例 #15
0
 /// <summary>
 /// Business Method to call repository to save the configuration
 /// </summary>
 /// <param name="attribute"></param>
 /// <returns></returns>
 public bool SaveAttributeValue(AttributesViewModel attribute)
 {
     try
     {
         AttributesBusinessModel attributesBusinessModel = new AttributesBusinessModel()
         {
             AttributeCode        = attribute.AttributeCode,
             AttributeDescription = attribute.AttributeDescription,
             AttributeId          = attribute.AttributeId,
             AttributeName        = attribute.AttributeName,
             AttributeType        = attribute.AttributeType,
             AttributeValue       = attribute.AttributeValue,
             Control      = attribute.Control,
             RecordStatus = attribute.RecordStatus,
         };
         _configurationsRepository.SaveAttributeValue(attributesBusinessModel);
         return(true);
     }
     catch (Exception ex)
     {
         _logger.Log(ex, LogLevel.Error, ex.Message);
         return(false);
     }
 }
コード例 #16
0
        public ActionResult Index()
        {
            AttributesViewModel attributesViewModelObj = new AttributesViewModel();

            return(View(attributesViewModelObj));
        }
コード例 #17
0
 public ViewResult Create(AttributesViewModel model)
 {
     return(View());
 }
コード例 #18
0
 public bool SaveAttributeValue([FromBody] AttributesViewModel attribute)
 {
     return(_configurationsBusiness.SaveAttributeValue(attribute));
 }