Ejemplo n.º 1
0
        private void AddUnit(UnitId unitId)
        {
            if (PSettings.PreferenceAll.OverlayAlert.UnitIds.Contains(unitId))
            {
                new AnotherMessageBox().Show(_lstrMaphackFilterMessageAddUnitText.ToString(), _lstrMaphackFilterMessageAddUnitHeader.ToString());

                var items = lstvAlertConfigurationFilter.Items.Find(unitId.ToString(), false);

                if (items.Length <= 0)
                {
                    return;
                }

                foreach (ListViewItem item in lstvAlertConfigurationFilter.Items)
                {
                    item.Selected = false;
                }

                items[0].Selected = true;

                return;
            }

            AddUnitToSettings(unitId);
            AddUnitsToListview();
        }
        private void AddUnit(UnitId unitId)
        {
            if (LUnitFilter.ContainsKey(unitId))
            {
                new AnotherMessageBox().Show(_lstrMaphackFilterMessageAddUnitText.ToString(), _lstrMaphackFilterMessageAddUnitHeader.ToString());

                var items = lstvMaphackBasicsUnitFilter.Items.Find(unitId.ToString(), false);

                if (items.Length <= 0)
                {
                    return;
                }

                foreach (ListViewItem item in lstvMaphackBasicsUnitFilter.Items)
                {
                    item.Selected = false;
                }

                items[0].Selected = true;

                return;
            }

            var cl = new Color().GetRandomColor();

            LUnitFilter.Add(unitId, cl);

            AddUnitsToListview();
            AddUnitToSettings(unitId, cl);
        }
Ejemplo n.º 3
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // First lets save the product
                UnitInfo unit  = null;
                bool     isNew = false;

                if (UnitId >= 0)
                {
                    unit = Controller.GetUnit(UnitId);
                }
                else
                {
                    isNew = true;
                }

                if (unit != null)
                {
                    unit.Decimals = Convert.ToInt32(txtDecimals.Text);
                    Controller.UpdateUnit(unit);
                }
                else
                {
                    unit          = new UnitInfo();
                    unit.PortalId = PortalId;
                    unit.Decimals = Convert.ToInt32(txtDecimals.Text);
                    UnitId        = Controller.NewUnit(unit);
                }

                // Now lets update Language information
                lngUnits.UpdateLangs();
                Controller.DeleteUnitLangs(UnitId);
                foreach (UnitLangInfo ul in lngUnits.Langs)
                {
                    ul.UnitId = UnitId;
                    Controller.NewUnitLang(ul);
                }

                List <string> addParams = new List <string>();

                if (Request["adminmode"] != null)
                {
                    addParams.Add("adminmode=unitlist");
                }
                addParams.Add("unitId=" + UnitId.ToString());

                Response.Redirect(Globals.NavigateURL(TabId, "", addParams.ToArray()), true);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 4
0
        public IDictionary <string, string> GetEventProperties()
        {
            IDictionary <string, string> properties = new Dictionary <string, string>();

            properties.Add("UnitId", UnitId.ToString());
            properties.Add("TransactionId", TransactionId.ToString());
            properties.Add("Direction", Direction.ToString());
            properties.Add("VrtuTimestamp", DateTime.UtcNow.ToString("dd-MM-yyyyThh:mm:ss.ffff"));

            return(properties);
        }
Ejemplo n.º 5
0
        private void AddUnit(UnitId unitId)
        {
            if (PSettings.PreferenceAll.OverlayAlert.UnitIds.Contains(unitId))
            {
                new AnotherMessageBox().Show(_lstrMaphackFilterMessageAddUnitText.ToString(), _lstrMaphackFilterMessageAddUnitHeader.ToString());

                var items = lstvAlertConfigurationFilter.Items.Find(unitId.ToString(), false);

                if (items.Length <= 0)
                    return;

                foreach (ListViewItem item in lstvAlertConfigurationFilter.Items)
                {
                    item.Selected = false;
                }

                items[0].Selected = true;

                return;
            }

            AddUnitToSettings(unitId);
            AddUnitsToListview();
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RetriveParameters();
            if (!IsPostBack)
            {
                LoadDefault();
                if (Request.QueryString["UnitId"] != string.Empty)
                {
                    try
                    {
                        var id  = GeneralFunctions.DecryptQueryString(Request.QueryString["UnitId"]);
                        var pid = Convert.ToInt32(id);
                        if (pid > 0)
                        {
                            UnitId = pid;
                            LoadData(pid);
                        }
                    }
                    catch { }
                }
            }

            CheckUserAccess(UnitId.ToString());
        }
