private int GetAccountableUserId(string name) { //TODO: we don't care about userid anymore, need to replace with a "AccountableTo" which can be physician or other! Inbox is based on this ID // ARGGG.. TEMP FIX: we will use the userid of the current clinic's attending. how to get this? string match for now... string apptPhysician = name; int userId = 0; UserDa da = new UserDa(); // we have the attending, is there a username that matches? Appt Physician is in format like SCARDINO, PETER (then sometime middle initial) string[] attending = apptPhysician.Trim().Split(new Char[] { ',' }); if (attending.Length > 1) { string[] attendingFirstAndMiddle = attending[1].Trim().Split(new Char[] { ' ' }); string attendingLast = attending[0].ToUpper(); string attendingFirst = attendingFirstAndMiddle[0].ToUpper(); DataSet userDs = da.GetUserIdByFirstAndLastName(attendingFirst, attendingLast); if (userDs.Tables[0].Rows.Count == 1) { userId = int.Parse(userDs.Tables[0].Rows[0]["UserId"].ToString()); } } // if userid is 0, we could NOT find a matching attending, so insert the current userId if (userId == 0) { DataSet ds = da.GetByUserName(this.EFormUserName); userId = int.Parse(ds.Tables[0].Rows[0][0].ToString()); } return(userId); }
public string GetCallbackResult() { string fName = _callBackArgs["FirstName"]; string lName = _callBackArgs["LastName"]; fName = fName == null ? string.Empty : fName; lName = lName == null ? string.Empty : lName; UserDa da = new UserDa(); DataTable userRecords = da.GetUserIdByFirstAndLastName(fName, lName).Tables[0]; if (userRecords.Rows.Count > 0) { string[] colNames = new string[] { Caisis.BOL.User.UserId, Caisis.BOL.User.UserFirstName, Caisis.BOL.User.UserLastName, Caisis.BOL.User.UserEmail }; string jsArray = PageUtil.DataTableToJSArray(userRecords, colNames, true); return(jsArray); } else { return(string.Empty); } return(string.Empty); }