protected void Page_Load(object sender, EventArgs e)
        {
            //If contains a room id and a facility id we are creating the asset.
            if (Page.RouteData.Values["room_id"] != null && Page.RouteData.Values["facility_id"] != null)
            {
                facility_id = Convert.ToInt32(Page.RouteData.Values["facility_id"]);
                room_id = Convert.ToInt32(Page.RouteData.Values["room_id"]);
            }
            //If asset id is not null we are editing an asset.
            else if (Page.RouteData.Values["asset_id"] != null)
            {
                asset_id = Convert.ToInt32(Page.RouteData.Values["asset_id"]);
                selected_asset = (from a in db.assets
                                  where a.id == asset_id
                                  select a).Single();

                facility_id = selected_asset.facility_id;
                room_id = selected_asset.room_id;
                if (!Page.IsPostBack)
                {
                    AssetName.Text = selected_asset.name;
                    AssetSku.Text = selected_asset.sku;
                }
            }
        }
        protected void submitAsset(Object sender, EventArgs e)
        {
            //If selected asset is null then creating a new asset.
            if (selected_asset == null)
            {
                selected_asset = new asset();
                selected_asset.facility_id = facility_id;
                selected_asset.room_id = room_id;
                selected_asset.name = AssetName.Text;
                selected_asset.last_scan = DateTime.Now;
                selected_asset.add_date = DateTime.Now;
                selected_asset.sku = AssetSku.Text;
                db.assets.InsertOnSubmit(selected_asset);
                db.SubmitChanges();
            }
            //If not null then simply updating the name and sku
            else
            {
                selected_asset.name = AssetName.Text;
                selected_asset.sku = AssetSku.Text;
                db.SubmitChanges();
            }

            Response.RedirectToRoute("ViewRoom", new { facility_id = facility_id, room_id = room_id });
        }
Exemplo n.º 3
0
        public static AssetModel GetAssetModel(int dossierId, int assetId = 0)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            var asset = new AssetModel();

            asset.assetId       = assetId;
            asset.subcategories = GetCategories(dossierId);



            if (assetId != 0)
            {
                //existing record
                asset assetDTO = db.assets.Find(assetId);
                asset.dossierId  = dossierId;
                asset.receivable = decimal.Round(assetDTO.receivable, 2, MidpointRounding.AwayFromZero).ToString();;
                asset.payable    = decimal.Round(assetDTO.payable, 2, MidpointRounding.AwayFromZero).ToString();;

                asset.isAsset            = (assetDTO.receivable >= assetDTO.payable);
                asset.description        = assetDTO.description;
                asset.assetSubcategoryId = assetDTO.assetSubcategoryId;
            }
            else
            {
                //new record
                asset.dossierId          = dossierId;
                asset.receivable         = "0,00";
                asset.payable            = "0,00";
                asset.description        = "";
                asset.assetSubcategoryId = 0;
            }

            return(asset);
        }
Exemplo n.º 4
0
        // update aaudit
        internal static int updateAaudit(AWF myAWF, string actionString, string eventId, int itemSequence, RBA_Variables variables)
        {
            asset myAsset = getAsset(myAWF, itemSequence, variables);

            switch (getProductType(myAWF, itemSequence, variables))
            {
            case productType.Static:
                AWF_DB_Log.insertAauditRecordInDb(myAsset.Id, eventId, string.Format("{0}: {1} | Job Number: {2}", actionString, myAWF.Products.Item[itemSequence].ItemCode, myAWF.JobNumber.ToString()));
                break;

            case productType.Variable:
                AWF_DB_Log.insertAauditRecordInDb(myAsset.Id, eventId, string.Format("{0}: {1}", actionString, myAsset.Name));
                break;
            }

            string sql = "UPDATE asset "
                         + "SET tlc=(SELECT DISTINCT tc "
                         + "FROM aaudit WHERE id = :asset_id "
                         + "AND seq = (SELECT DISTINCT MAX(seq) "
                         + "FROM aaudit WHERE id = :asset_id ) LIMIT 1) "
                         + (actionString.Contains("DESTROY/CANCEL") ? ", status = 3" : String.Empty)
                         + "WHERE id = :asset_id; ";

            string[] parameterNames = { "asset_id" };
            string[] parameterVals  = { myAsset.Id };
            return(AWFPostgresDataLayer.ExecuteNonQuery(sql, parameterNames, parameterVals));
        }
Exemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            asset asset = db.assets.Find(id);

            db.assets.Remove(asset);
            db.SaveChanges();
            TempData["Info"] = "Asset deleted succesfully";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        //
        // GET: /Asset/Edit/5

        public ActionResult Edit(int id = 0)
        {
            asset asset = db.assets.Find(id);

            if (asset == null)
            {
                return(HttpNotFound());
            }
            return(View(asset));
        }