Ejemplo n.º 7
0
        private void AddUnit(UnitId unitId)
        {
            if (LUnitFilter.ContainsKey(unitId))
            {
                new AnotherMessageBox().Show(_lstrMaphackFilterMessageAddUnitText.ToString(), _lstrMaphackFilterMessageAddUnitHeader.ToString());

                var items = lstvMaphackBasicsUnitFilter.Items.Find(unitId.ToString(), false);

                if (items.Length <= 0)
                    return;

                foreach (ListViewItem item in lstvMaphackBasicsUnitFilter.Items)
                {
                    item.Selected = false;
                }

                items[0].Selected = true;

                return;
            }

            var cl = new Color().GetRandomColor();
            LUnitFilter.Add(unitId, cl);

            AddUnitsToListview();
            AddUnitToSettings(unitId, cl);
        }
Ejemplo n.º 8
0
        // ToXml()

        public override void ToJSON(JObject ParentObject)
        {
            ParentObject[_QuantitySubField.ToXmlNodeName(true)]    = (!Double.IsNaN(Quantity)) ? CswConvert.ToString(Quantity) : string.Empty;
            ParentObject[_Val_kg_SubField.ToXmlNodeName(true)]     = (!Double.IsNaN(Quantity)) ? CswConvert.ToString(Val_kg) : string.Empty;
            ParentObject[_Val_Liters_SubField.ToXmlNodeName(true)] = (!Double.IsNaN(Quantity)) ? CswConvert.ToString(Val_Liters) : string.Empty;

            ParentObject["minvalue"]           = MinValue.ToString();
            ParentObject["maxvalue"]           = MaxValue.ToString();
            ParentObject["precision"]          = Precision;
            ParentObject["excludeRangeLimits"] = ExcludeRangeLimits;
            ParentObject["quantityoptional"]   = QuantityOptional;

            ParentObject[_UnitIdSubField.ToXmlNodeName(true)] = string.Empty;
            CswNbtNode RelatedNode = null;

            if (CswTools.IsPrimaryKey(UnitId))
            {
                ParentObject[_UnitIdSubField.ToXmlNodeName(true)] = UnitId.ToString();
                RelatedNode = _CswNbtResources.Nodes[UnitId];
            }
            ParentObject[_UnitNameSubField.ToXmlNodeName(true)] = CachedUnitName;

            ParentObject["nodetypeid"] = string.Empty;
            if (TargetType == CswEnumNbtViewRelatedIdType.NodeTypeId)
            {
                ParentObject["nodetypeid"] = TargetId.ToString();
            }

            ParentObject["fractional"] = CswConvert.ToBoolean(TargetFractional);

            if (IsEditModeEditable)
            {
                ParentObject["relatednodeid"]   = string.Empty;
                ParentObject["relatednodelink"] = string.Empty;
                if (null != RelatedNode)
                {
                    ParentObject["relatednodeid"]   = RelatedNode.NodeId.ToString();
                    ParentObject["relatednodelink"] = RelatedNode.NodeLink;
                }


                if (false == ReadOnly)
                {
                    JArray JOptions = new JArray();
                    ParentObject["options"] = JOptions;

                    foreach (CswNbtNode Node in UnitNodes)
                    {
                        JObject JOption = new JObject();
                        if (Node.NodeId != null && Node.NodeId.PrimaryKey != Int32.MinValue)
                        {
                            JOption["id"]         = Node.NodeId.ToString();
                            JOption["value"]      = Node.NodeName;
                            JOption["fractional"] = CswConvert.ToBoolean(Node.Properties[CswNbtObjClassUnitOfMeasure.PropertyName.Fractional].AsLogical.Checked);
                        }
                        else if (false == Required)
                        {
                            JOption["id"]         = "";
                            JOption["value"]      = "";
                            JOption["fractional"] = false;
                        }
                        JOptions.Add(JOption);
                    }
                }
            } // if( ForEdit )
        }