Inheritance: MonoBehaviour
Example #1
0
    void Start()
    {
        foreach (Transform child in Content.transform)
        {
            Destroy(child.gameObject);
        }


        Spell[] spells = Resources.LoadAll <Spell>("Spells");

        ScrollView.verticalNormalizedPosition = 1;
        for (int i = 0; i < spells.Length; i++)
        {
            GameObject spawnedItem = Instantiate(ItemPrefab);
            Button     button      = spawnedItem.GetComponent <Button>();
            int        index       = i;
            if (button != null)
            {
                button.onClick.AddListener(() => SpellListClick(spells[index]));
            }
            spawnedItem.transform.SetParent(Content.transform, false);

            ItemDetails <Spell> itemDetails = spawnedItem.GetComponentInChildren <ItemDetails <Spell> >();
            itemDetails.Text.text = spells[i].Name;
            itemDetails.Class     = spells[i];
        }
    }
        public static ItemDetails[] BindGrptable()
        {
            DataTable dt = new DataTable();
            List<ItemDetails> details = new List<ItemDetails>();
            //InterfacesBS.InterfacesBL.InterfaceItems allData = new BusinessLogicBS.BusinessClasses.ItemsClass();
            budhashop.CLASS.CallCache callCache = new budhashop.CLASS.CallCache();

            DataSet allDataDS = callCache.getCache();
            dt = allDataDS.Tables[1];

            foreach (DataRow dtrow in dt.Rows)
            {

                ItemDetails user = new ItemDetails();
                user.ItemId = dtrow["GroupId"].ToString();
                user.ItemName = dtrow["GroupName"].ToString();
                user.ItemPath = dtrow["ImagePath"].ToString();
                user.ItemPrice = dtrow["BilledRate"].ToString();
                user.CatId = "1";
                details.Add(user);

            }

            return details.ToArray();
        }
    public ItemDetails NextItem()
    {
        ItemDetails item = inventoryDetails[pos];

        pos++;
        return(item);
    }
Example #4
0
 public EmailInvoiceItem(ItemDetails itemDetails, string cultureCode)
 {
     this.Name = itemDetails.Item;
     this.PicUrl = itemDetails.PicUrl;
     this.Quantity = itemDetails.Quantity;
     this.Total = itemDetails.TotalPlusVAT.ToString("C", new CultureInfo(cultureCode));
 }
        public static ItemDetails[] BindDatatable()
        {
            DataTable dt = new DataTable();
            List<ItemDetails> details = new List<ItemDetails>();
            //InterfacesBS.InterfacesBL.InterfaceItems allData = new BusinessLogicBS.BusinessClasses.ItemsClass();
            budhashop.CLASS.CallCache callCache = new budhashop.CLASS.CallCache();

            DataSet allDataDS = callCache.getCache();
            dt = allDataDS.Tables[0];

            foreach (DataRow dtrow in dt.Rows)
            {
                bool FeatureChk = bool.Parse(dtrow["FeaturedFlag"].ToString());
                //int category = int.Parse(dtrow["CategoryId"].ToString());
                if (FeatureChk)//&& category == int.Parse(CatgId)
                {
                    ItemDetails user = new ItemDetails();
                    user.ItemId = dtrow["ItemId"].ToString();
                    user.ItemPath = dtrow["ImagePath"].ToString();
                    user.ItemName = dtrow["ItemName"].ToString();
                    user.ItemPrice = dtrow["BilledRate"].ToString();
                    user.CatId = dtrow["CategoryId"].ToString();
                    details.Add(user);
                }
            }

            return details.ToArray();
        }
    public void AddItem(ItemDetails newItem)
    {
        item = newItem;

        icon.sprite  = item.icon;
        icon.enabled = true;
    }