Exemplo n.º 7
0
        public int Create()
        {
            asset assetToCreate = new asset();

            assetToCreate = UpdateFields(assetToCreate);

            db.assets.Add(assetToCreate);
            db.SaveChanges();

            return(assetToCreate.assetId);
        }
Exemplo n.º 8
0
        public bool UpdateAsset(asset OurAsset)
        {
            int rowsAffected = this._db.Execute(@"UPDATE [Asset] SET [Name] = @Name, [Role] = @Role,[RegistrationDate] = @RegistrationDate, [Email] = @Email, 
                    [Password] = @Password WHERE ID = " + OurAsset.ID, OurAsset);

            if (rowsAffected > 0)
            {
                return(true);
            }
            return(false);
        }
        // GET api/Asset/5
        public assetDTO Getasset(int id)
        {
            asset asset = db.assets.Single(a => a.id == id);

            if (asset == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(asset.toDTO());
        }
Exemplo n.º 10
0
        public bool InsertAsset(asset OurAsset)
        {
            int rowsAffected = this._db.Execute("INSERT Asset([Name],[Role],[RegistrationDate],[Email],[Password]) VALUES(@Name, @Role,@RegistrationDate, @Email, @Password)",
                                                new { Name = OurAsset.Name, Role = OurAsset.Role, RegistrationDate = OurAsset.RegistrationDate, Email = OurAsset.Email, Password = OurAsset.Password });

            if (rowsAffected > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        public ActionResult Edit(asset asset)
        {
            if (ModelState.IsValid)
            {
                db.Entry(asset).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Asset edited successfully";
                return(RedirectToAction("Index"));
            }

            return(View(asset));
        }
Exemplo n.º 12
0
        public ActionResult Create(asset asset)
        {
            if (ModelState.IsValid)
            {
                asset.locked = 0;
                db.assets.Add(asset);
                db.SaveChanges();
                TempData["Success"] = "Asset created succesfully";
                return(RedirectToAction("Index"));
            }

            return(View(asset));
        }
Exemplo n.º 13
0
        private asset UpdateFields(asset assetToUpdate)
        {
            assetToUpdate.dossierId  = this.dossierId;
            assetToUpdate.payable    = decimal.Parse(this.payable);
            assetToUpdate.receivable = decimal.Parse(this.receivable);

            bool isAsset = (assetToUpdate.receivable > assetToUpdate.payable);

            assetToUpdate.assetSubcategoryId = this.assetSubcategoryId;
            assetToUpdate.description        = (this.description == null) ? "" : this.description;

            return(assetToUpdate);
        }
Exemplo n.º 14
0
        public bool NewAssetToDb(AssetModel a)
        {
            var newAsset = new asset {
                assetName = a.Name, assetPrice = a.Price, assetDescription = a.Description
            };

            //newAsset.Id = a.id;

            _db.assets.InsertOnSubmit(newAsset);
            _db.SubmitChanges();

            return(true);
        }
Exemplo n.º 15
0
        // GET: Asset/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            asset asset = db.assets.Find(id);

            if (asset == null)
            {
                return(HttpNotFound());
            }
            return(View(asset));
        }
Exemplo n.º 16
0
        // POST api/Asset
        public HttpResponseMessage Postasset(asset asset)
        {
            if (ModelState.IsValid)
            {
                db.assets.AddObject(asset);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, asset);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = asset.id }));
                return(response);
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 17
0
        public int Update()
        {
            asset assetToUpdate = db.assets.Find(this.assetId);

            if (assetToUpdate == null)
            {
                return(0);
            }

            UpdateFields(assetToUpdate);
            db.Entry(assetToUpdate).State = EntityState.Modified;

            db.SaveChanges();

            return(1);
        }
Exemplo n.º 18
0
            public qnx(qnx old)
            {
                env = new env(old.env);

                author        = old.author;
                authorId      = old.authorId;
                id            = old.id;
                filename      = old.filename;
                name          = old.name;
                description   = old.description;
                publisher     = old.publisher;
                versionNumber = old.versionNumber;

                int assetCount = 5, splashAssetCount = old.splashScreens.images != null ? old.splashScreens.images.Length : 0;

                assets    = new asset[assetCount + splashAssetCount];
                assets[0] = new asset(old.icon.image, old.icon.image);
                assets[1] = new asset("Data", null);
                assets[2] = new asset("lib", null);
                assets[3] = new asset("SLAwards.bundle", "scoreloop/SLAwards.bundle");
                assets[4] = new asset("Release", null);
                for (int i = 0; i != splashAssetCount; ++i)
                {
                    assets[assetCount + i] = new asset(old.splashScreens.images[i], old.splashScreens.images[i]);
                }

                icon          = new icon(old.icon);
                splashScreens = new splashScreens(old.splashScreens);
                initialWindow = new initialWindow(old.initialWindow);
                if (old.configuration != null)
                {
                    configuration = new configuration(old.configuration);
                }

                category    = old.category;
                permissions = new permission[old.permissions.Length];
                for (int i = 0; i != permissions.Length; ++i)
                {
                    permissions[i] = new permission(old.permissions[i]);
                }
            }
Exemplo n.º 19
0
        // DELETE api/Asset/5
        public HttpResponseMessage Deleteasset(int id)
        {
            asset asset = db.assets.Single(a => a.id == id);

            if (asset == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            db.assets.DeleteObject(asset);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, asset));
        }
