Пример #1
0
        static string ReplaceKeyWord(EMDataSet emDataSet, EMDataSet.ContainerTblRow headerRow, string totalKgEdt,
            string totalLbsEdt,string current)
        {
            string ret = null;
            switch(current)
            {
                case "<ATTN>":
                {
                    string attn = "";
                    EMDataSet.LocationTblRow[] locRows =
                        GetCustomerLocationRows(headerRow);
                    bool first = true;
                    foreach (EMDataSet.LocationTblRow row in locRows)
                    {
                        if (!row.IsATTNStringNull())
                        {
                            if (row.ATTNString== "")
                                continue;
                            if (row.ATTNString== "\n")
                                continue;
                            if (!first)
                                attn += "\n";
                            first = false;
                            attn += row.ATTNString;
                        }
                    }
                    return attn;
                }
                case "<CC>":
                {
                    string cc = "";
                    EMDataSet.LocationTblRow[] locRows =
                        GetCustomerLocationRows(headerRow);
                    bool first = true;
                    foreach (EMDataSet.LocationTblRow row in locRows)
                    {
                        if (!row.IsCCStringNull())
                        {
                            if (row.CCString == "")
                                continue;
                            if (row.CCString == "\n")
                                continue;
                            if (!first)
                                cc += "\n";
                            first = false;
                            cc += row.CCString;
                        }
                    }
                    return cc ;
                }
                case "<COMPANY_NAME>":
                {
                    if (headerRow.IsCustomerIDNull())
                        return "";
                    EMDataSet.CompanyTblRow companyRow =
                        emDataSet.CompanyTbl.FindByCompID(headerRow.CustomerID);
                    if (headerRow.IsCustomerLocationIDNull())
                        return "";
                    EMDataSet.LocationTblRow locRow = emDataSet.LocationTbl.FindByLocID(headerRow.CustomerLocationID);

                    return companyRow.CompName + " " + locRow.LocName;
                }
                case "<ETA>":
                {
                    if (headerRow.IsETANull())
                        ret = "";
                    else
                        ret = "ETA:"+HelperFunctions.ToDateText(headerRow.ETA);
                    break;
                }
                case "<CONTNUMBER>":
                {
                    if (headerRow.IsContNumberNull())
                        ret = "";
                    else
                        ret = "Container:"+headerRow.ContNumber;
                    break;
                }
                case "<SHIP_DATE>":
                {
                    ret = "DATE ";
                    if (!headerRow.IsShipDateNull())
                        ret += HelperFunctions.ToDateText(headerRow.ShipDate);

                    break;
                }
                case "<NUMBER_OF_BUNDLES>":
                {
                    int number_of_bundles = 0;
                    foreach (EMDataSet.ContBundleTblRow row in emDataSet.ContBundleTbl.Rows)
                    {
                        if (DataInterface.IsRowAlive(row))
                            number_of_bundles++;
                    }
                    ret = number_of_bundles.ToString();
                    break;
                }
                case "<TOTAL_KGS>":
                {
                    ret = totalKgEdt;
                    break;
                }
                case "<TOTAL_LBS>":
                {
                    ret = totalLbsEdt;
                    break;
                }
            }
            return ret;
        }