예제 #1
0
        // for from current
        public static string FormatShtName(string origShtName,
                                           ShNamePartItemCode divCode,
                                           string customDivider, ShNamePartItemCode suffixCode, string customSuffix,
                                           int seq)
        {
            if (suffixCode == C_SX_NAMNONE)
            {
                return(origShtName);
            }

            string divider = customDivider ?? "-";
            string suffix  = customSuffix ?? "A";

            int dividerTestCode = (int)divCode % 100;
            int suffixTestCode  = (int)suffixCode % 100;

            if (dividerTestCode != (int)CUSTOMSET)
            {
                divider = GetDivider(divCode);
            }
            if (suffixTestCode != (int)CUSTOMSET)
            {
                suffix = GetNameSuffix(suffixCode, seq);
            }

            return(origShtName + divider + suffix);
        }
예제 #2
0
        private static string GetDivider(ShNamePartItemCode divCode)
        {
            string result = "-" + AppStrings.R_ErrError + "-";

            switch (divCode)
            {
            case C_DV_NONE:             // none
            {
                result = "";
                break;
            }

            case C_DV_SPACE:             // space
            {
                result = " ";
                break;
            }

            case C_DV_PERIOD:             // space
            {
                result = ".";
                break;
            }

            case C_DV_DASH:             // space
            {
                result = "-";
                break;
            }
            }

            return(result);
        }
예제 #3
0
        private static string GetNumSuffix(ShNamePartItemCode suffixCode, int suffixSequence)
        {
            string result = AppStrings.R_ErrError;
            int    i      = 1;

            switch (suffixCode)
            {
            case C_SX_NUMALPLC:
            {
                result = GetLetterCodeSequenced(suffixSequence, 'a');
                break;
            }

            case C_SX_NUMALPUC:
            {
                result = GetLetterCodeSequenced(suffixSequence, 'A');
                break;
            }

            default:
            {
                switch (suffixCode)
                {
                // default case - pre-assigned
                //case C_SX_NUMNUM1:
                case C_SX_NUMNUM2:
                {
                    i = 2;
                    break;
                }

                case C_SX_NUMNUM3:
                {
                    i = 3;
                    break;
                }

                case C_SX_NUMNUM4:
                {
                    i = 4;
                    break;
                }

                case C_SX_NUMNUM5:
                {
                    i = 5;
                    break;
                }
                }

                string temp = $"{"{0:D"}{i:D}{"}"}";
                result = String.Format(temp, suffixSequence);

                break;
            }
            }

            return(result);
        }
예제 #4
0
        // format a sheet name

        // per settings
        public static string FormatShtName(string name, bool inc,
                                           ShNamePartItemCode code, int seq)
        {
            string result = name;

            if (inc)
            {
                result += " " + FormatPsSeq(code, seq);
            }

            return(result);
        }
		public ShNamePartItem FindByCode(ShNamePartItemCode code)
		{
			int tableCode = ((int) code) / 100;
			int itemCode  = (int) code - tableCode;

			foreach (ShNamePartItem bi in Tables[tableCode].Collection)
			{
				if (bi.Code.Equals(code)) return bi;
			}

			return null;
		}
예제 #6
0
        // for from current
        public static string FormatShtNumber(string origShtNum,
                                             ShNamePartItemCode divCode, string customDivider, ShNamePartItemCode suffixCode,
                                             int seq)
        {
            string divider = customDivider;
            string suffix  = GetNumSuffix(suffixCode, seq);

            if ((int)divCode > (int)CUSTOMSELECT)
            {
                divider = GetDivider(divCode);
            }

            return(origShtNum + divider + suffix);
        }
예제 #7
0
        // for from current
        public static string FormatShtNumber(string origShtNum,
                                             ShNamePartItemCode divCode, string customDivider, ShNamePartItemCode suffixCode,
                                             int seq)
        {
            string divider = customDivider ?? "-";
            string suffix  = GetNumSuffix(suffixCode, seq);

            int dividerTestCode = (int)divCode % 100;

            if (dividerTestCode != (int)CUSTOMSET)
            {
                divider = GetDivider(divCode);
            }

            return(origShtNum + divider + suffix);
        }
예제 #8
0
        private static string GetNameSuffix(ShNamePartItemCode suffixCode, int suffixSequence)
        {
            string result = AppStrings.R_ErrError;

            switch (suffixCode)
            {
            case C_SX_NAMNONE:
            {
                result = "";
                break;
            }

            case C_SX_NAMCOPY1:
            {
                result = $"{AppStrings.R_Copy} {suffixSequence:D}";
                break;
            }

            case C_SX_NAMCOPYA:
            {
                result = AppStrings.R_Copy + " " + GetLetterCodeSequenced(suffixSequence, 'A');
                break;
            }

            case C_SX_NAMNUM1:
            {
                result = $"{suffixSequence:D}";
                break;
            }

            case C_SX_NAMALPLC:
            {
                result = GetLetterCodeSequenced(suffixSequence, 'a');
                break;
            }

            case C_SX_NAMALPUC:
            {
                result = GetLetterCodeSequenced(suffixSequence, 'A');
                break;
            }
            }

            return(result);
        }
예제 #9
0
        // for from current
        public static string FormatShtName(string origShtName,
                                           ShNamePartItemCode divCode,
                                           string customDivider, ShNamePartItemCode suffixCode, string customSuffix,
                                           int seq)
        {
            if (suffixCode == C_SX_NAMNONE)
            {
                return(origShtName);
            }

            string divider = customDivider;
            string suffix  = customSuffix;

            if ((int)divCode > (int)CUSTOMSELECT)
            {
                divider = GetDivider(divCode);
            }
            if ((int)suffixCode > (int)CUSTOMSELECT)
            {
                suffix = GetNameSuffix(suffixCode, seq);
            }

            return(origShtName + divider + suffix);
        }
예제 #10
0
 private static string FormatPsSeq(ShNamePartItemCode code, int seq)
 {
     return(seq.ToString(npit.FindTitleByCode(code)));
 }
예제 #11
0
        // format a sheet number

        // per settings
        public static string FormatShtNumber(string prefix, ShNamePartItemCode code, int seq)
        {
            return(prefix + FormatPsSeq(code, seq));
        }
예제 #12
0
 public bool Equals(ShNamePartItemCode c)
 {
     return((int)c == (int)Code);
 }
예제 #13
0
 public ShNamePartItem(string title, ShNamePartItemCode code)
 {
     Title = title;
     Code  = code;
 }
예제 #14
0
 public static bool Equals(this ShNamePartItemCode c, ShNamePartItemCode test)
 {
     return((int)c == (int)test);
 }
 public string FindTitleByCode(ShNamePartItemCode code)
 {
     return(FindByCode(code).Title);
 }