Example #7
0
        public void Test_Create_ItemDetails_Without_Item()
        {
            Assert.Throws(typeof(ValidationException), () =>
            {
                ItemDetails itemDetails = new ItemDetails();

                Assert.NotNull(itemDetails);
                Validator.ValidateObject(itemDetails, new ValidationContext(itemDetails));
            });
        }
 public ActionResult Create(ItemDetails item)
 {
     SelectItemListCreate();
     try
     {
         UpdateModel(item);
         db.InsertItem(db.paramAddItem(item), item.Quantity);
         return RedirectToAction("Index");
     }
     catch { return View(); }
 }
Example #9
0
        private ItemDetails GetRandomItem()
        {
            ItemDetails item = new ItemDetails();
            item.Item = Guid.NewGuid().ToString();
            Random rnd = new Random();
            item.Quantity = rnd.Next(100000);
            item.Price = rnd.Next(999999999);
            item.VAT = rnd.Next(100);
            item.Weight = rnd.Next(100);

            return item;
        }
        public ActionResult Edit(int id, ItemDetails data)
        {
            ItemDetails item = db.getAllDetails.Single(i => i.itemID == id);
            SelectItemListEdit(item.categoryID, item.brandID, item.typeID);

            try
            {
                UpdateModel(data);
                db.paramQuery("edit_item_details", db.paramEditItem(data, id));
                return RedirectToAction("Index");
            }
            catch  { return View(item);  }
        }
Example #11
0
        public void Test_Create_InvoiceItem_Quantity_WrongRange()
        {
            List<ValidationResult> validationResults = new List<ValidationResult>();
            ItemDetails itemDetails = new ItemDetails();
            itemDetails.Item = "Test Item";
            itemDetails.Quantity = 0;
            itemDetails.Price = 10;

            Assert.IsFalse(Validator.TryValidateObject(itemDetails, new ValidationContext(itemDetails), validationResults, true));

            itemDetails.Quantity = 2;
            Assert.IsTrue(Validator.TryValidateObject(itemDetails, new ValidationContext(itemDetails), validationResults, true));
            Assert.AreEqual(2, itemDetails.Quantity);
        }
Example #12
0
        public void Test_Create_ItemDetails_With_Item()
        {
            Assert.DoesNotThrow(() =>
            {
                ItemDetails itemDetails = new ItemDetails();
                itemDetails.Item = "Test Item";

                Assert.NotNull(itemDetails);
                Assert.NotNull(itemDetails.Item);
                Assert.AreEqual("Test Item", itemDetails.Item);

                Validator.ValidateObject(itemDetails, new ValidationContext(itemDetails));
            });
        }
        public static ItemDetails[] GetOrderedItems(string itemString, string sizeString)
        {
            DataSet itemData = new DataSet();
            itemData = (DataSet)System.Web.HttpContext.Current.Cache["CacheItemsObj"];
            DataTable dt = itemData.Tables[0];
            DataTable dtg = itemData.Tables[1];

            List<ItemDetails> totalDetails = new List<ItemDetails>();

            var itemsArray = itemString.Split(';');
            var sizeArray = sizeString.Split(';');
            for (var i = 0; i < itemsArray.Length - 1; i++)
            {
                var items = itemsArray[i].Split(',');
                int itemId = int.Parse(items[0].ToString());
                int qty = int.Parse(items[1].ToString());

                var itemDetails = dt.AsEnumerable().First(p => p.Field<long>("ItemId") == itemId);
                if (itemDetails == null)
                {
                    itemDetails = dtg.AsEnumerable().First(p => p.Field<long>("ItemId") == itemId);
                }

                if (itemDetails != null)
                {
                    ItemDetails details = new ItemDetails();
                    details.ItemId = itemDetails["ItemId"].ToString();
                    details.ItemPath = itemDetails["ImagePath"].ToString();
                    details.ItemName = itemDetails["ItemName"].ToString();
                    details.ItemQty = qty.ToString();
                    float blrte = float.Parse(itemDetails["BilledRate"].ToString());
                    details.BilledRate = blrte.ToString();
                    float totRate = qty * (float.Parse(itemDetails["BilledRate"].ToString()));
                    details.TotalRate = totRate.ToString();
                    if (sizeArray[i].Contains("undefined"))
                    {
                        details.Size = "";
                    }
                    else
                    {
                        details.Size = sizeArray[i];
                    }

                    totalDetails.Add(details);
                }

            }
            return totalDetails.ToArray();
        }
