Пример #1
0
 public static string GetItemName(EMDataSet.POItemTblRow row)
 {
     if (row == null)
         return null;
     if (row.IsItemIDNull())
         return "";
     string itemName = row.ItemTblRow.ItemName;
     if (!row.IsFinishIDNull())
     {
         itemName = GetFinishType("Finish",row.FinishID) + " " + itemName;
     }
     if (!row.IsTreatmentIDNull())
     {
         itemName = itemName + " " + GetFinishType("Treatment",row.TreatmentID);
     }
     return itemName;
 }
Пример #2
0
        int CompareSurcharge(EMDataSet.SurchargeRateTblRow leftSurcharge, EMDataSet.SurchargeRateTblRow rightSurcharge)
        {
            int leftSurchargeMonth = leftSurcharge.SurchargeMonth;
            int rightSurchargeMonth = rightSurcharge.SurchargeMonth;
            if (leftSurcharge.SurchargeMonth < rightSurcharge.SurchargeMonth)
                return -1;
            if (leftSurcharge.SurchargeMonth > rightSurcharge.SurchargeMonth)
                return 1;
            int leftFinishIDNull = leftSurcharge.IsFinishIDNull() ? 0 : 1;
            int rightFinishIDNull = rightSurcharge.IsFinishIDNull() ? 0 : 1;
            if (leftFinishIDNull < rightFinishIDNull)
                return -1;
            if (leftFinishIDNull > rightFinishIDNull)
                return 1;
            if (!(leftSurcharge.IsFinishIDNull() || rightSurcharge.IsFinishIDNull()))
            {
                if (leftSurcharge.FinishID < rightSurcharge.FinishID)
                    return -1;
                if (leftSurcharge.FinishID > rightSurcharge.FinishID)
                    return 1;
            }
            int leftSurchargeItemID = leftSurcharge.ItemID;
            int rightSurchargeItemID = rightSurcharge.ItemID;
            if (leftSurcharge.ItemID == -1 &&
                rightSurcharge.ItemID != -1)
                return -1;
            if (leftSurcharge.ItemID != -1 &&
                rightSurcharge.ItemID == -1)
                return 1;
            if (leftSurcharge.ItemID == -1 &&
                rightSurcharge.ItemID == -1)
            {
                return 0;
            }

            EMDataSet.ItemTblRow left = this.m_emDataSet.ItemTbl.FindByItemID(leftSurcharge.ItemID);
            EMDataSet.ItemTblRow right = this.m_emDataSet.ItemTbl.FindByItemID(rightSurcharge.ItemID);
            int leftCompID = left.CompID;
            int rightCompID = right.CompID;
            string leftCompName = this.m_emDataSet.CompanyTbl.FindByCompID(left.CompID).CompName;
            string rightCompName = this.m_emDataSet.CompanyTbl.FindByCompID(right.CompID).CompName;
            int compCompare = string.Compare(leftCompName, rightCompName);
            if (compCompare != 0)
                return compCompare;
            return string.Compare(left.ItemName, right.ItemName);
        }