生成备案号例如80-027-1-001 规则为:企业编号-所在区号-产品类别-序号
1 例如:1.ToString("000")数字格式化后为001
2
3 /// <summary>
4 /// 生成备案号
5 /// </summary>
6 /// <returns></returns>
7 protected string TMaterialNo()
8 {
9 string strNo = "";
10 bool flag =false ;
11 List<Model.T_MaterialBackUp> mlist = new BLL.T_MaterialBackUp().GetModelList("CompanyUserID=" + Request["CompanyUserID"].ToString());
12 List<Model.Company_UsersDetails> clist = new BLL.Company_UsersDetails().GetModelList("CompanyUserID=" + Request["CompanyUserID"].ToString());
13 string strflag = Request["CompanyUserID"] + "-0" + clist[0].AreaCode + "-" + ddltype.SelectedValue;
14 if (clist.Count > 0)
15 {
16
17 if (mlist.Count > 0)
18 {
19 for (int i = 0; i < mlist.Count; i++)
20 {
21 //拆分带"-"分隔符的字符串;
22 string[] strs = mlist[i].BAK1.Split(new char[] { '-' });
23 if (ddltype.SelectedValue == strs[2])
24 {
25 int no = Convert.ToInt32(strs[3].ToString());
26 no++;
27 strNo = strflag + "-" + no.ToString("000");
28 flag = true;
29 }
30 }
31 if (flag==false)
32 {
33
34 strNo = strflag + "-001";
35 }
36 }
37 else
38 {
39 strNo = strflag + "-001";
40 }
41 }
42 return strNo;
43 }
2
3 /// <summary>
4 /// 生成备案号
5 /// </summary>
6 /// <returns></returns>
7 protected string TMaterialNo()
8 {
9 string strNo = "";
10 bool flag =false ;
11 List<Model.T_MaterialBackUp> mlist = new BLL.T_MaterialBackUp().GetModelList("CompanyUserID=" + Request["CompanyUserID"].ToString());
12 List<Model.Company_UsersDetails> clist = new BLL.Company_UsersDetails().GetModelList("CompanyUserID=" + Request["CompanyUserID"].ToString());
13 string strflag = Request["CompanyUserID"] + "-0" + clist[0].AreaCode + "-" + ddltype.SelectedValue;
14 if (clist.Count > 0)
15 {
16
17 if (mlist.Count > 0)
18 {
19 for (int i = 0; i < mlist.Count; i++)
20 {
21 //拆分带"-"分隔符的字符串;
22 string[] strs = mlist[i].BAK1.Split(new char[] { '-' });
23 if (ddltype.SelectedValue == strs[2])
24 {
25 int no = Convert.ToInt32(strs[3].ToString());
26 no++;
27 strNo = strflag + "-" + no.ToString("000");
28 flag = true;
29 }
30 }
31 if (flag==false)
32 {
33
34 strNo = strflag + "-001";
35 }
36 }
37 else
38 {
39 strNo = strflag + "-001";
40 }
41 }
42 return strNo;
43 }