本文整理汇总了C#中JavaScriptSerializer.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# JavaScriptSerializer.ContainsKey方法的具体用法?C# JavaScriptSerializer.ContainsKey怎么用?C# JavaScriptSerializer.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavaScriptSerializer
的用法示例。
在下文中一共展示了JavaScriptSerializer.ContainsKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdatePricingTitle
public string UpdatePricingTitle(string editedTitles)
{
//Saad
int userKey = new Base().UserKey;
if (userKey == 0)
{
return "{\"login\": false}";
}
try
{
dynamic item = new JavaScriptSerializer().Deserialize<dynamic>(editedTitles);
DataModelEntities context = new DataModelEntities();
int itemCode = Convert.ToInt32(item["ItemCode"]);
SellerItem sellerItem = context.SellerItems.SingleOrDefault(a => a.Item_Code == itemCode);
if (sellerItem != null)
{
sellerItem.Rotate_Order = Convert.ToInt32(item["Rotate"]);
sellerItem.Rotate_Days = Convert.ToInt32(item["Days"]);
sellerItem.Rotate_Sales = Convert.ToInt32(item["Sales"]);
sellerItem.Is_Title_Automated = Convert.ToBoolean(item["IsAutomate"]);
ItemTitle itemTitle;
if (item.ContainsKey("Title1") && !string.IsNullOrEmpty(item["Title1"].ToString()))
{
if (item.ContainsKey("ItemTitleId1") && !string.IsNullOrEmpty(item["ItemTitleId1"]))
{
int itemTitleId1 = Convert.ToInt32(item["ItemTitleId1"]);
itemTitle = context.ItemTitles.SingleOrDefault(a => a.ItemTitleId == itemTitleId1);
if (itemTitle != null)
{
if (!string.IsNullOrEmpty(itemTitle.Title) && itemTitle.Title.ToString().ToLower() != item["Title1"].ToString().ToLower())
itemTitle.TotalSales = 0;
itemTitle.ItemId = itemCode;
itemTitle.Title = item["Title1"].ToString();
itemTitle.Updated_Date = DateTime.Now;
itemTitle.Updated_By = userKey;
}
}
else
{
itemTitle = new ItemTitle();
itemTitle.ItemId = itemCode;
itemTitle.Title = item["Title1"].ToString();
itemTitle.Added_Date = DateTime.Now;
itemTitle.Added_By = userKey;
itemTitle.TotalSales = 0;
itemTitle.Is_Locked = false;
itemTitle.Is_Current = false;
itemTitle.Title_Index = 1;
sellerItem.ItemTitles.Add(itemTitle);
}
}
if (item.ContainsKey("Title2") && !string.IsNullOrEmpty(item["Title2"].ToString()))
{
if (item.ContainsKey("ItemTitleId2") && !string.IsNullOrEmpty(item["ItemTitleId2"]))
{
int itemTitleId1 = Convert.ToInt32(item["ItemTitleId2"]);
itemTitle = context.ItemTitles.SingleOrDefault(a => a.ItemTitleId == itemTitleId1);
if (itemTitle != null)
{
if (!string.IsNullOrEmpty(itemTitle.Title) && itemTitle.Title.ToString().ToLower() != item["Title2"].ToString().ToLower())
itemTitle.TotalSales = 0;
itemTitle.ItemId = itemCode;
itemTitle.Title = item["Title2"].ToString();
itemTitle.Updated_Date = DateTime.Now;
itemTitle.Updated_By = userKey;
}
}
else
{
itemTitle = new ItemTitle();
itemTitle.ItemId = itemCode;
itemTitle.Title = item["Title2"].ToString();
itemTitle.Added_Date = DateTime.Now;
itemTitle.Added_By = userKey;
itemTitle.TotalSales = 0;
itemTitle.Is_Locked = false;
itemTitle.Is_Current = false;
itemTitle.Title_Index = 2;
sellerItem.ItemTitles.Add(itemTitle);
}
}
if (item.ContainsKey("Title3") && !string.IsNullOrEmpty(item["Title3"].ToString()))
{
if (item.ContainsKey("ItemTitleId3") && !string.IsNullOrEmpty(item["ItemTitleId3"]))
{
int itemTitleId1 = Convert.ToInt32(item["ItemTitleId3"]);
itemTitle = context.ItemTitles.SingleOrDefault(a => a.ItemTitleId == itemTitleId1);
if (itemTitle != null)
{
//.........这里部分代码省略.........