-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddNewVisit.aspx.cs
326 lines (288 loc) · 12.1 KB
/
AddNewVisit.aspx.cs
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class AddNewVisit : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
//Logging Start
string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);
using (Utils utility = new Utils())
{
utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
}
try
{
trValid.Visible = false;
trInvalid.Visible = false;
lblMsg.Visible = false;
btnSave.Attributes.Add("onclick", "return formValidator('frm','extddlDoctor,txtAddDate,extddlVisitType,txtCaseNo');");
if (!IsPostBack)
{
txtCompanyID.Text = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
extddlDoctor.Flag_ID = txtCompanyID.Text;
extddlVisitType.Flag_ID = txtCompanyID.Text;
//RowProcedureCode.Visible = false;
}
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
string str2 = "Error Request="+ id + ".Please share with Technical support.";
base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
}
//Method End
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
//Logging Start
string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);
using (Utils utility = new Utils())
{
utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
}
try
{
int Count = 0;
DateTime currentdate;
currentdate = DateTime.Today;
DateTime inserted_date;
inserted_date = Convert.ToDateTime(txtAddDate.Text);
if (DateTime.Compare(inserted_date, currentdate) > 0)
{
lblMsg.Text = "Selected Date should be less to Current Date";
lblMsg.Visible = true;
return;
}
if (lstProcedureCode.Items.Count > 0)
{
foreach (ListItem li in lstProcedureCode.Items)
{
if (li.Selected == true)
{
Count = Count + 1;
}
}
if (Count == 0)
{
lblMsg.Text = "Select atleast 1 procedure code";
lblMsg.Visible = true;
return;
}
}
Bill_Sys_Visit_BO _bill_Sys_Visit_BO = new Bill_Sys_Visit_BO();
CaseDetailsBO objcaseid = new CaseDetailsBO();
string CompanyID = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
string DoctorID = extddlDoctor.Text;
string ChkDate = txtAddDate.Text;
string VisitType = extddlVisitType.Text;
string CaseID;
int flag = 0;
string[] arrlstCaseNo = txtCaseNo.Text.Split(new char[] { ',' });
ArrayList arrlstAddDetails = new ArrayList();
Bill_Sys_AddVisit_DAO obj_bill_getset_value;
for (int i = 0; i < arrlstCaseNo.Length; i++)
{
obj_bill_getset_value = new Bill_Sys_AddVisit_DAO();
obj_bill_getset_value.CaseNo = arrlstCaseNo[i];
obj_bill_getset_value.CompanyId = CompanyID;
obj_bill_getset_value.DoctorID = DoctorID;
obj_bill_getset_value.EventDate = ChkDate;
obj_bill_getset_value.EventEndTimeType = "AM";
obj_bill_getset_value.EventTimeType = "AM";
obj_bill_getset_value.EventEndTime = "9.00";
obj_bill_getset_value.EventNote = "";
obj_bill_getset_value.IStatus = "2";
obj_bill_getset_value.EventTime = "8.30";
obj_bill_getset_value.TypeCodeId = "TY000000000000000003";
obj_bill_getset_value.VisitTypeId = VisitType;
arrlstAddDetails.Add(obj_bill_getset_value);
}
ArrayList arrlstProcedureCode = new ArrayList();
foreach (ListItem li in lstProcedureCode.Items)
{
obj_bill_getset_value = new Bill_Sys_AddVisit_DAO();
if (li.Selected == true)
{
obj_bill_getset_value.ProcedureCode = li.Value.ToString();
arrlstProcedureCode.Add(obj_bill_getset_value);
flag = 1;
}
}
if (flag == 1)
{
Bill_Sys_Bulk_Visits objVisits = _bill_Sys_Visit_BO.InsertBulkVisit(arrlstAddDetails, arrlstProcedureCode);
if (objVisits.InValidList != null)
{
if (objVisits.InValidList.Count != 0)
{
// show list of in-valid case numbers. "Visits could not be added to these cases"
lblInvalidCaseNo.Text = "";
for (int i = 0; i < objVisits.InValidList.Count; i++)
{
lblInvalidCaseNo.Text += objVisits.InValidList[i].ToString() + ",";
}
lblInvalidCaseNo.Text = lblInvalidCaseNo.Text.Substring(0, lblInvalidCaseNo.Text.Length - 1);
trInvalid.Visible = true;
}
}
if (objVisits.ValidList != null)
{
if (objVisits.ValidList.Count != 0)
{
// show list of valid case numbers. "Visits that could be added to the cases"
lblValidCaseNo.Text = "";
for (int i = 0; i < objVisits.ValidList.Count; i++)
{
lblValidCaseNo.Text += objVisits.ValidList[i].ToString() + ",";
}
lblValidCaseNo.Text = lblValidCaseNo.Text.Substring(0, lblValidCaseNo.Text.Length - 1);
trValid.Visible = true;
}
}
pnlChkCaseno.Visible = true;
ClearControl();
}
else if (flag == 0)
{
Bill_Sys_Bulk_Visits objVisits = _bill_Sys_Visit_BO.InsertBulkVisit(arrlstAddDetails, arrlstProcedureCode);
if (objVisits.InValidList != null)
{
if (objVisits.InValidList.Count != 0)
{
// show list of in-valid case numbers. "Visits could not be added to these cases"
for (int i = 0; i < objVisits.InValidList.Count; i++)
{
lblInvalidCaseNo.Text += objVisits.InValidList[i].ToString() + ",";
}
lblInvalidCaseNo.Text = lblInvalidCaseNo.Text.Substring(0, lblInvalidCaseNo.Text.Length - 1);
trInvalid.Visible = true;
}
}
if (objVisits.ValidList != null)
{
if (objVisits.ValidList.Count != 0)
{
// show list of valid case numbers. "Visits that could be added to the cases"
for (int i = 0; i < objVisits.ValidList.Count; i++)
{
lblValidCaseNo.Text += objVisits.ValidList[i].ToString() + ",";
}
lblValidCaseNo.Text = lblValidCaseNo.Text.Substring(0, lblValidCaseNo.Text.Length - 1);
trValid.Visible = true;
}
}
pnlChkCaseno.Visible = true;
ClearControl();
}
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
string str2 = "Error Request=" + id + ".Please share with Technical support.";
base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
}
//Method End
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
}
private void ClearControl()
{
//Logging Start
string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);
using (Utils utility = new Utils())
{
utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
}
try
{
txtCaseNo.Text = "";
txtAddDate.Text = "";
extddlDoctor.Text = "NA";
extddlVisitType.Text = "NA";
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
string str2 = "Error Request=" + id + ".Please share with Technical support.";
base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
}
//Method End
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
}
protected void extddlDoctor_extendDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
if (_bill_Sys_Calender.CheckReferralExists(extddlDoctor.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID))
{
//RowProcedureCode.Visible = true;
GetProcedureCode(extddlDoctor.Text);
}
else
{
lstProcedureCode.Items.Clear();
//RowProcedureCode.Visible = false;
}
}
private void GetProcedureCode(string p_szDoctorID)
{
string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);
using (Utils utility = new Utils())
{
utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
}
Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
try
{
lstProcedureCode.Items.Clear();
lstProcedureCode.DataSource = _bill_Sys_Calender.GetReferringDoctorProcedureCodeList(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, p_szDoctorID);
lstProcedureCode.DataTextField = "DESCRIPTION";
lstProcedureCode.DataValueField = "CODE";
lstProcedureCode.DataBind();
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
string str2 = "Error Request=" + id + ".Please share with Technical support.";
base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
}
//Method End
using (Utils utility = new Utils())
{
utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
}
}
}