Example #14
0
        public void Test_Create_InvoiceItem_VAT_Wrong_Range()
        {
            List<ValidationResult> validationResults = new List<ValidationResult>();

            ItemDetails itemDetails = new ItemDetails();
            itemDetails.Item = "Test Item";
            itemDetails.Quantity = 1;
            itemDetails.Price = 0.2m;
            itemDetails.VAT = 200;

            Assert.IsFalse(Validator.TryValidateObject(itemDetails, new ValidationContext(itemDetails), validationResults, true));

            itemDetails.VAT = 70;
            Assert.IsTrue(Validator.TryValidateObject(itemDetails, new ValidationContext(itemDetails), validationResults, true));
            Assert.AreEqual(70, itemDetails.VAT);
        }
        private int checkfoOverwrite(ItemDetails item, LocalEvents lEvent)
        {
            int nStatusCode = 0;
            if (!checkFileTooLarge(lEvent.FullPath))
               //cMezeoFileCloud.OverWriteFile(lEvent.FullPath, item.szContentUrl, ref nStatusCode);
                cMezeoFileCloud.UploadingFileOnResume(lEvent.FullPath, item.szContentUrl, ref nStatusCode);
            else
                nStatusCode = 200;

            if (nStatusCode == ResponseCode.LOGINFAILED1 || nStatusCode == ResponseCode.LOGINFAILED2)
            {
                return LOGIN_FAILED;
            }
            else if (nStatusCode != ResponseCode.OVERWRITEFILE)
            {
                if (ResponseCode.NOTFOUND == nStatusCode)
                    return ITEM_NOT_FOUND;
                return SERVER_INACCESSIBLE;
            }
            else
            {
                MarkParentsStatus(lEvent.FullPath, DB_STATUS_SUCCESS);
                UpdateDBForModifiedSuccess(lEvent, item.szContentUrl);
                dbHandler.DeleteEvent(lEvent.EventDbId);
            }

            return nStatusCode;
        }
Example #16
0
        public static ItemDetails[] itemInfo(string itemId, string grp)
        {
            DataTable dt = new DataTable();
            DataTable dtg = new DataTable();
            List<ItemDetails> details = new List<ItemDetails>();
            //InterfacesBS.InterfacesBL.InterfaceItems allData = new BusinessLogicBS.BusinessClasses.ItemsClass();
            budhashop.CLASS.CallCache callCache = new budhashop.CLASS.CallCache();

            DataSet allDataDS = callCache.getCache();
            dt = allDataDS.Tables[0];
            dtg = allDataDS.Tables[1];
            int chk = Int32.Parse(grp.ToString());
            if (chk == 1)
            {
                var cartItem = dtg.AsEnumerable().First(p => p.Field<long>("GroupId") == long.Parse(itemId));
                ItemDetails user = new ItemDetails();
                user.ItemId = cartItem["GroupId"].ToString();
                user.ItemName = cartItem["GroupName"].ToString();
                user.ItemDesc = cartItem["Description"].ToString();
                user.ItemPath = cartItem["ImagePath"].ToString(); //change this to actual image path when done
                user.ItemPrice = cartItem["BilledRate"].ToString();
                user.ItemQty = cartItem["Qty"].ToString();
                user.CatId = "1";

                details.Add(user);

            }
            else
            {
                var cartItem = dt.AsEnumerable().First(p => p.Field<long>("ItemId") == long.Parse(itemId));
                ItemDetails user = new ItemDetails();
                user.ItemId = cartItem["ItemId"].ToString();
                user.ItemName = cartItem["ItemName"].ToString();
                user.ItemDesc = cartItem["Description"].ToString();
                user.ItemPath = cartItem["ImagePath"].ToString();
                user.ItemPrice = cartItem["BilledRate"].ToString();
                user.ItemQty = cartItem["Qty"].ToString();
                user.CatId = cartItem["CategoryId"].ToString();
                user.Type = cartItem["TypeItem"].ToString();

                details.Add(user);

            }

            return details.ToArray();
        }
        private static List<ReleaseDefinition.RDArtifact> getArtifactsFromRDJson(dynamic artifacts)
        {
            List<ReleaseDefinition.RDArtifact> artifactsList = new List<ReleaseDefinition.RDArtifact>();
            if(artifacts != null)
            {
                foreach(var a in artifacts)
                {
                    ReleaseDefinition.RDArtifact artifact = new ReleaseDefinition.RDArtifact
                    {
                        Id = a.id,
                        Alias = a.alias,
                        Type = a.type
                    };

                    var adr = a.definitionReference;

                    artifact.DefinitionReference = new ReleaseDefinition.RDArtifact.DefinitionRef();
                    if (adr != null)
                    {
                        if (adr.definition != null)
                        {
                            ItemDetails definition = new ItemDetails();

                            definition.Id = adr.definition.id;
                            definition.Name = adr.definition.name;

                            artifact.DefinitionReference.Definition = definition;
                        }

                        if(adr.project != null)
                        {
                            ItemDetails project = new ItemDetails();
                            project.Id = adr.project.id;
                            project.Name = adr.project.name;
                            artifact.DefinitionReference.Project = project;
                        }
                    }

                    artifactsList.Add(artifact);
                }
            }

            return artifactsList;
        }
