本文整理汇总了C#中BusinessObjects.MasterDataBLL.GetItemCategoryByCode方法的典型用法代码示例。如果您正苦于以下问题:C# MasterDataBLL.GetItemCategoryByCode方法的具体用法?C# MasterDataBLL.GetItemCategoryByCode怎么用?C# MasterDataBLL.GetItemCategoryByCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusinessObjects.MasterDataBLL
的用法示例。
在下文中一共展示了MasterDataBLL.GetItemCategoryByCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportTxtData
private void ImportTxtData(int importType, FileSystemInfo[] fsis)
{
foreach (FileSystemInfo fsi in fsis) {
FormSampleRequestBLL formsamplerequestbll = new FormSampleRequestBLL();
MasterDataBLL masterdatabll = new MasterDataBLL();
LogBLL logbll = new LogBLL();
FormSaleBLL formbll = new FormSaleBLL();
int SuccessCount = 0;
int FailCount = 0;
string[] Content = File.ReadAllLines(fsi.FullName, Encoding.Default);
//插入LOG主数据
int logId = logbll.InsertImportLog(importType, fsi.Name, 27, Content.Length, SuccessCount, FailCount);
for (int i = 0; i < Content.Length; i++) {
try {
//导入数据
#region 类型为SKU
if (importType == 0) {
string[] SKU = Content[i].Split('\t');
if (SKU.Length != 13) {
logbll.InsertImportLogDetail(logId, i + 1, "SKU数据COUNT错误!");
FailCount += 1;
continue;
}
//SKU = Content[i].Replace("\"", "").Split('\t');
Boolean active = false;
if (SKU[12].ToUpper().IndexOf("IM") >= 0) {
active = true;
} else if (SKU[12].ToUpper().IndexOf("IZ") >= 0) {
active = false;
} else {
logbll.InsertImportLogDetail(logId, i + 1, "active数据错误!");
FailCount += 1;
continue;
}
int BrandId = 0;
int SKUCategoryId = 0;
int SKUTypeID = 0;
MasterData.BrandDataTable Brand = masterdatabll.GetBrandByName(SKU[2]);
if (Brand.Rows.Count > 0) {
BrandId = Brand[0].BrandID;
} else {
logbll.InsertImportLogDetail(logId, i + 1, string.Format("编号为{0}的产品未找到Brand({1})!", SKU[0], SKU[2]));
FailCount += 1;
continue;
}
MasterData.SKUCategoryDataTable SKUCategory = masterdatabll.GetSKUCategoryByName(SKU[3]);
if (SKUCategory.Rows.Count > 0) {
SKUCategoryId = SKUCategory[0].SKUCategoryID;
} else {
logbll.InsertImportLogDetail(logId, i + 1, string.Format("编号为{0}的产品未找到SKU Category({1})!", SKU[0], SKU[3]));
FailCount += 1;
continue;
}
MasterData.SKUTypeDataTable SKUType = masterdatabll.GetSKUTypeByName(SKU[4]);
if (SKUType.Rows.Count > 0) {
SKUTypeID = SKUType[0].SKUTypeID;
}
MasterData.SKUDataTable dtSKU = masterdatabll.GetSKUBySKUNo(SKU[0]);
if (dtSKU.Rows.Count > 0) {
//Update
masterdatabll.UpdateSKU(dtSKU[0].SKUID, SKU[0], SKU[1], BrandId, SKUTypeID, SKUCategoryId, SKU[5], SKU[6], SKU[7], SKU[8], SKU[9], Decimal.Parse(SKU[10]), SKU[11], active);
} else if (active)//未找到数据 并且active 是ture的才做插入
{
//导入数据
masterdatabll.InsertSKU(SKU[0], SKU[1], BrandId, SKUTypeID, SKUCategoryId, SKU[5], SKU[6], SKU[7], SKU[8], SKU[9], Decimal.Parse(SKU[10]), SKU[11], active);
}
}
#endregion
#region 类型为Item
if (importType == 1) {
string[] Item = Content[i].Split('\t');
if (Item.Length != 6) {
logbll.InsertImportLogDetail(logId, i + 1, "Item数据COUNT错误!");
FailCount += 1;
continue;
}
//Item = Content[i].Replace("\"", "").Split('\t');
int ItemCategoryID = 0;
Boolean active = false;
if (Item[5].ToUpper().IndexOf("PC") >= 0) {
active = true;
} else if (Item[5].ToUpper().IndexOf("PZ") >= 0) {
active = false;
} else {
logbll.InsertImportLogDetail(logId, i + 1, "active数据错误!");
FailCount += 1;
continue;
}
MasterData.ItemCategoryDataTable ItemCategory = masterdatabll.GetItemCategoryByCode(Item[2]);
if (ItemCategory.Rows.Count > 0) {
ItemCategoryID = ItemCategory[0].ItemCategoryID;
} else {
logbll.InsertImportLogDetail(logId, i + 1, "未找到Item Category!");
FailCount += 1;
continue;
}
//.........这里部分代码省略.........