Exemplo n.º 20
0
        // PUT api/Asset/5
        public HttpResponseMessage Putasset(int id, asset asset)
        {
            if (ModelState.IsValid && id == asset.id)
            {
                db.assets.Attach(asset);
                db.ObjectStateManager.ChangeObjectState(asset, EntityState.Modified);

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 21
0
 public void AddAsset(AssetData item)
 {
     hasError = false;
     try
     {
         TraditionAssetEntities db = new TraditionAssetEntities();
         var data = new asset()
         {
             //asset_id = item.Asset_id,
             os_id                = item.Os_id,
             asset_type_id        = item.Asset_type_id,
             original_supplier_id = item.Original_supplier_id,
             supplier_id          = item.Supplier_id,
             using_by_staff_id    = item.Using_by_staff_id,
             asset_code           = item.Asset_code,
             brand                = item.Brand,
             price                = item.Price,
             cpu   = item.Cpu,
             ram   = item.Ram,
             hdd   = item.Hdd,
             notes = item.Note,
             start_date_warranty  = item.Start_date_warranty,
             expiry_date_warranty = item.Expiry_date_warranty,
             is_active            = item.Is_active,
             create_date          = DateTime.Now,
             modified_date        = DateTime.Now
         };
         db.asset.Add(data);
         db.SaveChanges();
         MessageBox.Show("Insert complete");
     }
     catch (Exception ex)
     {
         errorMessage = "Add error, " + ex.Message;
         hasError     = true;
     }
 }
Exemplo n.º 22
0
        public void ExportToCollada(string outputPath)
        {
            var collada     = new COLLADA();
            var asset       = new asset();
            var contributor = new assetContributor();

            if (ArtToolInfo != null)
            {
                contributor.authoring_tool = ArtToolInfo.FromArtToolName;
            }
            else
            {
                contributor.authoring_tool = "LSLib COLLADA Exporter v" + Common.LibraryVersion();
            }
            asset.contributor = new assetContributor[] { contributor };
            asset.created     = DateTime.Now;
            asset.modified    = DateTime.Now;
            asset.unit        = new assetUnit();
            asset.unit.name   = "meter";
            // TODO: Handle up vector, etc. properly?
            if (ArtToolInfo != null)
            {
                asset.unit.meter = ArtToolInfo.UnitsPerMeter;
            }
            else
            {
                asset.unit.meter = 1;
            }
            asset.up_axis = UpAxisType.Y_UP;
            collada.asset = asset;

            var geometries  = new List <geometry>();
            var controllers = new List <controller>();
            var geomNodes   = new List <node>();

            ExportModels(geometries, controllers, geomNodes);

            var animations     = new List <animation>();
            var animationClips = new List <animation_clip>();

            if (Animations != null)
            {
                foreach (var anim in Animations)
                {
                    var anims = anim.ExportAnimations();
                    animations.AddRange(anims);
                    var clip = new animation_clip();
                    clip.id           = anim.Name + "_Animation";
                    clip.name         = anim.Name;
                    clip.start        = 0.0;
                    clip.end          = anim.Duration;
                    clip.endSpecified = true;

                    var animInstances = new List <InstanceWithExtra>();
                    foreach (var animChannel in anims)
                    {
                        var instance = new InstanceWithExtra();
                        instance.url = "#" + animChannel.id;
                        animInstances.Add(instance);
                    }

                    clip.instance_animation = animInstances.ToArray();
                    animationClips.Add(clip);
                }
            }

            var rootElements = new List <object>();

            if (animations.Count > 0)
            {
                var animationLib = new library_animations();
                animationLib.animation = animations.ToArray();
                rootElements.Add(animationLib);
            }

            if (animationClips.Count > 0)
            {
                var animationClipLib = new library_animation_clips();
                animationClipLib.animation_clip = animationClips.ToArray();
                rootElements.Add(animationClipLib);
            }

            if (geometries.Count > 0)
            {
                var geometryLib = new library_geometries();
                geometryLib.geometry = geometries.ToArray();
                rootElements.Add(geometryLib);
            }

            if (controllers.Count > 0)
            {
                var controllerLib = new library_controllers();
                controllerLib.controller = controllers.ToArray();
                rootElements.Add(controllerLib);
            }

            var visualScenes = new library_visual_scenes();
            var visualScene  = new visual_scene();

            visualScene.id   = "DefaultVisualScene";
            visualScene.name = "unnamed";

            visualScene.node          = geomNodes.ToArray();
            visualScenes.visual_scene = new visual_scene[] { visualScene };

            var visualSceneInstance = new InstanceWithExtra();

            visualSceneInstance.url = "#DefaultVisualScene";
            rootElements.Add(visualScenes);

            var scene = new COLLADAScene();

            scene.instance_visual_scene = visualSceneInstance;
            collada.scene = scene;

            collada.Items = rootElements.ToArray();

            collada.Save(outputPath);
        }
Exemplo n.º 23
0
 => (TryGetResource(asset, dc, out var resource) ? resource.LastUser?.Owner : null) ?? dc.LastUser ?? dc.Owner;
Exemplo n.º 24
0
			public qnx(OldUnityXml.qnx old)
			{
				env = new env(old.env);

				author = old.author;
				authorId = old.authorId;
				id = old.id;
				filename = old.filename;
				name = old.name;
				description = old.description;
				publisher = old.publisher;
				versionNumber = old.versionNumber;

				int assetCount = 5, splashAssetCount = old.splashScreens.images != null ? old.splashScreens.images.Length : 0;
				assets = new asset[assetCount + splashAssetCount];
				assets[0] = new asset(old.icon.image, old.icon.image);
				assets[1] = new asset("Data", null);
				assets[2] = new asset("lib", null);
				assets[3] = new asset("SLAwards.bundle", "scoreloop/SLAwards.bundle");
				assets[4] = new asset("Release", null);
				for (int i = 0; i != splashAssetCount; ++i)
				{
					assets[assetCount+i] = new asset(old.splashScreens.images[i], old.splashScreens.images[i]);
				}

				icon = new icon(old.icon);
				splashScreens = new splashScreens(old.splashScreens);
				initialWindow = new initialWindow(old.initialWindow);
				configuration = new configuration(old);

				category = old.category;
				permissions = new permission[old.actions.Length];
				for (int i = 0; i != permissions.Length; ++i)
				{
					permissions[i] = new permission(old.actions[i]);
				}
			}
Exemplo n.º 25
0
 public bool Put([FromBody] asset ourAsset)
 {
     return(_ourAssetRepository.UpdateAsset(ourAsset));
 }
Exemplo n.º 26
0
    public ExportToCollada(string workingPath)
    {
        this.workingPath = workingPath;
        collada          = new COLLADA();

        geometries = new List <geometry>();
        nodes      = new List <node>();

        meshLookup = new Dictionary <Mesh, string>();

        ass = new asset();

        ass.up_axis       = UpAxisType.Y_UP;
        ass.unit          = new assetUnit();
        ass.unit.meter    = 1;
        ass.unit.name     = "meter";
        libraryGeometries = new library_geometries();
        // create effects
        libraryEffects = new library_effects();
        effects        = new List <effect>();
        effects.Add(new effect());

        var effectId = CreateId();

        effects[0].id    = effectId;
        effects[0].Items = new effectFx_profile_abstractProfile_COMMON[]
        {
            new effectFx_profile_abstractProfile_COMMON()
        };
        effects[0].Items[0].technique     = new effectFx_profile_abstractProfile_COMMONTechnique();
        effects[0].Items[0].technique.sid = "COMMON";
        var phong = new effectFx_profile_abstractProfile_COMMONTechniquePhong();

        effects[0].Items[0].technique.Item = phong;
        SetPhong(phong, new Vector4(0.5f, 0.5f, 0.5f, 1));


        // create materials
        libraryMaterials = new library_materials();
        materials        = new List <material>();
        materials.Add(new material());

        materialId      = CreateId();
        materials[0].id = materialId;

        materials[0].name                = defaultMaterialName;
        materials[0].instance_effect     = new instance_effect();
        materials[0].instance_effect.url = "#" + effectId;

        // create visual scenes
        visualScenes = new library_visual_scenes();

        visualScene = new visual_scene();
        visualScenes.visual_scene = new visual_scene[]
        {
            visualScene
        };
        var visualSceneId = CreateId();

        visualScenes.visual_scene[0].id = visualSceneId;

        libraryImages = new library_images();
        images        = new List <image>();

        Build();

        collada.scene = new COLLADAScene();
        collada.scene.instance_visual_scene = new InstanceWithExtra();



        collada.scene.instance_visual_scene.url = "#" + visualSceneId;
    }
Exemplo n.º 27
0
 public bool Post([FromBody] asset ourAsset)
 {
     return(_ourAssetRepository.InsertAsset(ourAsset));
 }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Label label = new Label();

            // enclosing in try/catch for easier debugging, primarily
            try
            {
                // get a handle to the asset operation service
                proxy = new AssetOperationHandlerService();

                // contruct a path object referencing the 'about' page from the example.com site
                // note:  change this path to a page that actually exists in your cms instance, if necessary
                pagePath = new path();
                // set the relative path (from the Base Folder) to the asset
                pagePath.path1 = "/about";
                // set the site name of the path object (note: set siteName to 'Global' if the asset is not in a Site)
                pagePath.siteName = "example.com";

                // contruct asset identifier used for read() operation
                id = new identifier();
                // set the asset type
                id.type = entityTypeString.page;
                // set asset path (may use either path or id, but never both)
                id.path = pagePath;

                // contruct authentication element to be used in all operations
                auth = new authentication();
                // change username / password as necessary
                auth.username = "******";
                auth.password = "******";

                // attempt to read the asset
                result = proxy.read(auth, id);

                // print asset contents to page label
                label.Text = CascadeWSUtils.printAssetContents(result.asset);

                // edit the asset
                // create an empty asset for use with edit() operation
                // (note: this is assuming the authentication user has bypass workflow abilities --
                // if not, you will also need to supply workflowConfig information)
                asset editAsset = new asset();
                editAsset.page = result.asset.page;
                // add some content to the exiting page xhtml
                editAsset.page.xhtml += "<h1>Added via .NET</h1>";
                // must call this method to avoid sending both id and path values in
                // component references in the asset -- will generate SOAP errors otherwise
                CascadeWSUtils.nullPageValues(editAsset.page);

                // attempt to edit
                operationResult editResult = proxy.edit(auth, editAsset);
                // check results
                label.Text += "<br/><br/>edit success? " + editResult.success + "<br/>message = " + editResult.message;


                // create new asset (using read asset as a model)
                asset newAsset = new asset();
                page  newPage  = result.asset.page;

                // must call this method to avoid sending both id and path values in
                // component references in the asset -- will generate SOAP errors otherwise
                CascadeWSUtils.nullPageValues(newPage);

                // since this will be a new asset, change its name
                newPage.name = "new-page-created-via-dot-net";
                // remove id from read asset
                newPage.id = null;
                // remove other system properties brought over from read asset
                newPage.lastModifiedBy             = null;
                newPage.lastModifiedDate           = null;
                newPage.lastModifiedDateSpecified  = false;
                newPage.lastPublishedBy            = null;
                newPage.lastPublishedDate          = null;
                newPage.lastPublishedDateSpecified = false;
                newPage.pageConfigurations         = null;

                newAsset.page = newPage;

                // attempt to create
                createResult createResults = proxy.create(auth, newAsset);

                // check create results
                label.Text = label.Text + "<br/><br/>create success? " + createResults.success + "<br/>message = " + createResults.message;

                // debugging -- writes the serialzed XML of the asset element sent in create request to a file

                /*
                 * // Serializing the returned object
                 * System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(newAsset.GetType());
                 *
                 * System.IO.MemoryStream ms = new System.IO.MemoryStream();
                 *
                 * x.Serialize(ms, newAsset);
                 *
                 * ms.Position = 0;
                 *
                 * // Outputting to client
                 *
                 * byte[] byteArray = ms.ToArray();
                 *
                 * Response.Clear();
                 * Response.AddHeader("Content-Disposition", "attachment; filename=results.xml");
                 *
                 * Response.AddHeader("Content-Length", byteArray.Length.ToString());
                 *
                 * Response.ContentType = "text/xml";
                 *
                 * Response.BinaryWrite(byteArray);
                 * Response.End();
                 * */
            }
            catch (Exception booboo) { label.Text = "Exception thrown:<br>" + booboo.GetBaseException() + "<br/><br/>STACK TRACE:<br/>" + booboo.StackTrace; }

            WSContent.Controls.Add(label);
        }