Example #18
0
        public void Test_Create_InvoiceItem_CreatedTime()
        {
            List<ValidationResult> validationResults = new List<ValidationResult>();

            ItemDetails itemDetails = new ItemDetails();
            itemDetails.Item = "Test Item";
            itemDetails.Quantity = 1;
            itemDetails.Price = 0.2m;
            itemDetails.VAT = 200;

            Assert.That(itemDetails.CreatedTime.HasValue);
        }
        private int DownloadFolderStructureForNQ(ItemDetails iDetail,string strParentKey)
        {
            //LogWrapper.LogMessage("frmSyncManager - DownloadFolderStructureForNQ", "enter");
            //bool bIssuccess = false;
            int nStatus = 0;
            FileFolderInfo fileFolderInfo = new FileFolderInfo();

            fileFolderInfo.IsPublic = iDetail.bPublic;
            fileFolderInfo.IsShared = iDetail.bShared;
            fileFolderInfo.ContentUrl = iDetail.szContentUrl;
            fileFolderInfo.CreatedDate = iDetail.dtCreated;
            fileFolderInfo.FileName = iDetail.strName;
            fileFolderInfo.FileSize = iDetail.dblSizeInBytes;
            fileFolderInfo.MimeType = iDetail.szMimeType;
            fileFolderInfo.ModifiedDate = iDetail.dtModified;
            fileFolderInfo.ParentUrl = iDetail.szParentUrl;
            fileFolderInfo.Status = DB_STATUS_IN_PROGRESS;
            fileFolderInfo.Type = iDetail.szItemType;
            fileFolderInfo.Key = strParentKey + "\\" + iDetail.strName;

            string strPath = BasicInfo.SyncDirPath + "\\" + fileFolderInfo.Key;

            int nStatusCode = 0;
            bool bRet = false;
            int lastSepIndex = fileFolderInfo.Key.LastIndexOf("\\");
            string parentDirPath = "";

            if (lastSepIndex != -1)
            {
                parentDirPath = fileFolderInfo.Key.Substring(0, fileFolderInfo.Key.LastIndexOf("\\"));
                parentDirPath = parentDirPath.Substring(parentDirPath.LastIndexOf("\\") + 1);
            }

            fileFolderInfo.ParentDir = parentDirPath;

            if (fileFolderInfo.ETag == null) { fileFolderInfo.ETag = ""; }
            if (fileFolderInfo.MimeType == null) { fileFolderInfo.MimeType = ""; }

            dbHandler.Write(fileFolderInfo);

            string strEtag = "";
            int refCode = 0;

            if (iDetail.szItemType == "FILE")
            {
                MarkParentsStatus(strPath, DB_STATUS_IN_PROGRESS);
                bRet = cMezeoFileCloud.DownloadFile(iDetail.szContentUrl + '/' + iDetail.strName, strPath,iDetail.dblSizeInBytes, ref nStatusCode);
                if (nStatusCode == ResponseCode.LOGINFAILED1 || nStatusCode == ResponseCode.LOGINFAILED2)
                {
                    return nStatusCode;
                }
                else if (nStatusCode != ResponseCode.DOWNLOADFILE)
                {
                    return nStatusCode;
                }
                if (bRet)
                {
                    strEtag = cMezeoFileCloud.GetETag(iDetail.szContentUrl, ref refCode);
                    if (refCode == ResponseCode.LOGINFAILED1 || refCode == ResponseCode.LOGINFAILED2)
                    {
                        return refCode;
                    }
                    else if (refCode != ResponseCode.GETETAG)
                    {
                        return refCode;
                    }
                    FileInfo fInfo = new FileInfo(strPath);
                    dbHandler.UpdateModifiedDate(fInfo.LastWriteTime, fileFolderInfo.Key);
                    dbHandler.Update(DbHandler.TABLE_NAME, DbHandler.E_TAG , strEtag , DbHandler.KEY , fileFolderInfo.Key );
                    dbHandler.Update(DbHandler.TABLE_NAME, DbHandler.STATUS , "SUCCESS", DbHandler.KEY ,fileFolderInfo.Key );
                }
                MarkParentsStatus(strPath, DB_STATUS_SUCCESS);
                nStatus = 1;
            }
            else
            {
                MarkParentsStatus(strPath, DB_STATUS_IN_PROGRESS);
                Directory.CreateDirectory(strPath);

                strEtag = cMezeoFileCloud.GetETag(iDetail.szContentUrl, ref refCode);
                if (refCode == ResponseCode.LOGINFAILED1 || refCode == ResponseCode.LOGINFAILED2)
                {
                    return refCode;
                }
                else if (refCode != ResponseCode.GETETAG)
                {
                    return refCode;
                }

                DirectoryInfo dInfo = new DirectoryInfo(strPath);
                dbHandler.UpdateModifiedDate(dInfo.LastWriteTime, fileFolderInfo.Key);
                dbHandler.Update(DbHandler.TABLE_NAME, DbHandler.E_TAG , strEtag , DbHandler.KEY , fileFolderInfo.Key );
                dbHandler.Update(DbHandler.TABLE_NAME, DbHandler.STATUS , "SUCCESS", DbHandler.KEY ,fileFolderInfo.Key );

                MarkParentsStatus(strPath, DB_STATUS_SUCCESS);

                ItemDetails[] iDetails = cMezeoFileCloud.DownloadItemDetails(iDetail.szContentUrl, ref nStatusCode, null);
                if (nStatusCode == ResponseCode.LOGINFAILED1 || nStatusCode == ResponseCode.LOGINFAILED2)
                {
                    return nStatusCode;
                }
                else if (nStatusCode == ResponseCode.INTERNAL_SERVER_ERROR)
                {
                    // Don't do anything, just keep on chugging.
                }
                else if (nStatusCode != ResponseCode.DOWNLOADITEMDETAILS)
                {
                    return nStatusCode;
                }
                if (iDetails != null)
                {
                    for (int num = 0; num < iDetails[0].nTotalItem; num++)
                    {
                        nStatus = DownloadFolderStructureForNQ(iDetails[num], fileFolderInfo.Key);
                        if (nStatus == ResponseCode.LOGINFAILED1 || nStatus == ResponseCode.LOGINFAILED2)
                        {
                            return nStatus;
                        }
                        else if (nStatus != ResponseCode.GETETAG && nStatus != ResponseCode.DOWNLOADFILE && nStatus != ResponseCode.DOWNLOADITEMDETAILS)
                        {
                            return nStatus;
                        }
                    }
                }
                else
                    nStatus = 1;
            }

            //LogWrapper.LogMessage("frmSyncManager - DownloadFolderStructureForNQ", "leave");
            return nStatus;
        }
