public void AddPosition(string description, EPositionType type, int cost, int income)
 {
     _serwisContext.RepairPosition.Add(new RepairPosition {
         Description = description, Type = type, Cost = cost, Income = income
     });
     _serwisContext.SaveChanges();
 }
Esempio n. 2
0
 ///
 /// @brief Send vibrating command to the server
 ///
 public override void VibrateFinger(EPositionType handType, EFingerType fingerType, ushort duration, byte strength)
 {
     if (m_sock != null)
     {
         sendToServer(GetVibrateFingerJSON(handType, fingerType, duration, strength));
     }
 }
Esempio n. 3
0
        public static ListItem GetListItem(EPositionType type, bool selected)
        {
            var item = new ListItem(GetText(type), GetValue(type));

            if (selected)
            {
                item.Selected = true;
            }
            return(item);
        }
Esempio n. 4
0
 public static bool Equals(EPositionType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
 public AdvertisementFloatImageInfo(bool isCloseable, EPositionType positionType, int positionX, int positionY, ERollingType rollingType, string navigationUrl, string imageUrl, int height, int width)
 {
     IsCloseable   = isCloseable;
     PositionType  = positionType;
     PositionX     = positionX;
     PositionY     = positionY;
     RollingType   = rollingType;
     NavigationUrl = navigationUrl;
     ImageUrl      = imageUrl;
     Height        = height;
     Width         = width;
 }
 public static string GetText(EPositionType type)
 {
     if (type == EPositionType.LeftTop)
     {
         return("左上");
     }
     if (type == EPositionType.LeftBottom)
     {
         return("左下");
     }
     if (type == EPositionType.RightTop)
     {
         return("右上");
     }
     if (type == EPositionType.RightBottom)
     {
         return("右下");
     }
     throw new Exception();
 }
 public static string GetValue(EPositionType type)
 {
     if (type == EPositionType.LeftTop)
     {
         return("LeftTop");
     }
     if (type == EPositionType.LeftBottom)
     {
         return("LeftBottom");
     }
     if (type == EPositionType.RightTop)
     {
         return("RightTop");
     }
     if (type == EPositionType.RightBottom)
     {
         return("RightBottom");
     }
     throw new Exception();
 }
 public static bool Equals(string typeStr, EPositionType type)
 {
     return(Equals(type, typeStr));
 }
 private static bool Equals(EPositionType type, string typeStr)
 {
     return(!string.IsNullOrEmpty(typeStr) && string.Equals(GetValue(type).ToLower(), typeStr.ToLower()));
 }
Esempio n. 10
0
 ///
 /// @brief Send vibrating command to the server
 ///
 protected String GetVibrateFingerJSON(EPositionType handType, EFingerType fingerType, ushort duration, byte strength)
 {
     return(String.Format("{{\"dst\":\"{0}\",\"type\":\"vibration\",\"data\":{{\"type\":{1},\"dur\":{2},\"str\":{3}}}}}\n", (handType == EPositionType.RightHand ? "rh" : "lh"), (int)fingerType, duration, strength));
 }
Esempio n. 11
0
 abstract public void VibrateFinger(EPositionType handType, EFingerType fingerType, ushort duration, byte strength);
Esempio n. 12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            if (Body.IsQueryExists("AdvertisementName"))
            {
                isEdit = true;
                editAdvertisementName = Body.GetQueryString("AdvertisementName");
                if (DataProvider.AdvertisementDao.IsExists(editAdvertisementName, PublishmentSystemId))
                {
                    editAdvertisementType = DataProvider.AdvertisementDao.GetAdvertisementType(editAdvertisementName, PublishmentSystemId);
                }
                else
                {
                    ErrorLabel.Text = $"不存在名称为“{editAdvertisementName}”的广告!";
                    SetActivePanel(WizardPanel.OperatingError, OperatingError);
                    return;
                }
            }

            if (!Page.IsPostBack)
            {
                var pageTitle = isEdit ? "编辑漂浮广告" : "添加漂浮广告";
                BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdAdvertisement, pageTitle, AppManager.Cms.Permission.WebSite.Advertisement);

                ltlPageTitle.Text = pageTitle;

                StartDate.Text = DateUtils.GetDateAndTimeString(DateTime.Now);
                EndDate.Text   = DateUtils.GetDateAndTimeString(DateTime.Now.AddMonths(1));

                EAdvertisementTypeUtils.AddListItems(AdvertisementType);
                ControlUtils.SelectListItems(AdvertisementType, EAdvertisementTypeUtils.GetValue(EAdvertisementType.FloatImage));

                var nodeIdList = DataProvider.NodeDao.GetNodeIdListByPublishmentSystemId(PublishmentSystemId);
                var nodeCount  = nodeIdList.Count;
                isLastNodeArray = new bool[nodeCount];
                foreach (int theNodeID in nodeIdList)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, theNodeID);

                    var title    = WebUtils.GetChannelListBoxTitle(PublishmentSystemId, nodeInfo.NodeId, nodeInfo.NodeName, nodeInfo.NodeType, nodeInfo.ParentsCount, nodeInfo.IsLastNode, isLastNodeArray);
                    var listitem = new ListItem(title, nodeInfo.NodeId.ToString());
                    NodeIDCollectionToChannel.Items.Add(listitem);
                    title = title + $"({nodeInfo.ContentNum})";
                    var listitem2 = new ListItem(title, nodeInfo.NodeId.ToString());
                    NodeIDCollectionToContent.Items.Add(listitem2);
                }

                var fileTemplateInfoList = DataProvider.TemplateDao.GetTemplateInfoListByType(PublishmentSystemId, ETemplateType.FileTemplate);
                if (fileTemplateInfoList.Count > 0)
                {
                    foreach (var fileTemplateInfo in fileTemplateInfoList)
                    {
                        var listitem = new ListItem(fileTemplateInfo.CreatedFileFullName, fileTemplateInfo.TemplateId.ToString());
                        FileTemplateIDCollection.Items.Add(listitem);
                    }
                }
                else
                {
                    FileTemplateIDCollectionRow.Visible = false;
                }

                EPositionTypeUtils.AddListItems(PositionType, ERollingType.Static);

                ERollingTypeUtils.AddListItems(RollingType);
                ControlUtils.SelectListItems(RollingType, ERollingTypeUtils.GetValue(ERollingType.FollowingScreen));

                var showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, ImageUrl.ClientID);
                SelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, ImageUrl.ClientID);
                UploadImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, ScreenDownImageUrl.ClientID);
                ScreenDownSelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, ScreenDownImageUrl.ClientID);
                ScreenDownUploadImage.Attributes.Add("onclick", showPopWinString);

                SetActivePanel(WizardPanel.AdvertisementBase, AdvertisementBase);

                if (isEdit)
                {
                    var adInfo = DataProvider.AdvertisementDao.GetAdvertisementInfo(editAdvertisementName, PublishmentSystemId);
                    AdvertisementName.Text          = adInfo.AdvertisementName;
                    AdvertisementName.Enabled       = false;
                    AdvertisementType.SelectedValue = EAdvertisementTypeUtils.GetValue(editAdvertisementType);

                    IsDateLimited.Checked = adInfo.IsDateLimited;
                    StartDate.Text        = DateUtils.GetDateAndTimeString(adInfo.StartDate);
                    EndDate.Text          = DateUtils.GetDateAndTimeString(adInfo.EndDate);
                    ControlUtils.SelectListItems(NodeIDCollectionToChannel, TranslateUtils.StringCollectionToStringList(adInfo.NodeIDCollectionToChannel));
                    ControlUtils.SelectListItems(NodeIDCollectionToContent, TranslateUtils.StringCollectionToStringList(adInfo.NodeIDCollectionToContent));
                    ControlUtils.SelectListItems(FileTemplateIDCollection, TranslateUtils.StringCollectionToStringList(adInfo.FileTemplateIDCollection));

                    if (adInfo.AdvertisementType == EAdvertisementType.FloatImage)
                    {
                        var adFloatImageInfo = new AdvertisementFloatImageInfo(adInfo.Settings);
                        IsCloseable.Checked       = adFloatImageInfo.IsCloseable;
                        ePositionType             = adFloatImageInfo.PositionType;
                        PositionX.Text            = adFloatImageInfo.PositionX.ToString();
                        PositionY.Text            = adFloatImageInfo.PositionY.ToString();
                        RollingType.SelectedValue = ERollingTypeUtils.GetValue(adFloatImageInfo.RollingType);

                        NavigationUrl.Text = adFloatImageInfo.NavigationUrl;
                        ImageUrl.Text      = adFloatImageInfo.ImageUrl;
                        Height.Text        = adFloatImageInfo.Height.ToString();
                        Width.Text         = adFloatImageInfo.Width.ToString();
                    }
                    else if (adInfo.AdvertisementType == EAdvertisementType.ScreenDown)
                    {
                        var adScreenDownInfo = new AdvertisementScreenDownInfo(adInfo.Settings);
                        ScreenDownNavigationUrl.Text = adScreenDownInfo.NavigationUrl;
                        ScreenDownImageUrl.Text      = adScreenDownInfo.ImageUrl;
                        ScreenDownDelay.Text         = adScreenDownInfo.Delay.ToString();
                        ScreenDownWidth.Text         = adScreenDownInfo.Width.ToString();
                        ScreenDownHeight.Text        = adScreenDownInfo.Height.ToString();
                    }
                    else if (adInfo.AdvertisementType == EAdvertisementType.OpenWindow)
                    {
                        var adOpenWindowInfo = new AdvertisementOpenWindowInfo(adInfo.Settings);
                        OpenWindowFileUrl.Text = adOpenWindowInfo.FileUrl;
                        OpenWindowWidth.Text   = adOpenWindowInfo.Width.ToString();
                        OpenWindowHeight.Text  = adOpenWindowInfo.Height.ToString();
                    }
                }
                ReFresh(null, EventArgs.Empty);
            }

            SuccessMessage(string.Empty);
        }