songjun
2025-09-15 15e82c0dd4200a332b30e2fcd458ad84e2e3d428
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using sbcLabSystem.Data.Domain.Account;
using sbcLabSystem.Data.Domain.Backstage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sbcLabSystem.Service.QC;
 
namespace sbcLabSystem.Service
{
    public class StringOperation
    {
        //拆分字符 
        public char[] split(string s)
        {
            return s.ToCharArray();
        }
        //截取子串(Substring)
 
        public string Intercept(string s, int x)
        {
            return s.Substring(x);
        }
        //是否在字符串中
        public bool Contains(string s, string x)
        {
            return s.Contains(x);
        }
        //
        public string Replace(string s, string x, string x2)
        {
            return s.Replace(x, x2);
        }
        public string StringContents(UserRequestInfo info, QCDistributionRegisterInfo regInfo, string s)
        {
            if (regInfo != null)
            {
                QCDistribution qcDistInfo = PalGain.Core.PalGainEngine.Instance.Resolve<QCService>().GetQcDistributions()
                    .FirstOrDefault(p => p.Id == regInfo.QCDistributionId);
                s = s.Replace("[挂号信]", regInfo.LetterNo);
                s = s.Replace("[质评号]", qcDistInfo.DistNo);
                s = s.Replace("[质评类别]", regInfo.ProjectId.ToString());
                s = s.Replace("[快递单号]", regInfo.EMSNo);
                s = s.Replace("[质评开始日期]", qcDistInfo.IssuedDate.GetValueOrDefault().ToString("yyyy-MM-dd"));
                s = s.Replace("[质评结束日期]", qcDistInfo.CloseDate.GetValueOrDefault().ToString("yyyy-MM-dd"));
            } 
            string stringCont = s;
            if (info != null)
            {
                if (Contains(stringCont, "[实验室编码]"))
                {
                    stringCont = Replace(stringCont, "[实验室编码]", info.LabCode);
                }
                if (Contains(stringCont, "[实验室登录名]"))
                {
                    stringCont = Replace(stringCont, "[实验室登录名]", info.LabLoginName);
                }
                if (Contains(stringCont, "[实验室密码]"))
                {
                    stringCont = Replace(stringCont, "[实验室密码]", info.LabPassword);
                }
                if (Contains(stringCont, "[单位名称]"))
                {
                    stringCont = Replace(stringCont, "[单位名称]", info.CompanyName);
                }
                if (Contains(stringCont, "[实验室名称]"))
                {
                    stringCont = Replace(stringCont, "[实验室名称]", info.LabName);
                }
                if (Contains(stringCont, "[地址]"))
                {
                    stringCont = Replace(stringCont, "[地址]", info.Address);
                }
                if (Contains(stringCont, "[省市]"))
                {
                    stringCont = Replace(stringCont, "[省市]", info.Province);
                }
                if (Contains(stringCont, "[邮政编码]"))
                {
                    stringCont = Replace(stringCont, "[邮政编码]", info.PostCode);
                }
                if (Contains(stringCont, "[操作人名称]"))
                {
                    stringCont = Replace(stringCont, "[操作人名称]", info.ManagerName);
                }
                if (Contains(stringCont, "[操作人固话]"))
                {
                    stringCont = Replace(stringCont, "[操作人固话]", info.ManagerPhone);
                }
                if (Contains(stringCont, "[操作人传真]"))
                {
                    stringCont = Replace(stringCont, "[操作人传真]", info.ManagerFax);
                }
                if (Contains(stringCont, "[操作人手机]"))
                {
                    stringCont = Replace(stringCont, "[操作人手机]", info.ManagerMobile);
                }
                if (Contains(stringCont, "[操作人邮箱]"))
                {
                    stringCont = Replace(stringCont, "[操作人邮箱]", info.ManagerEmail);
                }
                if (Contains(stringCont, "[负责人名称]"))
                {
                    stringCont = Replace(stringCont, "[负责人名称]", info.OperatorName);
                }
                if (Contains(stringCont, "[负责人固话]"))
                {
                    stringCont = Replace(stringCont, "[负责人固话]", info.OperatorPhone);
                }
                if (Contains(stringCont, "[负责人传真]"))
                {
                    stringCont = Replace(stringCont, "[负责人传真]", info.OperatorFax);
                }
                if (Contains(stringCont, "[负责人手机]"))
                {
                    stringCont = Replace(stringCont, "[负责人手机]", info.OperatorMobile);
                }
                if (Contains(stringCont, "[负责人邮箱]"))
                {
                    stringCont = Replace(stringCont, "[负责人邮箱]", info.OperatorEmail);
                }
                if (Contains(stringCont, "[质项类别]"))
                {
                    stringCont = Replace(stringCont, "[质项类别]", info.ProjectId.ToString());
                }
                if (Contains(stringCont, "[管理员名称]"))
                {
                    stringCont = Replace(stringCont, "[管理员名称]", "admin");
                }
            }
            //if (Contains(stringCont, "[管理员密码]"))
            //{
            //    stringCont = Replace(stringCont, "[管理员密码]", info.CompanyName);
            //}
            return stringCont;
        }
 
    }
}