Example #20
0
		public Item()
		{
			Details = new ItemDetails();
		}
    // Get item details
    public static ItemDetails GetItemDetails(string itemId)
    {
        // get a configured DbCommand object
        DbCommand comm = GenericDataAccess.CreateCommand();

        // set the stored procedure name
        comm.CommandText = "JDwebstore-CatalogGetItemDetails";

        // create a new parameter
        DbParameter param = comm.CreateParameter();
        param.ParameterName = "@ItemID";
        param.Value = itemId;
        param.DbType = DbType.String;
        comm.Parameters.Add(param);

        // execute the stored procedure
        DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);

        // wrap retrieved data into an ItemDetails object
        ItemDetails details = new ItemDetails();

        if (table.Rows.Count > 0) {
            DataRow dr = table.Rows[0];

            // get item details
            details.ItemID = itemId;
            details.Name = dr["Name"].ToString();
            details.Description = dr["Description"].ToString();
            details.Price = Decimal.Parse(dr["Price"].ToString());
            details.Thumbnail = dr["Thumbnail"].ToString();
            details.Image = dr["Image"].ToString();
            details.OnFront = bool.Parse(dr["OnFront"].ToString());
        }

        // return item details
        return details;
    }
Example #22
0
        public static ItemDetails[] BindItemsData(string CatgId, string SubCatId)
        {
            DataTable dt = new DataTable();
            List<ItemDetails> details = new List<ItemDetails>();
            //InterfacesBS.InterfacesBL.InterfaceItems allData = new BusinessLogicBS.BusinessClasses.ItemsClass();
            budhashop.CLASS.CallCache callCache = new budhashop.CLASS.CallCache();

            DataSet allDataDS = callCache.getCache();
            dt = allDataDS.Tables[0];

            foreach (DataRow dtrow in dt.Rows)
            {

                int category = int.Parse(dtrow["CategoryId"].ToString());
                string subCatagoryId = dtrow["SubCatId"].ToString();
                if (SubCatId == "" || SubCatId == "undefined" || SubCatId == "true")
                {
                    if (category == int.Parse(CatgId))
                    {
                        ItemDetails user = new ItemDetails();
                        user.ItemId = dtrow["ItemId"].ToString();
                        user.ItemPath = dtrow["ImagePath"].ToString();
                        user.ItemName = dtrow["ItemName"].ToString();
                        user.ItemPrice = dtrow["BilledRate"].ToString();
                        user.CatId = dtrow["CategoryId"].ToString();
                        details.Add(user);
                    }
                }
                else
                {
                    if (subCatagoryId == SubCatId && category == int.Parse(CatgId))
                    {
                        ItemDetails user = new ItemDetails();
                        user.ItemId = dtrow["ItemId"].ToString();
                        user.ItemPath = dtrow["ImagePath"].ToString();
                        user.ItemName = dtrow["ItemName"].ToString();
                        user.ItemPrice = dtrow["BilledRate"].ToString();
                        user.CatId = dtrow["CategoryId"].ToString();
                        details.Add(user);
                    }
                }
            }

            return details.ToArray();
        }
        public void PopulateLocalItemDetailsEventFromReader(ref LocalItemDetails item, ref SQLiteDataReader sqlDataReader)
        {
            try
            {
                ItemDetails itemDetails = new ItemDetails();
                item.EventDbId = (Int64)sqlDataReader[EVENT_INDEX];
                itemDetails.dblSizeInBytes = (Int64)sqlDataReader[EVENT_INITIAL_SIZE];
                itemDetails.bPublic = (bool)sqlDataReader[EVENT_INITIAL_PUBLIC];
                itemDetails.bShared = (bool)sqlDataReader[EVENT_INITIAL_SHARED];
                itemDetails.nTotalItem = (int)((Int64)sqlDataReader[EVENT_INITIAL_TOTAL]);
                itemDetails.dtCreated.AddTicks(Int64.Parse((string)sqlDataReader[EVENT_NQ_TIME]));
                itemDetails.dtModified.AddTicks((Int64)sqlDataReader[EVENT_LOCAL_TIMESTAMP]);
                itemDetails.strETag = (string)sqlDataReader[EVENT_LOCAL_OLD_FILE_NAME];
                itemDetails.strName = (string)sqlDataReader[EVENT_LOCAL_FILE_NAME];
                itemDetails.szParentUrl = (string)sqlDataReader[EVENT_NQ_PARENT_URI];
                item.Path = (string)sqlDataReader[EVENT_LOCAL_OLD_FULL_PATH];
                itemDetails.szContentUrl = (string)sqlDataReader[EVENT_LOCAL_FULL_PATH];
                itemDetails.szItemType = (string)sqlDataReader[EVENT_INITIAL_TYPE];
                //public string szMimeType;       // Always set to null/emtpy.
                //public DateTime dtAccessed;     // Never set or used.
                //public int nCurrentPosition;    // Never set or used.

                // Due to the class, I have to assign all the details at once instead of individually.
                item.ItemDetails = itemDetails;
            }
            catch (Exception ex)
            {
                LogWrapper.LogMessage("DbHandler - PopulateLocalItemDetailsEventFromReader", "Caught exception: " + ex.Message);
                item = null;
            }
        }
