コード例 #1
0
ファイル: BarcodeManager.cs プロジェクト: ewin66/BugChang.DES
        public string MakeBarcodeLength26(string sendDepartmentCode, string receiveDepartmentCode,
                                          EnumSecretLevel secretLevel, EnumUrgentLevel urgentLevel, int serialNo)
        {
            var barCode = "";

            if (sendDepartmentCode.Length != 11 || receiveDepartmentCode.Length != 11)
            {
                return(barCode);
            }
            if (serialNo == 0)
            {
                return("");
            }
            barCode = "0" + sendDepartmentCode.Substring(0, 6) + "0" + sendDepartmentCode.Substring(6, 3) + serialNo.ToString("00000") + DateTime.Now.ToString("yyyyMMdd").Substring(3, 1)
                      + (int)secretLevel + (int)urgentLevel
                      + receiveDepartmentCode.Substring(0, 6) + "0";
            return(barCode);
        }
コード例 #2
0
 public string MakeBarcodeLength26(string sendDepartmentCode, string receiveDepartmentCode,
                                   EnumSecretLevel secretLevel, EnumUrgentLevel urgentLevel, int serialNo)
 {
     return(_barcodeManager.MakeBarcodeLength26(sendDepartmentCode, receiveDepartmentCode, secretLevel,
                                                urgentLevel, serialNo));
 }
コード例 #3
0
ファイル: BarcodeManager.cs プロジェクト: ewin66/BugChang.DES
        public string MakeBarcodeLength33(string sendDepartmentCode, string receiveDepartmentCode, EnumSecretLevel secretLevel, EnumUrgentLevel urgentLevel, int serialNo)
        {
            var barCode = "";

            if (sendDepartmentCode.Length != 11 || receiveDepartmentCode.Length != 11)
            {
                return(barCode);
            }

            if (serialNo == 0)
            {
                return("");
            }

            var letterNo = serialNo.ToString("0000000");

            barCode = sendDepartmentCode + ((int)secretLevel + 1) + ((int)urgentLevel + 1) + "0" +
                      DateTime.Now.Year + letterNo + receiveDepartmentCode;
            var sum       = barCode.ToCharArray().Aggregate(0, (current, value) => current + value);
            var checkCode = sum % 10;

            barCode = sendDepartmentCode
                      + ((int)secretLevel + 1) + ((int)urgentLevel + 1) + checkCode + DateTime.Now.Year.ToString().Substring(3, 1) + letterNo
                      + receiveDepartmentCode;
            return(barCode);
        }