public List <TherapistModel> getDatagridDetails() { List <TherapistModel> lstTherapist = new List <TherapistModel>(); TherapistModel t = new TherapistModel(); try { queryString = "SELECT ID, firstName as 'FIRST NAME', lastName as 'LAST NAME', wage as 'WAGE' FROM dbspa.tbltherapist" + " WHERE (isDeleted = 0)"; MySqlDataReader reader = conDB.getSelectConnection(queryString, null); while (reader.Read()) { t.ID1 = reader["ID"].ToString(); t.FirstName = reader["FIRST NAME"].ToString(); t.LastName = reader["LAST NAME"].ToString(); t.Wage = reader["WAGE"].ToString(); lstTherapist.Add(t); t = new TherapistModel(); } conDB.closeConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(lstTherapist); }
public void fillComboTherapist(System.Windows.Controls.ComboBox cmb) { try { queryString = "SELECT ID, firstName, lastName, wage, description FROM dbspa.tbltherapist WHERE (isDeleted = 0)"; MySqlDataReader reader = conDB.getSelectConnection(queryString, null); while (reader.Read()) { TherapistModel tm = new TherapistModel(); tm.ID1 = reader["ID"].ToString(); tm.FirstName = reader["firstName"].ToString(); tm.LastName = reader["lastName"].ToString(); tm.Wage = reader["wage"].ToString(); tm.Description = tm.FirstName + " " + tm.LastName; cmb.Items.Add(tm); } conDB.closeConnection(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } }
private void btnCompute_Click(object sender, RoutedEventArgs e) { TherapistModel tm = dgvTherapist.SelectedItem as TherapistModel; if (tm != null) { TherapistSalary ts = new TherapistSalary(tm); ts.ShowDialog(); } else { MessageBox.Show("No record selected!"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { TherapistModel tm = dgvTherapist.SelectedItem as TherapistModel; if (tm != null) { tm.IfEditDetails = true; TherapistDetails cd = new TherapistDetails(this, tm); cd.ShowDialog(); } else { MessageBox.Show("No record selected!"); } }
private List <TherapistModel> getAttendanceForTherapist(int ID) { TherapistModel thera = new TherapistModel(); List <TherapistModel> lstThera = new List <TherapistModel>(); try { queryString = "SELECT ID, attendanceDate, timeIn, timeOut, therapistID, minutesLate, isLate, deduction, ifhalfday, " + "ifUndertime, lateDeduction, undertimeDeduction FROM dbspa.tblattendance WHERE " + "(dbspa.tblattendance.isDeleted = 0) AND (therapistID = ?) AND (attendanceDate BETWEEN ? AND ?)"; parameters = new List <string>(); parameters.Add(ID.ToString()); DateTime date = DateTime.Parse(dateFrom.Text); parameters.Add(date.Year + "/" + date.Month + "/" + date.Day); date = DateTime.Parse(dateTo.Text); parameters.Add(date.Year + "/" + date.Month + "/" + date.Day); MySqlDataReader reader = conDB.getSelectConnection(queryString, parameters); while (reader.Read()) { thera = new TherapistModel(); thera.ID1 = reader["therapistID"].ToString(); thera.AttendanceDate = DateTime.Parse(reader["attendanceDate"].ToString()); thera.TimeIn = reader["timeIn"].ToString(); thera.TimeOut = reader["timeOut"].ToString(); thera.MinutesLate = reader["minutesLate"].ToString(); thera.IsLate = Convert.ToInt32(reader["isLate"].ToString()); thera.Deduction = reader["deduction"].ToString(); thera.Ifhalfday = Convert.ToInt32(reader["ifhalfday"].ToString()); thera.ifUnderTime = Convert.ToInt32(reader["ifUndertime"].ToString()); thera.lateDeduction = reader["lateDeduction"].ToString(); thera.undertimeDeduction = reader["undertimeDeduction"].ToString(); lstThera.Add(thera); } conDB.closeConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(lstThera); }
private bool checkIfAlreadyLoggedIn() { bool ifLogIn = false; int idThera = 0; try { if (cmbTherapist.SelectedItem != null) { TherapistModel therapist = cmbTherapist.SelectedItem as TherapistModel; queryString = "SELECT therapistID FROM dbspa.tblattendance WHERE therapistID = ? AND attendanceDate = ? AND isDeleted = 0"; parameters = new List <string>(); parameters.Add(therapist.ID1); DateTime date = DateTime.Parse(dteAttendance.Text); parameters.Add(date.Year + "-" + date.Month + "-" + date.Day); MySqlDataReader reader = conDB.getSelectConnection(queryString, parameters); while (reader.Read()) { idThera = Convert.ToInt32(reader["therapistID"].ToString()); } conDB.closeConnection(); if (idThera > 0) { ifLogIn = true; } } else { System.Windows.MessageBox.Show("Please select Therapist!"); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } return(ifLogIn); }
private bool checkTherapistIfTheSame() { bool ifthesame = false; TherapistModel therapist = cmbTherapist.SelectedItem as TherapistModel; TherapistAttendance attM = dgvAttendance.SelectedItem as TherapistAttendance; if (therapist != null && attM != null) { if (therapist.ID1.Equals(attM.TherapistID)) { ifthesame = true; } } return(ifthesame); }
private bool checkTimeIn(int strTherapistId, string recordID) { bool ifTimeIn = false; TherapistModel tm = new TherapistModel(); try { queryString = "SELECT dbspa.tblattendance.ID, dbspa.tbltherapist.description AS 'THERAPIST', dbspa.tblattendance.attendanceDate AS 'DATE', " + "dbspa.tblattendance.timeIn AS 'TIME IN', dbspa.tblattendance.timeOut AS 'TIME OUT' FROM (dbspa.tblattendance INNER JOIN " + "dbspa.tbltherapist ON dbspa.tblattendance.therapistID = dbspa.tbltherapist.ID) WHERE (dbspa.tblattendance.isDeleted = 0) AND " + "(dbspa.tbltherapist.isDeleted = 0) AND (tblAttendance.therapistID = ?) AND dbspa.tblattendance.ID = ?"; parameters = new List <string>(); parameters.Add(strTherapistId.ToString()); parameters.Add(recordID); MySqlDataReader reader = conDB.getSelectConnection(queryString, parameters); while (reader.Read()) { tm.ID1 = reader["ID"].ToString(); tm.TimeIn = reader["TIME IN"].ToString(); } if (!string.IsNullOrEmpty(tm.TimeIn)) { ifTimeIn = true; } conDB.closeConnection(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } return(ifTimeIn); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure you want to Delete record?", "Delete Record", System.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { TherapistModel cm = dgvTherapist.SelectedItem as TherapistModel; if (cm != null) { int id = Convert.ToInt32(cm.ID1); if (id != 0) { deleteTherapistRecord(id); System.Windows.MessageBox.Show("Record deleted successfuly!"); } } else { System.Windows.MessageBox.Show("No record selected!"); } } }
private List <TherapistModel> getTherapistServed(int id) { List <TherapistModel> lstTM = new List <TherapistModel>(); TherapistModel tm = new TherapistModel(); queryString = "SELECT dbspa.tbltherapist.ID, dbspa.tbltherapist.firstName, dbspa.tbltherapist.lastName, dbspa.tbltherapist.wage, " + "dbspa.tbltherapist.description FROM ((dbspa.tblservicemade INNER JOIN dbspa.tbltherapist ON " + "dbspa.tblservicemade.therapistID = dbspa.tbltherapist.ID) INNER JOIN dbspa.tblClient ON " + "dbspa.tblservicemade.clientID = dbspa.tblclient.ID) WHERE (dbspa.tblservicemade.clientID = ?) AND (dbspa.tblservicemade.dateServiced = ?)"; parameters = new List <string>(); parameters.Add(id.ToString()); DateTime date = DateTime.Parse(DateTime.Now.ToShortDateString()); parameters.Add(date.Year + "/" + date.Month + "/" + date.Day); MySqlDataReader reader = conDB.getSelectConnection(queryString, parameters); while (reader.Read()) { tm.ID1 = reader["ID"].ToString(); tm.FirstName = reader["firstName"].ToString(); tm.LastName = reader["lastName"].ToString(); tm.Wage = reader["wage"].ToString(); tm.Description = reader["description"].ToString(); lstTM.Add(tm); tm = new TherapistModel(); } conDB.closeConnection(); return(lstTM); }
public IActionResult AddNewTherapist([FromBody] AddNewTherapistRequestDto requestDto) { if (requestDto.ClassifyGuids.Count() <= 0) { return(Failed(ErrorCode.Empty, "所属大类未选择")); } if (requestDto.Tag?.Count() <= 0) { return(Failed(ErrorCode.Empty, "擅长需填写")); } if (string.Join("", requestDto.Tag).Length > 300) { return(Failed(ErrorCode.Empty, "擅长超过最大长度限制")); } if (requestDto.MerchantProjectGuidList.Count() <= 0) { return(Failed(ErrorCode.Empty, "服务项目未选择")); } if (!string.IsNullOrEmpty(requestDto.Introduction)) { if (requestDto.Introduction.Length > 500) { return(Failed(ErrorCode.Empty, "个人简介超过最大长度限制")); } } var therapistBiz = new TherapistBiz(); var IsTherapistPhoneExist = therapistBiz.IsTherapistPhoneExist(requestDto.TherapistPhone); if (IsTherapistPhoneExist) { return(Failed(ErrorCode.UserData, "该手机号已注册!")); } var therapistGuid = Guid.NewGuid().ToString("N"); var tModel = new TherapistModel() { TherapistGuid = therapistGuid, TherapistName = requestDto.TherapistName, JobTitle = requestDto.JobTitle, MerchantGuid = UserID, PortraitGuid = requestDto.PortraitGuid, TherapistPhone = requestDto.TherapistPhone, TherapistPassword = CryptoHelper.AddSalt(therapistGuid, requestDto.TherapistPassword), Introduction = requestDto.Introduction, Tag = JsonConvert.SerializeObject(requestDto.Tag), CreatedBy = UserID, CreationDate = DateTime.Now, LastUpdatedBy = UserID, LastUpdatedDate = DateTime.Now }; var tpModelList = requestDto.MerchantProjectGuidList.Distinct().Select(d => new TherapistProjectModel() { TherapistProjectGuid = Guid.NewGuid().ToString("N"), TherapistGuid = tModel.TherapistGuid, ProjectGuid = d, CreatedBy = UserID, CreationDate = DateTime.Now, LastUpdatedBy = UserID, LastUpdatedDate = DateTime.Now, Enable = true }).ToList(); var classifyModels = requestDto.ClassifyGuids.Distinct().Select(d => new MerchantTherapistClassifyModel() { TherapistClassifyGuid = Guid.NewGuid().ToString("N"), TherapistGuid = tModel.TherapistGuid, ClassifyGuid = d, CreatedBy = UserID, CreationDate = DateTime.Now, LastUpdatedBy = UserID, LastUpdatedDate = DateTime.Now, Enable = true, OrgGuid = "" }).ToList(); var response = therapistBiz.AddNewTherapist(tModel, tpModelList, classifyModels); return(Success(response)); }
public ReportForm(TherapistModel tm, List <TherapistModel> lstTM) { therapist = tm; lstTherapist = lstTM; InitializeComponent(); }
private void btnTimeOut_Click(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrEmpty(dteAttendance.Text)) { if (checkTherapistIfTheSame()) { if (cmbTherapist.SelectedItem != null) { TherapistModel therapist = cmbTherapist.SelectedItem as TherapistModel; string recordID = ""; TherapistAttendance attM = dgvAttendance.SelectedItem as TherapistAttendance; if (attM != null) { recordID = attM.ID; } if (checkTimeIn(Convert.ToInt32(therapist.ID1), attM.ID)) { DateTime loggedOutTime; string strLogOut = Properties.Settings.Default.logOutTime; if (chkManualOut.IsChecked == true) { loggedOutTime = DateTime.Parse(dteAttendance.Text + " " + dateTimeOut.Text); } else { loggedOutTime = DateTime.Parse(dteAttendance.Text + " " + time.Content); } DateTime LogOut = DateTime.Parse(dteAttendance.Text + " " + strLogOut); if (loggedOutTime.Date.Equals(LogOut.Date)) { loggedOutTime = loggedOutTime.AddDays(-1); } int x = loggedOutTime.CompareTo(LogOut); int deductions = 0; //bool ifUndertime = false; int numIfUndertime = 0; if (x < 0) { deductions = Properties.Settings.Default.undertime; //ifUndertime = true; numIfUndertime = 1; } queryString = "UPDATE dbspa.tblattendance SET timeOut = ?, ifUndertime = ? , undertimeDeduction = ? WHERE therapistID = ? AND ID = ?"; parameters = new List <string>(); if (chkManualOut.IsChecked == true) { parameters.Add(dateTimeOut.Text); } else { parameters.Add(time.Content.ToString()); } parameters.Add(numIfUndertime.ToString()); parameters.Add(deductions.ToString()); parameters.Add(therapist.ID1); parameters.Add(recordID); conDB.AddRecordToDatabase(queryString, parameters); conDB.closeConnection(); //getAttendanceRecords(); System.Windows.MessageBox.Show("Time out for " + therapist.Description + " recorded successfully!"); conDB.writeLogFile("TIME OUT: " + therapist.Deduction); } else { System.Windows.MessageBox.Show("No Time In record found!"); } } else { System.Windows.MessageBox.Show("Please select Therapist!"); } } else { System.Windows.MessageBox.Show("Selected therapist not equal to selected record!"); } } else { System.Windows.MessageBox.Show("Please provide date for attendance!"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { getAttendanceRecords(); } }
private void updateLogInViaManual() { if (cmbTherapist.SelectedItem != null) { TherapistModel therapist = cmbTherapist.SelectedItem as TherapistModel; string recordID = ""; try { string strLogInTime = Properties.Settings.Default.LogInTime; string strHalfday = Properties.Settings.Default.haldayTime; DateTime loggedTime; DateTime dateNow = DateTime.Parse(dteAttendance.Text); if (chkManualIn.IsChecked == true) { loggedTime = DateTime.Parse(dateNow.ToShortDateString() + " " + dateTimeIn.Text); } else { loggedTime = DateTime.Parse(dateNow.ToShortDateString() + " " + time.Content); } DateTime logInTime = DateTime.Parse(dateNow.ToShortDateString() + " " + strLogInTime); DateTime halfDay = DateTime.Parse(dateNow.ToShortDateString() + " " + strHalfday); int x = loggedTime.CompareTo(logInTime); int y = loggedTime.CompareTo(halfDay); int deductions = 0; int lateDeduction = 0; int numIfLate = 0; int numIfHalfDay = 0; int minutes = 0; //CHECK IF LOG IN TIME IS HALFDAY if (y >= 0) { //ifHalfDay = true; numIfHalfDay = 1; if ((DateTime.Now.DayOfWeek == DayOfWeek.Saturday) || (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)) { //GET HALDAY DEDUCTION deductions = Properties.Settings.Default.halfdayDeduction; } else { deductions = Properties.Settings.Default.halfdayDeduction; } } else { //CHECK IF LOG IN TIME IS ON OR BEFORE OR AFTER SET LOG IN TIME //-1 BEFORE 1PM //0 - 1PM //1 - after 1PM if (x > 0) { TimeSpan span = loggedTime.Subtract(logInTime); minutes = span.Minutes; if (minutes < 0) { minutes = 0; } else { //ifLate = true; numIfLate = 1; } lateDeduction = checkMinutesToDeduct(minutes); } } parameters = new List <string>(); if (checkIfAlreadyLoggedIn()) { System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("THERAPIST: " + therapist.Description + " already has a Time In! " + "Update existing Time In record?", "Attendace", System.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { TherapistAttendance attM = dgvAttendance.SelectedItem as TherapistAttendance; if (attM != null) { recordID = attM.ID; } queryString = "UPDATE dbspa.tblattendance SET attendanceDate = ?, timeIn = ?, minutesLate = ?, isLate =?, " + " deduction = ?, ifhalfday = ?, lateDeduction = ? WHERE therapistID = ? AND dbspa.tblattendance.attendanceDate = ?"; DateTime date = DateTime.Parse(dteAttendance.Text); parameters.Add(date.Year + "/" + date.Month + "/" + date.Day); parameters.Add(dateTimeIn.Text); parameters.Add(minutes.ToString()); parameters.Add(numIfLate.ToString()); parameters.Add(deductions.ToString()); parameters.Add(numIfHalfDay.ToString()); parameters.Add(lateDeduction.ToString()); parameters.Add(therapist.ID1); parameters.Add(date.Year + "/" + date.Month + "/" + date.Day); conDB.AddRecordToDatabase(queryString, parameters); System.Windows.MessageBox.Show("Time in for " + therapist.Description + " recorded successfully!"); conDB.writeLogFile("TIME IN:(MANUAL) UPDATE EXISTING RECORD FOR: " + therapist.Deduction); } else { } } else { queryString = "INSERT INTO dbspa.tblattendance (attendanceDate, timeIn, therapistID, isDeleted, minutesLate, isLate, deduction, " + "ifhalfday, lateDeduction, undertimeDeduction, ifUndertime) VALUES(?,?,?,?,?,?,?,?,?,?,?)"; parameters = new List <string>(); DateTime date = DateTime.Parse(dteAttendance.Text); parameters.Add(date.Year + "/" + date.Month + "/" + date.Day); parameters.Add(dateTimeIn.Text); parameters.Add(therapist.ID1); parameters.Add(0.ToString()); parameters.Add(minutes.ToString()); parameters.Add(numIfLate.ToString()); parameters.Add(deductions.ToString()); parameters.Add(numIfHalfDay.ToString()); parameters.Add(lateDeduction.ToString()); parameters.Add(0.ToString()); parameters.Add(0.ToString()); conDB.AddRecordToDatabase(queryString, parameters); System.Windows.MessageBox.Show("Time in for " + therapist.Description + " recorded successfully!"); conDB.writeLogFile("TIME IN:(MANUAL) SAVE NEW RECORD FOR " + therapist.Deduction); } conDB.closeConnection(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } finally { getAttendanceRecords(); } } else { System.Windows.MessageBox.Show("Please select Therapist!"); } }
public TherapistDetails(Therapist t, TherapistModel tm) { tModel = tm; therapist = t; InitializeComponent(); }
public TherapistSalary(TherapistModel tm) { therapist = tm; InitializeComponent(); }
public IHttpActionResult SendConfirmationEmail(TherapistModel therapistModel) { return(Ok()); }
public IHttpActionResult Post(TherapistModel therapistModel) { return(Ok()); }
private void printClientForm() { try { reportViewer.ProcessingMode = ProcessingMode.Local; LocalReport localReport = reportViewer.LocalReport; localReport.ReportPath = "Reports/ClientReport.rdlc"; reportViewer.RefreshReport(); //Create the list of parameters that will be passed to the report List <ReportParameter> paramList = new List <ReportParameter>(); ReportParameter param = new ReportParameter("name"); param.Values.Add(clientModel.FirstName + " " + clientModel.LastName); paramList.Add(param); param = new ReportParameter("date"); DateTime date = DateTime.Parse(clientModel.DateServiced); param.Values.Add(date.ToShortDateString()); paramList.Add(param); param = new ReportParameter("serialNumber"); param.Values.Add(clientModel.SerialNumber); paramList.Add(param); param = new ReportParameter("cod"); param.Values.Add(clientModel.Cod); paramList.Add(param); param = new ReportParameter("address"); param.Values.Add(clientModel.Address); paramList.Add(param); param = new ReportParameter("serviceMode"); param.Values.Add(clientModel.ServiceMode); paramList.Add(param); param = new ReportParameter("timeIn"); param.Values.Add(clientModel.TimeIn); paramList.Add(param); param = new ReportParameter("timeOut"); if (string.IsNullOrEmpty(clientModel.TimeOut)) { param.Values.Add(" "); } else { param.Values.Add(clientModel.TimeOut); } paramList.Add(param); double total = 0.0; double prodTotal = 0.0; string[] strArr; string[] priceArr; if (clientModel.LstServiceTypeModel.Count < 1) { strArr = new string[1]; priceArr = new string[1]; priceArr[0] = "\r" + "0.0" + "\n"; strArr[0] = "\r" + "None" + "\n"; } else { strArr = new string[clientModel.LstServiceTypeModel.Count]; priceArr = new string[clientModel.LstServiceTypeModel.Count]; for (int i = 0; i < clientModel.LstServiceTypeModel.Count; i++) { ServiceTypeModel stm = clientModel.LstServiceTypeModel[i]; double x = 0.0; x = x + Convert.ToDouble(stm.Price); total += x; priceArr[i] = "\r" + stm.Price + "\n"; strArr[i] = "\r" + stm.ServiceType + "\n"; } } string[] strThera = new string[1]; if (clientModel.LstTherapistModel.Count < 1) { strThera[0] = "\r" + "-" + "\n"; } else { strThera = new string[clientModel.LstTherapistModel.Count]; for (int i = 0; i < clientModel.LstTherapistModel.Count; i++) { TherapistModel tm = clientModel.LstTherapistModel[i]; strThera[i] = "\r" + tm.ToString() + "\n"; } } string[] strProducts = new string[1]; string[] strProductPrice = new string[1]; if (clientModel.lstProductsBought.Count < 1) { strProducts[0] = "\r" + "None" + "\n"; strProductPrice[0] = "\r" + "0.0" + "\n"; } else { strProducts = new string[clientModel.lstProductsBought.Count]; strProductPrice = new string[clientModel.lstProductsBought.Count]; for (int x = 0; x < clientModel.lstProductsBought.Count; x++) { ProductBoughtModel prodBought = clientModel.lstProductsBought[x]; double pp = Convert.ToDouble(String.Format("{0:0.00}", prodBought.ProductPrice)); strProducts[x] = "\r" + prodBought.ProductName + "\n"; strProductPrice[x] = "\r" + prodBought.ProductPrice + "\n"; prodTotal = prodTotal + pp; } } total = total + prodTotal; param = new ReportParameter("total"); param.Values.Add(total.ToString()); paramList.Add(param); //MULTI LEVEL PARAMS ReportParameter multiValueParam = new ReportParameter("serviceType"); multiValueParam.Values.AddRange(strArr); paramList.Add(multiValueParam); multiValueParam = new ReportParameter("amounts"); multiValueParam.Values.AddRange(priceArr); paramList.Add(multiValueParam); multiValueParam = new ReportParameter("therapist"); multiValueParam.Values.AddRange(strThera); paramList.Add(multiValueParam); multiValueParam = new ReportParameter("products"); multiValueParam.Values.AddRange(strProducts); paramList.Add(multiValueParam); multiValueParam = new ReportParameter("productprice"); multiValueParam.Values.AddRange(strProductPrice); paramList.Add(multiValueParam); //ADD PARAMETERS //Set the ReportViewers parameters to the list of ReportParameters we just created this.reportViewer.LocalReport.SetParameters(paramList.ToArray()); // Refresh the report reportViewer.RefreshReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.reportViewer.RefreshReport(); this.reportViewer.RefreshReport(); }