用户登记与满意度评估的业务流程处理

把最近写的 用户登记与满意度评估的业务流程处理 的感想与大家分享一下.

 

1.这个程序是利用sharepoint的对象模型进行编程的,所以首先要了解sharepoint的层级结构.

2.既然是个业务流程,不免要对业务进行分析,最终用户是否满意,是否是多个工程师进行的处理,是否是多次对工程师进行评估,是否拥有打开该链接的权限,用户一致性等等需要注意的地方. 

3.在sharepoint的站点间(我先在一个站点里实现的)建立登记列表,回馈列表和分析调查库,通过sharepoint designer设计的工作流的启动,最终达到的效果是能够在调查库里看到图表一样的直观的东西. 

4.最后就是部署的问题了,程序是用vs2008写的page layouts页面,要部署到wss网站中,与sharepoint的应用衔接起来,达到实现业务的目的,经过摸索,终于有了自己的方法和对sharepoint虚拟网站的理解.

给出一些代码:  

 

代码
1 /**//// <summary>
2 /// 静态常量定义
3 /// </summary>
4 const string SiteUrl = "http://lixinjiang:9001/sites/XZ/";
5 const string Catalog1 = "/sites/XZ/feature/";
6 const string CataLog2 = "/sites/XZ/blank/";
7 const string ListTable1 = "用户事件登记表";
8 const string ListTable2 = "用户调查结果表";
9
10
11
12 private BeginField GetBeginList(string itemId)
13 {
14 string ReturnValue = string.Empty;
15 SPSite siteCollection = new SPSite(SiteUrl);
16 SPWeb site = siteCollection.OpenWeb(Catalog1);
17 SPList list1 = site.Lists[ListTable1];
18 SPListItem item1 = list1.Items.GetItemById(Convert.ToInt32(itemId));
19 string title1 = item1["标题"].ToString();
20 string reporter1 = item1["报告人"].ToString();
21 string content1 = item1["事件具体内容"].ToString();
22 string user1 = item1["服务工程师"].ToString();
23 Session["itemId"] = itemId;
24 Session["itemTitle"] = title1;
25 Session["itemReporter"] = reporter1;
26 Session["itemContent"] = content1;
27 Session["itemUser"] = user1;
28 ReturnValue = title1 + "\r\n" + content1;
29 BeginField bf = new BeginField();
30 bf.Title = title1;
31 bf.Content = content1;
32 bf.User = user1;
33 this.TBDetail.Text = ReturnValue;
34 this.TBuser.Text = user1;
35 return bf;
36 }
37
38 private void UpdateBeginList(string handState)
39 {
40 SPSite siteCollection = new SPSite(SiteUrl);
41 SPWeb site = siteCollection.OpenWeb(Catalog1);
42 site.AllowUnsafeUpdates = true;
43 SPList list1 = site.Lists[ListTable1];
44 SPListItem item1 = list1.Items.GetItemById(Convert.ToInt32(Session["itemId"]));
45 item1["处理状态"] = handState;
46 item1.Update();
47 }
48
49
50
51 private bool IsConsistent()
52 {
53 string user1 = string.Empty;
54 string user2 = string.Empty;
55 string[] userSplit;
56 user1 = System.Web.HttpContext.Current.User.Identity.Name.ToUpper();
57 userSplit = Session["itemReporter"].ToString().Split(new char[] { '#' });
58 user2 = userSplit[1].ToString().ToUpper();
59 if (user1 == user2)
60 return true;
61 else
62 return false;
63 }
64
65 private bool CheckMore()
66 {
67 SPSite siteCollection = new SPSite(SiteUrl);
68 SPWeb site = siteCollection.OpenWeb(CataLog2);
69 SPList list2 = site.Lists[ListTable2];
70 try
71 {
72 SPListItem item2 = list2.Items.GetItemById(Convert.ToInt32(Session["itemId"]));
73 }
74 catch
75 {
76 return true;
77 }
78 return false;
79 }
80
81 private void UpdateEndList(Inquiry vdinfo)
82 {
83 SPSite siteCollection = new SPSite(SiteUrl);
84 SPWeb site = siteCollection.OpenWeb(CataLog2);
85 site.AllowUnsafeUpdates = true;
86 SPList listE = site.Lists[ListTable2];
87 SPListItem itemE = listE.Items.Add();
88 itemE["事件ID"] = Session["itemId"].ToString();
89 itemE["事件标题"] = vdinfo.Title.ToString();
90 itemE["服务工程师"] = vdinfo.User.ToString();
91 itemE["满意度"] = vdinfo.IsSatisfy.ToString();
92 itemE["您的建议和意见"] = vdinfo.Advice.ToString();
93 itemE["是否同意关闭事件"] = vdinfo.IsAgree.ToString();
94 itemE.Update();
95 }
96
97 protected void AreYouSure_Click(object sender, EventArgs e)
98 {
99 Inquiry vdinfo = new Inquiry();
100 vdinfo.Title = Session["itemTitle"].ToString();
101 vdinfo.Detail = Session["itemContent"].ToString();
102 vdinfo.User = Session["itemUser"].ToString();
103 if (this.RBsatisfyOne.Checked)
104 {
105 vdinfo.IsSatisfy = this.RBsatisfyOne.Text;
106 }
107 else if (this.RBsatisfyTwo.Checked)
108 {
109 vdinfo.IsSatisfy = this.RBsatisfyTwo.Text;
110 }
111 else if (this.RBsatisfyThree.Checked)
112 {
113 vdinfo.IsSatisfy = this.RBsatisfyThree.Text;
114 }
115 else if (this.RBsatisfyFour.Checked)
116 {
117 vdinfo.IsSatisfy = this.RBsatisfyFour.Text;
118 }
119 else if (this.RBsatisfyFive.Checked)
120 {
121 vdinfo.IsSatisfy = this.RBsatisfyFive.Text;
122 }
123 if (this.Agree.Checked)
124 {
125 vdinfo.IsAgree = this.Agree.Text;
126 }
127 else if (this.NoAgree.Checked)
128 {
129 vdinfo.IsAgree = this.NoAgree.Text;
130 }
131 vdinfo.Advice = this.TBAdvice.Text.Trim().ToString();
132 try
133 {
134 if (IsConsistent())
135 {
138 if (CheckMore())
139 {
140 string handList = string.Empty;
141 if (this.Agree.Checked)
142 {
143 handList = "已关闭";
144 UpdateBeginList(handList);
145 }
146 else
147 {
148 handList = "未关闭";
149 UpdateBeginList(handList);
150 }
151 UpdateEndList(vdinfo);
152 Response.Write("<script language=javascript>alert('OK!');</script>");
153 }
154 else
155 {
156 throw new Exception("more times update!");
157 }
158 }
164 else
165 {
166 throw new Exception("user is not consistent!");
167 }
168 }
169 catch (Exception err)
170 {
171 ShowException(err.Message.ToString());
172 }
173 }
174

 

 

 

 

 

posted @ 2008-07-30 23:00  LevinLee  阅读(448)  评论(0编辑  收藏  举报