Example #24
0
        public void Test_Create_ItemDetails()
        {
            ItemDetails itemDetails = new ItemDetails();

            Assert.NotNull(itemDetails);
        }
Example #25
0
    public ErrCode SaveSchemaTran(ItemDetails[] schema, out ItemDetails[] so)
    {
        so = null;

        ErrCode err = SiteProvider.CurrentProvider.SaveSchemaTran(schema, out so);

        return err;
    }
Example #26
0
        public void Test_Create_InvoiceItem_GeneratedFields()
        {
            List<ValidationResult> validationResults = new List<ValidationResult>();

            ItemDetails itemDetails = new ItemDetails();
            itemDetails.Item = "Test Item";
            itemDetails.Quantity = 1;
            itemDetails.Price = 0.2m;
            itemDetails.VAT = 100;

            Assert.AreEqual(1 * 0.2, itemDetails.Total);
            Assert.AreEqual(itemDetails.Total * (1 + itemDetails.VAT / 100), itemDetails.TotalPlusVAT);
            Assert.AreEqual(itemDetails.TotalPlusVAT - itemDetails.Total, itemDetails.VATAmount);
        }
        public void analyseItemDetails(ItemDetails itemDetail,string strPath)
        {
            LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Enter");
            int refCode = 0;
            ItemDetails[] contents = cFileCloud.DownloadItemDetails(itemDetail.szContentUrl, ref refCode, null);

            if (refCode == ResponseCode.LOGINFAILED1 || refCode == ResponseCode.LOGINFAILED2)
            {
                //lockObject.StopThread = true;
                CancelAndNotify(CancelReason.LOGIN_FAILED);
                return;
            }
            else if (refCode == -1)
            {
                // The socket timed out or something else occured.  Let the normal timer
                // handle the online/offline mode stuff and just return as if normal
                // processing occured.  Otherwise, the sync will never progress past
                // this point.
                return;
            }
            else if (refCode != ResponseCode.DOWNLOADITEMDETAILS)
            {
                //lockObject.StopThread = true;
                CancelAndNotify(CancelReason.SERVER_INACCESSIBLE);
                return;
            }

            if (contents == null)
            {
                LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Contents Null");
                return;
            }

            foreach (ItemDetails iDetail in contents)
            {
                LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Checking KEY in DB for content url: " + iDetail.szContentUrl + " with SUCCESS");

                string strCheck = dbhandler.GetString(DbHandler.TABLE_NAME, DbHandler.KEY, new string[] { DbHandler.CONTENT_URL, DbHandler.STATUS }, new string[] { iDetail.szContentUrl, "SUCCESS" }, new System.Data.DbType[] { System.Data.DbType.String, System.Data.DbType.String });
                if (strCheck.Trim().Length == 0)
                {
                    LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "KEY for content url: " + iDetail.szContentUrl + " with SUCCESS not found in DB");
                    LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Creating a new LocalItemDetails with Path: " + iDetail.strName);
                    LocalItemDetails lItem = new LocalItemDetails();
                    lItem.ItemDetails = iDetail;
                    lItem.Path += strPath;
                    lItem.Path += "\\" + iDetail.strName;
                    totalFileCount++;
                    LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "totalFileCount: " + totalFileCount + "\n Calling PrepareStructure with lItem");
                    PrepareStructure(lItem);
                    LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "returned from PrepareStructure");
                }
            }

            LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Contents total item count: " + contents[0].nTotalItem);
            if (contents[0].nTotalItem > 0)
            {
                for (int n = 0; n < contents[0].nTotalItem; n++)
                {
                    //if (lockObject.StopThread /*|| refCode != 200*/)
                    //{
                    //    LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Stop thread requested Calling CancelAndNotify");
                    //    CancelAndNotify(CancelReason.USER_CANCEL);
                    //    break;
                    //}

                    if (contents[n].szItemType == "DIRECTORY")
                    {
                        LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Calling analyseItemDetails for DIR: " + contents[n].strName);
                        analyseItemDetails(contents[n], strPath + "\\" + contents[n].strName);
                    }
                }
            }

            LogWrapper.LogMessage("StructureDownloader - analyseItemDetails", "Leave");
        }
