// Creates the information of the levels of perks (prices and values) private void AllPerkInfo() { store5050Price = 75; storeVaultInfo[0] = new StoreItemInfo(0, 0, 0); storeVaultInfo[1] = new StoreItemInfo(100, 20, 0); storeVaultInfo[2] = new StoreItemInfo(250, 30, 0); storeVaultInfo[3] = new StoreItemInfo(475, 40, 0); storeVaultInfo[4] = new StoreItemInfo(800, 45, 0); storeVaultInfo[5] = new StoreItemInfo(1250, 50, 0); storeComboMultInfo[0] = new StoreItemInfo(0, 0.2f, 0); storeComboMultInfo[1] = new StoreItemInfo(225, 0.35f, 0); storeComboMultInfo[2] = new StoreItemInfo(525, 0.45f, 0); storeComboMultInfo[3] = new StoreItemInfo(900, 0.5f, 0); storeMoreMoneyInfo[0] = new StoreItemInfo(0, 1f, 0); storeMoreMoneyInfo[1] = new StoreItemInfo(650, 1.5f, 0); storeMoreMoneyInfo[2] = new StoreItemInfo(1050, 1.75f, 0); storeMoreMoneyInfo[3] = new StoreItemInfo(1500, 2f, 0); storeBonusTimeInfo[0] = new StoreItemInfo(0, 0, 0); storeBonusTimeInfo[1] = new StoreItemInfo(875, 30f, 10f); storeBonusTimeInfo[2] = new StoreItemInfo(1450, 35f, 15f); storeBonusTimeInfo[3] = new StoreItemInfo(2100, 40f, 20f); }
public int Insert(int publishmentSystemID, StoreItemInfo storeItemInfo) { var storeItemID = 0; IDataParameter[] parms = null; var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(storeItemInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SQL_INSERT, parms); storeItemID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME); trans.Commit(); } catch { trans.Rollback(); throw; } } } DataProviderWX.StoreCategoryDAO.UpdateStoreItemCount(publishmentSystemID); return(storeItemID); }
public List <StoreItemInfo> GetStoreItemInfoListByCategoryId(int publishmentSystemId, int categoryId) { var list = new List <StoreItemInfo>(); StringBuilder builder; if (categoryId == 0) { builder = new StringBuilder($"WHERE {StoreItemAttribute.PublishmentSystemId} = {publishmentSystemId} "); } else { builder = new StringBuilder( $"WHERE {StoreItemAttribute.PublishmentSystemId} = {publishmentSystemId} AND {StoreItemAttribute.CategoryId} = {categoryId} "); } var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, builder.ToString(), "ORDER BY ID"); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var storeItemInfo = new StoreItemInfo(rdr); list.Add(storeItemInfo); } rdr.Close(); } return(list); }
public int CheckIfNull(StoreItemInfo x, StoreItemInfo y) { if (x == null) { if (y == null) { return(0); } else { return(-1); } } else { if (y == null) { return(1); } else { return(-10); // Not null; } } }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var storeItemInfo = new StoreItemInfo(e.Item.DataItem); var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal; var ltlStoreName = e.Item.FindControl("ltlStoreName") as Literal; var ltlStoreCategoryName = e.Item.FindControl("ltlStoreCategoryName") as Literal; var ltlTel = e.Item.FindControl("ltlTel") as Literal; var ltlMobile = e.Item.FindControl("ltlMobile") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlStoreName.Text = storeItemInfo.StoreName; if (storeItemInfo.CategoryID > 0) { ltlStoreCategoryName.Text = DataProviderWX.StoreCategoryDAO.GetStoreCategoryInfo(storeItemInfo.CategoryID).CategoryName.ToString(); } else { ltlStoreCategoryName.Text = ""; } ltlTel.Text = storeItemInfo.Tel; ltlMobile.Text = storeItemInfo.Mobile; var urlEdit = BackgroundStoreItemAdd.GetRedirectUrl(PublishmentSystemID, storeItemInfo.ID, storeID); ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>"; } }
public int Insert(int publishmentSystemId, StoreItemInfo storeItemInfo) { var storeItemId = 0; IDataParameter[] parms = null; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(storeItemInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { storeItemId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } DataProviderWx.StoreCategoryDao.UpdateStoreItemCount(publishmentSystemId); return(storeItemId); }
public int CheckIfNull(StoreItemInfo x, StoreItemInfo y) { if (x == null) { if (y == null) { return 0; } else { return -1; } } else { if (y == null) { return 1; } else { return -10; // Not null; } } }
int CheckDetailIsValid(StoreItemInfo x, StoreItemInfo y) { //TODO Check for validation int returened = -10; //if (string.IsNullOrEmpty(x["Detail"].ToString())) //{ // if (string.IsNullOrEmpty(y["Detail"].ToString())) // { // returened = 0; // } // else // { // returened = 1; // } //} //else //{ // if (string.IsNullOrEmpty(y["Detail"].ToString())) // { // returened = -1; // } // else // { // returened = -10; // Not null; // } //} return(returened); }
public void Update(int publishmentSystemID, StoreItemInfo storeItemInfo) { IDataParameter[] parms = null; var SQL_UPDATE = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(storeItemInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); ExecuteNonQuery(SQL_UPDATE, parms); DataProviderWX.StoreCategoryDAO.UpdateStoreItemCount(publishmentSystemID); }
public void Update(int publishmentSystemId, StoreItemInfo storeItemInfo) { IDataParameter[] parms = null; var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(storeItemInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); ExecuteNonQuery(sqlUpdate, parms); DataProviderWx.StoreCategoryDao.UpdateStoreItemCount(publishmentSystemId); }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var conflictKeywords = string.Empty; var storeItemInfo = new StoreItemInfo(); if (storeItemID > 0) { storeItemInfo = DataProviderWX.StoreItemDAO.GetStoreItemInfo(storeItemID); } storeItemInfo.PublishmentSystemID = PublishmentSystemID; storeItemInfo.StoreID = storeID; storeItemInfo.CategoryID = Convert.ToInt32(ddlStoreCategoryName.SelectedValue); storeItemInfo.StoreName = tbStoreName.Text; storeItemInfo.Tel = tbStoreTel.Text; storeItemInfo.Mobile = tbStoreMobile.Text; storeItemInfo.Address = tbStoreAddress.Text; storeItemInfo.ImageUrl = imageUrl.Value; storeItemInfo.Latitude = txtLatitude.Value; storeItemInfo.Longitude = txtLongitude.Value; storeItemInfo.Summary = tbSummary.Text; try { if (storeItemID > 0) { DataProviderWX.StoreItemDAO.Update(PublishmentSystemID, storeItemInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改微门店信息", $"微门店:{tbStoreName.Text}"); SuccessMessage("修改微门店成功!"); } else { storeItemID = DataProviderWX.StoreItemDAO.Insert(PublishmentSystemID, storeItemInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加微门店信息", $"微门店:{tbStoreName.Text}"); SuccessMessage("添加微门店成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_storeItem.aspx?publishmentSystemID={PublishmentSystemID}&storeID={storeID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "微门店设置失败!"); } } }
public List <StoreItemInfo> ConvertToStoreItems(string dataString) { List <StoreItemInfo> storeItems = new List <StoreItemInfo>(); JToken token = JToken.Parse(dataString); JArray storeItemsJsonArray = JArray.Parse(token.ToString()); for (int i = 0; i < storeItemsJsonArray.Count; i++) { StoreItemInfo storeItemInfo = new StoreItemInfo(); storeItemInfo.ID = int.Parse(storeItemsJsonArray[i]["ID"].ToString()); storeItemInfo.itemName = storeItemsJsonArray[i]["Name"].ToString(); storeItemInfo.itemID = int.Parse(storeItemsJsonArray[i]["ItemID"].ToString()); storeItemInfo.creditValue = int.Parse(storeItemsJsonArray[i]["CreditValue"].ToString()); storeItemInfo.coinValue = int.Parse(storeItemsJsonArray[i]["CoinValue"].ToString()); JArray storeItemDetailArray = JArray.Parse(storeItemsJsonArray[i]["Detail"].ToString()); List <StoreItemDetail> storeItemDetails = new List <StoreItemDetail>(); for (int j = 0; j < storeItemDetailArray.Count; j++) { StoreItemDetail detail = new StoreItemDetail(); detail.propertyName = storeItemDetailArray[j]["Name"].ToString(); detail.propertyValue = int.Parse(storeItemDetailArray[j]["Value"].ToString()); detail.invertEnergy = (bool)storeItemDetailArray[j]["InvertEnergy"]; storeItemDetails.Add(detail); } storeItemInfo.itemDetail = storeItemDetails; //TODO implement addDate of store item //storeItemInfo.addedDate = (DateTime)storeItemsJsonArray[i]["AddedDate"]; JArray tagsArray = JArray.Parse(storeItemsJsonArray[i]["tags"].ToString()); for (int k = 0; k < tagsArray.Count; k++) { storeItemInfo.tags.Add(tagsArray[k].ToString()); } storeItemInfo.imageURL = storeItemsJsonArray[i]["Image"].ToString(); storeItems.Add(storeItemInfo); } return(storeItems); }
public bool AddPatient(string authenticationCookie, PatientInfo_Json patientInfo, string userData) { try { string userName; userName = ServiceUtils.Authorize(authenticationCookie, PermissionsTable.Instance.CanStore); StoreItemInfo storeItemInfo = new StoreItemInfo(); storeItemInfo.MimeType = SupportedMimeTypes.DICOM; DicomDataSet ds = new DicomDataSet(); ds.Initialize(DicomClassType.Patient, DicomDataSetInitializeFlags.AddMandatoryElementsOnly); // The 2014 specification has added ReferencedStudySequence to the Patient Module (Retired) as a mandatory element // Remove this element for adding the patient DicomElement element = ds.FindFirstElement(null, DicomTag.ReferencedStudySequence, true); if (element != null) { ds.DeleteElement(element); } SetPatientInfo(patientInfo, ds, DicomCharacterSetType.UnicodeInUtf8); MemoryStream ms = new MemoryStream(); ds.Save(ms, DicomDataSetSaveFlags.None); //TODO: Store Patient information (Need to determine how this will be handled in the DB. Same for the unapproved captured images) QueryOptions queryOptions = new QueryOptions(); queryOptions.PatientsOptions = new PatientsQueryOptions(); queryOptions.PatientsOptions.PatientID = patientInfo.PatientId; // If patientID already exists, return 'false' PatientData[] patientData = _queryAddin.FindPatients(userName, queryOptions); if (patientData.Length > 0) { return(false); } // Otherwise, add the patient _storeAddin.StoreItem(ms, storeItemInfo); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public List<StoreItemInfo> ConvertToStoreItems(string dataString) { List<StoreItemInfo> storeItems = new List<StoreItemInfo>(); JToken token = JToken.Parse(dataString); JArray storeItemsJsonArray = JArray.Parse(token.ToString()); for (int i = 0; i < storeItemsJsonArray.Count; i++) { StoreItemInfo storeItemInfo = new StoreItemInfo(); storeItemInfo.ID = int.Parse(storeItemsJsonArray[i]["ID"].ToString()); storeItemInfo.itemName = storeItemsJsonArray[i]["Name"].ToString(); storeItemInfo.itemID = int.Parse(storeItemsJsonArray[i]["ItemID"].ToString()); storeItemInfo.creditValue = int.Parse(storeItemsJsonArray[i]["CreditValue"].ToString()); storeItemInfo.coinValue = int.Parse(storeItemsJsonArray[i]["CoinValue"].ToString()); JArray storeItemDetailArray = JArray.Parse(storeItemsJsonArray[i]["Detail"].ToString()); List<StoreItemDetail> storeItemDetails = new List<StoreItemDetail>(); for (int j = 0; j < storeItemDetailArray.Count; j++) { StoreItemDetail detail = new StoreItemDetail(); detail.propertyName = storeItemDetailArray[j]["Name"].ToString(); detail.propertyValue = int.Parse(storeItemDetailArray[j]["Value"].ToString()); detail.invertEnergy = (bool)storeItemDetailArray[j]["InvertEnergy"]; storeItemDetails.Add(detail); } storeItemInfo.itemDetail = storeItemDetails; //TODO implement addDate of store item //storeItemInfo.addedDate = (DateTime)storeItemsJsonArray[i]["AddedDate"]; JArray tagsArray = JArray.Parse(storeItemsJsonArray[i]["tags"].ToString()); for (int k = 0; k < tagsArray.Count; k++) { storeItemInfo.tags.Add(tagsArray[k].ToString()); } storeItemInfo.imageURL = storeItemsJsonArray[i]["Image"].ToString(); storeItems.Add(storeItemInfo); } return storeItems; }
public List <StoreItemInfo> ConvertToStoreItems(string dataString) { string storeString = ParseString(dataString); List <StoreItemInfo> storeItems = new List <StoreItemInfo>(); JsonData storeItemsJsonArray = LitJson.JsonMapper.ToObject(storeString); for (int i = 0; i < storeItemsJsonArray.Count; i++) { StoreItemInfo storeItemInfo = new StoreItemInfo(); storeItemInfo.ID = int.Parse(storeItemsJsonArray[i]["ID"].ToString()); storeItemInfo.itemName = storeItemsJsonArray[i]["Name"].ToString(); storeItemInfo.itemID = int.Parse(storeItemsJsonArray[i]["ItemID"].ToString()); storeItemInfo.creditValue = int.Parse(storeItemsJsonArray[i]["CreditValue"].ToString()); storeItemInfo.coinValue = int.Parse(storeItemsJsonArray[i]["CoinValue"].ToString()); JsonData storeItemDetailArray = LitJson.JsonMapper.ToObject(storeItemsJsonArray[i]["Detail"].ToString()); List <StoreItemDetail> storeItemDetails = new List <StoreItemDetail>(); for (int j = 0; j < storeItemDetailArray.Count; j++) { StoreItemDetail detail = new StoreItemDetail(); detail.propertyName = storeItemDetailArray[j]["Name"].ToString(); detail.propertyValue = int.Parse(storeItemDetailArray[j]["Value"].ToString()); detail.invertEnergy = (bool)storeItemDetailArray[j]["InvertEnergy"]; storeItemDetails.Add(detail); } storeItemInfo.itemDetail = storeItemDetails; //TODO add tag support //JsonData tagsArray = LitJson.JsonMapper.ToObject(storeItemsJsonArray[i]["tags"].ToString()); //for (int k = 0; k < tagsArray.Count; k++) //{ // storeItemInfo.tags.Add(tagsArray[k].ToString()); //} storeItemInfo.imageURL = storeItemsJsonArray[i]["Image"].ToString(); storeItems.Add(storeItemInfo); } return(storeItems); }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var conflictKeywords = string.Empty; var storeItemInfo = new StoreItemInfo(); if (_storeItemId > 0) { storeItemInfo = DataProviderWx.StoreItemDao.GetStoreItemInfo(_storeItemId); } storeItemInfo.PublishmentSystemId = PublishmentSystemId; storeItemInfo.StoreId = _storeId; storeItemInfo.CategoryId = Convert.ToInt32(DdlStoreCategoryName.SelectedValue); storeItemInfo.StoreName = TbStoreName.Text; storeItemInfo.Tel = TbStoreTel.Text; storeItemInfo.Mobile = TbStoreMobile.Text; storeItemInfo.Address = TbStoreAddress.Text; storeItemInfo.ImageUrl = ImageUrl.Value; storeItemInfo.Latitude = TxtLatitude.Value; storeItemInfo.Longitude = TxtLongitude.Value; storeItemInfo.Summary = TbSummary.Text; try { if (_storeItemId > 0) { DataProviderWx.StoreItemDao.Update(PublishmentSystemId, storeItemInfo); LogUtils.AddAdminLog(Body.AdministratorName, "修改微门店信息", $"微门店:{TbStoreName.Text}"); SuccessMessage("修改微门店成功!"); } else { _storeItemId = DataProviderWx.StoreItemDao.Insert(PublishmentSystemId, storeItemInfo); LogUtils.AddAdminLog(Body.AdministratorName, "添加微门店信息", $"微门店:{TbStoreName.Text}"); SuccessMessage("添加微门店成功!"); } var redirectUrl = PageStoreItem.GetRedirectUrl(PublishmentSystemId, _storeId); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "微门店设置失败!"); } } }
public StoreItemInfo GetStoreItemInfoByParentID(int publishmentSystemID, int parentID) { StoreItemInfo storeItemInfo = null; string SQL_WHERE = $"WHERE publishmentSystemID = {publishmentSystemID} AND ParentID = {parentID}"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { if (rdr.Read()) { storeItemInfo = new StoreItemInfo(rdr); } rdr.Close(); } return(storeItemInfo); }
public StoreItemInfo GetStoreItemInfoByParentId(int publishmentSystemId, int parentId) { StoreItemInfo storeItemInfo = null; string sqlWhere = $"WHERE publishmentSystemID = {publishmentSystemId} AND ParentID = {parentId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { if (rdr.Read()) { storeItemInfo = new StoreItemInfo(rdr); } rdr.Close(); } return(storeItemInfo); }
public List <StoreItemInfo> GetAllStoreItemInfoListByLocation(int publishmentSystemId, string locationX) { var list = new List <StoreItemInfo>(); var builder = new StringBuilder( $"WHERE {StoreItemAttribute.PublishmentSystemId} = {publishmentSystemId} AND {StoreItemAttribute.Latitude} BETWEEN '{Convert.ToDouble(locationX) - 0.5}' AND '{Convert.ToDouble(locationX) + 0.5}'"); var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, builder.ToString(), "ORDER BY ID"); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var storeItemInfo = new StoreItemInfo(rdr); list.Add(storeItemInfo); } rdr.Close(); } return(list); }
public List <StoreItemInfo> GetAllStoreItemInfoList(int publishmentSystemID) { var list = new List <StoreItemInfo>(); var builder = new StringBuilder( $"WHERE {StoreItemAttribute.PublishmentSystemID} = {publishmentSystemID}"); var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, builder.ToString(), "ORDER BY ID"); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var storeItemInfo = new StoreItemInfo(rdr); list.Add(storeItemInfo); } rdr.Close(); } return(list); }
static int SortByName(StoreItemInfo x, StoreItemInfo y) { return(x.itemName.ToLower().CompareTo(y.itemName.ToLower())); }
public void SetItemInfo(StoreItemInfo newStoreItemInfo) { storeItemInfo = newStoreItemInfo; GetItemTexture(storeItemInfo.imageURL); }
public static string GetStoreItemUrl(PublishmentSystemInfo publishmentSystemInfo, StoreItemInfo storeItemInfo, string wxOpenID) { var attributes = new NameValueCollection(); attributes.Add("publishmentSystemID", storeItemInfo.PublishmentSystemId.ToString()); attributes.Add("storeID", storeItemInfo.StoreId.ToString()); attributes.Add("storeItemID", storeItemInfo.Id.ToString()); attributes.Add("wxOpenID", wxOpenID); return(PageUtils.AddQueryString(GetStoreItemUrl(publishmentSystemInfo), attributes)); }
public int CompareItemsByPropertys(StoreItemInfo x, StoreItemInfo y) { int nullcheck = CheckIfNull(x, y); if (nullcheck != -10) { return nullcheck * direction; } int checkDetails = CheckDetailIsValid(x, y); if (checkDetails != -10) { return checkDetails * direction; } List<StoreItemDetail> xDetails = x.itemDetail; List<StoreItemDetail> YDetails = y.itemDetail; bool xIsPropFound = false; bool yIsPropFound = false; int xValue = 0; int yValue = 0; foreach (StoreItemDetail detail in xDetails) { if (detail.propertyName == propertyToSort) { xIsPropFound = true; try { xValue = int.Parse(detail.propertyValue.ToString()); } catch { xValue = 0; } break; } } foreach (var detail in YDetails) { if (detail.propertyName == propertyToSort) { yIsPropFound = true; try { yValue = int.Parse(detail.propertyValue.ToString()); } catch { yValue = 0; } break; } } int checkPropertyFound = CheckIsPropertyFound(xIsPropFound, yIsPropFound); if (checkPropertyFound != -10) { return checkPropertyFound; } if (xValue == yValue) { return 0; } else if (xValue < yValue) { return 1 * direction; } else { return -1 * direction; } }
int CheckDetailIsValid(StoreItemInfo x, StoreItemInfo y) { //TODO Check for validation int returened = -10; //if (string.IsNullOrEmpty(x["Detail"].ToString())) //{ // if (string.IsNullOrEmpty(y["Detail"].ToString())) // { // returened = 0; // } // else // { // returened = 1; // } //} //else //{ // if (string.IsNullOrEmpty(y["Detail"].ToString())) // { // returened = -1; // } // else // { // returened = -10; // Not null; // } //} return returened; }
static int SortByName(StoreItemInfo x, StoreItemInfo y) { return x.itemName.ToLower().CompareTo(y.itemName.ToLower()); }
public int CompareItemsByPropertys(StoreItemInfo x, StoreItemInfo y) { int nullcheck = CheckIfNull(x, y); if (nullcheck != -10) { return(nullcheck * direction); } int checkDetails = CheckDetailIsValid(x, y); if (checkDetails != -10) { return(checkDetails * direction); } List <StoreItemDetail> xDetails = x.itemDetail; List <StoreItemDetail> YDetails = y.itemDetail; bool xIsPropFound = false; bool yIsPropFound = false; int xValue = 0; int yValue = 0; foreach (StoreItemDetail detail in xDetails) { if (detail.propertyName == propertyToSort) { xIsPropFound = true; try { xValue = int.Parse(detail.propertyValue.ToString()); } catch { xValue = 0; } break; } } foreach (var detail in YDetails) { if (detail.propertyName == propertyToSort) { yIsPropFound = true; try { yValue = int.Parse(detail.propertyValue.ToString()); } catch { yValue = 0; } break; } } int checkPropertyFound = CheckIsPropertyFound(xIsPropFound, yIsPropFound); if (checkPropertyFound != -10) { return(checkPropertyFound); } if (xValue == yValue) { return(0); } else if (xValue < yValue) { return(1 * direction); } else { return(-1 * direction); } }
public List<StoreItemInfo> ConvertToStoreItems(string dataString) { string storeString = ParseString(dataString); List<StoreItemInfo> storeItems = new List<StoreItemInfo>(); JsonData storeItemsJsonArray = LitJson.JsonMapper.ToObject(storeString); for (int i = 0; i < storeItemsJsonArray.Count; i++) { StoreItemInfo storeItemInfo = new StoreItemInfo(); storeItemInfo.ID = int.Parse(storeItemsJsonArray[i]["ID"].ToString()); storeItemInfo.itemName = storeItemsJsonArray[i]["Name"].ToString(); storeItemInfo.itemID = int.Parse(storeItemsJsonArray[i]["ItemID"].ToString()); storeItemInfo.creditValue = int.Parse(storeItemsJsonArray[i]["CreditValue"].ToString()); storeItemInfo.coinValue = int.Parse(storeItemsJsonArray[i]["CoinValue"].ToString()); JsonData storeItemDetailArray = LitJson.JsonMapper.ToObject(storeItemsJsonArray[i]["Detail"].ToString()); List<StoreItemDetail> storeItemDetails = new List<StoreItemDetail>(); for (int j = 0; j < storeItemDetailArray.Count; j++) { StoreItemDetail detail = new StoreItemDetail(); detail.propertyName = storeItemDetailArray[j]["Name"].ToString(); detail.propertyValue = int.Parse(storeItemDetailArray[j]["Value"].ToString()); detail.invertEnergy = (bool)storeItemDetailArray[j]["InvertEnergy"]; storeItemDetails.Add(detail); } storeItemInfo.itemDetail = storeItemDetails; //TODO add tag support //JsonData tagsArray = LitJson.JsonMapper.ToObject(storeItemsJsonArray[i]["tags"].ToString()); //for (int k = 0; k < tagsArray.Count; k++) //{ // storeItemInfo.tags.Add(tagsArray[k].ToString()); //} storeItemInfo.imageURL = storeItemsJsonArray[i]["Image"].ToString(); storeItems.Add(storeItemInfo); } return storeItems; }