Example #28
0
        public static ItemDetails[] SearchItemNames(string searchStr)
        {
            DataTable dt = new DataTable();
            DataTable dtg = new DataTable();
            List<ItemDetails> details = new List<ItemDetails>();
            //InterfacesBS.InterfacesBL.InterfaceItems allData = new BusinessLogicBS.BusinessClasses.ItemsClass();
            budhashop.CLASS.CallCache callCache = new budhashop.CLASS.CallCache();

            DataSet allDataDS = callCache.getCache();
            dt = allDataDS.Tables[0];
            dtg = allDataDS.Tables[1];
            var cartItemgrp = dtg.AsEnumerable().Where(p => p.Field<string>("GroupName").ToLower().Contains(searchStr.ToLower())).ToList(); ;
            var cartItem = dt.AsEnumerable().Where(p => p.Field<string>("ItemName").ToLower().Contains(searchStr.ToLower())).ToList(); ;

            foreach (DataRow dtrow in cartItemgrp)
            {

                ItemDetails user = new ItemDetails();
                user.ItemId = dtrow["GroupId"].ToString();
                user.ItemName = dtrow["GroupName"].ToString();
                user.ItemDesc = dtrow["Description"].ToString();
                user.ItemPath = dtrow["ImagePath"].ToString();//change this to actual image path when done
                user.ItemPrice = dtrow["BilledRate"].ToString();
                user.ItemQty = dtrow["Qty"].ToString();
                user.CatId = "1";

                details.Add(user);

            }
            foreach (DataRow dtrow in cartItem)
            {

                ItemDetails user = new ItemDetails();
                user.ItemId = dtrow["ItemId"].ToString();
                user.ItemName = dtrow["ItemName"].ToString();
                user.ItemDesc = dtrow["Description"].ToString();
                user.ItemPath = dtrow["ImagePath"].ToString();
                user.ItemPrice = dtrow["BilledRate"].ToString();
                user.ItemQty = dtrow["Qty"].ToString();
                user.CatId = dtrow["CategoryId"].ToString();

                details.Add(user);

            }

            return details.ToArray();
        }