public static List <Effectiveness> GetMasterTrainingEffectivenessDetails() { DataAccessClass daTrainingCourse = new DataAccessClass(); List <Effectiveness> lstEffDtls = new List <Effectiveness>(); try { daTrainingCourse.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@Category", SqlDbType.VarChar, 50); sqlParam[0].Value = "TrainingEffectiveness"; SqlDataReader dr = daTrainingCourse.ExecuteReaderSP(SPNames.TNI_GetMasterSP, sqlParam); while (dr.Read()) { Effectiveness teff = new Effectiveness(); teff.EffectivenessID = Convert.ToInt32(dr[DbTableColumn.TrainingEffectivenessID]); teff.EffectivenessName = Convert.ToString(dr[DbTableColumn.TrainingEffectivenessName]); teff.IsSelected = false; lstEffDtls.Add(teff); } } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, clsCommonRepository, "GetTrainingEffectivenessDetails", EventIDConstants.TRAINING_DATA_ACCESS_LAYER); } finally { daTrainingCourse.CloseConncetion(); } return(lstEffDtls); }
/// <summary> /// Patient confirms that they want to cancel the selected appointment /// </summary> private void ConfirmCancelAppointmentButton_Click(object sender, EventArgs e) { //store the currently selected appointment ListViewItem.ListViewSubItemCollection items = AppointmentsList.FocusedItem.SubItems; //find the AppointmentClass object corresponding to the selected appointment //first get all appointments related to the patient from the database List <AppointmentClass> lstAppointments = DataAccessClass.getAppointmentsWithCustomerName(m_strUserName); //determine which appointment object corresponds to the selected list item String date = items[1].Text.ToString(); String time = items[2].Text.ToString(); DateTime dateAndTime = DateTime.Parse(date + " " + time); AppointmentClass selectedAppointment = null; foreach (AppointmentClass appointment in lstAppointments) { if (appointment.m_dtDateTime == dateAndTime) { selectedAppointment = appointment; } } //send appointment back to the database with cancel status DataAccessClass.updateAppointmentStatus(selectedAppointment, 'C'); //strikeout appointment in the "Upcoming Appointments" list and hide cancel appointment panel AppointmentsList.FocusedItem.Font = new Font("Arial", 9F, FontStyle.Strikeout, GraphicsUnit.Point, ((byte)(0))); AppointmentDetailsPanel.Visible = false; ConfirmCancelAppointmentPanel.Visible = false; }
public ProfileTest() { //TODO: move the code below to the common place and try to create everthing only once // instead of creating everthing on every test call. // or change in the main project SeeSharpLMS. _dataAccess = new DataAccessClass(); }
public List <KeyValuePair <int, string> > GetRMSRoles() { DataAccessClass objGetTraining = new DataAccessClass(); List <KeyValuePair <int, string> > RMSRoles = new List <KeyValuePair <int, string> >(); try { objGetTraining.OpenConnection(DBConstants.GetDBConnectionString()); //SqlParameter[] sqlParam = new SqlParameter[1]; //sqlParam[0] = new SqlParameter(SPParameter.RaiseID, SqlDbType.Int); //sqlParam[0].Value = roleid; SqlDataReader dr = objGetTraining.ExecuteReaderSP(SPNames.USP_TNI_GetRMSRoles); while (dr.Read()) { RMSRoles.Add(new KeyValuePair <int, string>(Convert.ToInt32(dr[DbTableColumn.RoleId]), Convert.ToString(dr[DbTableColumn.RoleName]))); } return(RMSRoles); } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.CommonLayer, "GetRMSRoles", "GetRMSRoles", EventIDConstants.AUTHORIZATION_MANAGER_ERROR); } finally { objGetTraining.CloseConncetion(); } }
public List <GroupMasterModel> GetGroupMaster() { DataAccessClass objData = new DataAccessClass(); SqlCommand cmd = new SqlCommand(); return(objData.ExecuteReaderSP_WithConnection <GroupMasterModel>(SPNames.Get_GroupMaster, cmd)); }
public void UpdateSectionTest() { Section section = _dataAccess._context.Section.FirstOrDefault(x => x.Id == 29); section.InstructorId = "485fda5a-00e6-4d2a-85c0-4cf8fbbc98ce"; section.Location = "TEST ROOM"; section.StartTime = new TimeSpan(8, 45, 0); section.EndTime = new TimeSpan(9, 50, 0); section.TermId = 2; section.Days = "TR"; section.EnrollmentCap = 55; section.CourseId = 9; SeeSharpLMS.DataAccessLayer.DataAccessClass data = new DataAccessClass(); data.UpdateSection(section); Assert.AreEqual("485fda5a-00e6-4d2a-85c0-4cf8fbbc98ce", section.InstructorId); Assert.AreEqual("TEST ROOM", section.Location); Assert.AreEqual(new TimeSpan(8, 45, 0), section.StartTime); Assert.AreEqual(new TimeSpan(9, 50, 0), section.EndTime); Assert.AreEqual(2, section.TermId); Assert.AreEqual("TR", section.Days); Assert.AreEqual(55, section.EnrollmentCap); Assert.AreEqual(9, section.CourseId); }
public static List <KeyValuePair <int, string> > GetAllEmployeeList() { DataAccessClass objGetTraining = new DataAccessClass(); List <KeyValuePair <int, string> > employeeList = new List <KeyValuePair <int, string> >(); try { objGetTraining.OpenConnection(DBConstants.GetDBConnectionString()); SqlDataReader dr = objGetTraining.ExecuteReaderSP(SPNames.TNI_GetAllActiveEmployeeList); while (dr.Read()) { employeeList.Add(new KeyValuePair <int, string>(Convert.ToInt32(dr[DbTableColumn.EMPId]), Convert.ToString(dr[DbTableColumn.EmployeeName]))); } return(employeeList); } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.InfrastructureLayer, CommonConstants.CommonRepository, "GetAllEmployeeList", EventIDConstants.TRAINING_DATA_ACCESS_LAYER); } finally { objGetTraining.CloseConncetion(); } }
public DataSet GetData(string sp, SqlParameter parameter) { DataAccessClass da = new DataAccessClass(); DataSet ds = da.GetData(sp, parameter); return(ds); }
public KiesArchief(DataAccessClass DAC, dtsAlles dtsAlles) { InitializeComponent(); this.DAC = DAC; dtsAlles1 = dtsAlles; }
//Umesh: NIS-changes: Skill Search Report Ends //Siddhesh Arekar Domain Details 09032015 Start public bool Check_SkillCategory_Exists(string skillCategory) { bool isExists = false; objDA = new DataAccessClass(); sqlParam = new SqlParameter[2]; try { objDA.OpenConnection(DBConstants.GetDBConnectionString()); sqlParam[0] = new SqlParameter(SPParameter.SkillCategory, skillCategory); sqlParam[1] = new SqlParameter(SPParameter.IsSkillExist, isExists); sqlParam[1].Direction = ParameterDirection.Output; objDA.ExecuteNonQuerySP(SPNames.CheckSkillCategory, sqlParam); isExists = (bool)sqlParam[1].Value; } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, "Check_SkillCategory_Exists", EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER); } finally { objDA.CloseConncetion(); } return(isExists); }
//19645-Ambar-Start public void DeleteEmpResumeDetails(string str_deletedfile, int EMPId) { try { objDA = new DataAccessClass(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[2]; sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int); sqlParam[0].Value = EMPId; sqlParam[1] = new SqlParameter(SPParameter.FileName, SqlDbType.NVarChar, 100); sqlParam[1].Value = str_deletedfile; objDataReader = objDA.ExecuteReaderSP(SPNames.USP_Employee_DelEmployeeResumeDetails, sqlParam); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, "AddResumeDetails", EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER); } finally { objDA.CloseConncetion(); } }
//Umesh: NIS-changes: Skill Search Report Starts public BusinessEntities.RaveHRCollection GetPrimaryAndSecondarySkills() { objDA = new DataAccessClass(); try { BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); objDataReader = objDA.ExecuteReaderSP(SPNames.Employee_GetPrimaryAndSecondarySkills); while (objDataReader.Read()) { KeyValue <string> keyValue = new KeyValue <string>(); keyValue.KeyName = objDataReader.GetValue(0).ToString(); keyValue.Val = objDataReader.GetValue(0).ToString(); raveHRCollection.Add(keyValue); } return(raveHRCollection); } catch (Exception ex) { throw ex; } finally { if (objDataReader != null) { objDataReader.Close(); } objDA.CloseConncetion(); } }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } List <CourseInfo> CourseInfos = HttpContext.Session.Get <List <CourseInfo> >("CourseInfo"); user = HttpContext.Session.Get <ApplicationUser>("UserInfo"); Enrollment = await _context.Enrollment .Include(e => e.ApplicationUser) .Include(e => e.Section).FirstOrDefaultAsync(m => m.Id == id); CourseInfos.RemoveAll(c => c.SectionId == Enrollment.SectionId); HttpContext.Session.Set <List <CourseInfo> >("CourseInfo", CourseInfos); Course = _context.Course.FirstOrDefault(c => c.Id == Enrollment.Section.CourseId); Charge Charge = new Charge(); Charge.Reason = "Withdraw from " + Course.Subject + " " + Course.Number + " Section " + Enrollment.SectionId; Charge.Date = DateTime.Now; Charge.Amount = -1 * (Course.CreditHours * SD.CostPerCredit + Course.CourseFee); Charge.StudentId = user.Id; if (Enrollment != null) { DataAccessClass dataAccess = new DataAccessClass(); dataAccess.RemoveEnrollment(Enrollment); dataAccess.AddCharge(Charge); } return(RedirectToPage("./Index")); }
/// <summary> /// Deletes the visa details by emp id. /// </summary> /// <param name="EmployeeId">The employee id.</param> public void DeleteVisaDetailsByEmpId(int EmployeeId) { objDA = new DataAccessClass(); sqlParam = new SqlParameter[1]; try { objDA.OpenConnection(DBConstants.GetDBConnectionString()); sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int); sqlParam[0].Value = EmployeeId; objDA.ExecuteNonQuerySP(SPNames.Employee_DeleteVisaDetailsByEmpId, sqlParam); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, Fn_DeleteVisaDetailsByEmpId, EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER); } finally { objDA.CloseConncetion(); } }
public async Task FillErrorsLogAndUploadTest() { DataAccess spec = new DataAccessClass(); try { var cf = _sliFiles[0]; await FileManager.CopyAndUpload(cf, "SLI-2"); // make file busy spec.Open(cf, OpenMode.dReadWrite); await FileManager.CopyAndUpload(cf, "SLI-2"); var lst = await FileManager.ShowFilesWithErrors(); Assert.IsTrue(lst.Any()); spec.Close(); await FileManager.UploadFilesWithErrors(); lst = await FileManager.ShowFilesWithErrors(); Assert.IsFalse(lst.Any()); } finally { if (spec.IsOpen) { spec.Close(); } } }
/// <summary> /// Deallocate the employee from seat. /// </summary> /// <returns></returns> public List <BusinessEntities.SeatAllocation> UnallocatedEmployee() { DataAccessClass objDASeatAllocation = new DataAccessClass(); List <BusinessEntities.SeatAllocation> objListSeatAlloctaion = null; // Initialise Collection class object raveHRCollection = new BusinessEntities.RaveHRCollection(); try { objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString()); //--get result DataSet dsSeatDescription = objDASeatAllocation.GetDataSet(SPNames.SeatAllocation_GetUnallocatedEmployee); //--Create entities and add to list BusinessEntities.SeatAllocation objBESeatDetail = null; objListSeatAlloctaion = new List <BusinessEntities.SeatAllocation>(); foreach (DataRow dr in dsSeatDescription.Tables[0].Rows) { objBESeatDetail = new BusinessEntities.SeatAllocation(); if (dr[DbTableColumn.Seat_EmployeeID].ToString() != string.Empty) { objBESeatDetail.EmployeeID = Convert.ToInt32(dr[DbTableColumn.Seat_EmployeeID]); } if (dr[DbTableColumn.Seat_EmployeeCode].ToString() != string.Empty) { objBESeatDetail.EmployeeCode = dr[DbTableColumn.Seat_EmployeeCode].ToString(); } if (dr[DbTableColumn.Seat_EmployeeName].ToString() != string.Empty) { objBESeatDetail.EmployeeName = dr[DbTableColumn.Seat_EmployeeName].ToString(); } if (dr[DbTableColumn.Seat_EMPEmailID].ToString() != string.Empty) { objBESeatDetail.EmployeeEmailID = dr[DbTableColumn.Seat_EMPEmailID].ToString(); } //--add to list objListSeatAlloctaion.Add(objBESeatDetail); } return(objListSeatAlloctaion); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "UnallocatedEmployee", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER); } finally { objDASeatAllocation.CloseConncetion(); } }
public int Insert_Update_Budget(BudgetResult objBudget) { DataAccessClass objData = new DataAccessClass(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue(SPParameter.Budget_Year, objBudget.Year); cmd.Parameters.AddWithValue(SPParameter.Budget_Month, objBudget.Month); cmd.Parameters.AddWithValue(SPParameter.Budget_ProjectId, objBudget.ProjectId); cmd.Parameters.AddWithValue(SPParameter.Budget_CostCodeId, objBudget.CostCodeId); cmd.Parameters.AddWithValue(SPParameter.Budget_Budget, objBudget.Budget); cmd.Parameters.AddWithValue(SPParameter.Budget_BusinessVerticalId, objBudget.BusinessVerticalId); if (objBudget.BudgetId != 0) { if (objBudget.Budget == 0) { cmd = new SqlCommand(); cmd.Parameters.AddWithValue(SPParameter.LastModifiedById, objBudget.CreatedById); cmd.Parameters.AddWithValue(SPParameter.BudgetId, objBudget.BudgetId); return(Convert.ToInt32(objData.ExecuteScalarSP_WithConnection(SPNames.Delete_Budget, cmd))); } else { cmd.Parameters.AddWithValue(SPParameter.LastModifiedById, objBudget.CreatedById); cmd.Parameters.AddWithValue(SPParameter.BudgetId, objBudget.BudgetId); return(Convert.ToInt32(objData.ExecuteScalarSP_WithConnection(SPNames.Update_Budget, cmd))); } } else { cmd.Parameters.AddWithValue(SPParameter.CreatedBy, objBudget.CreatedById); return(Convert.ToInt32(objData.ExecuteScalarSP_WithConnection(SPNames.Insert_Budget, cmd))); } }
// string cs = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Md. Lutful\Documents\Visual Studio 2012\Projects\FolderLocker_22_3_17\LoginData.mdf;Integrated Security=True;Connect Timeout=30"; //string cs = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Md. Lutful\Documents\Visual Studio 2012\Projects\LoginProject\LoginAdmin\MyDataBase.mdf;Integrated Security=True;Connect Timeout=30"; private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "") { MessageBox.Show("Please provide UserName and Password"); return; } try { DataAccessClass dac = new DataAccessClass(); Boolean log = dac.LoginMethod(textBox2.Text, textBox1.Text); if (log) { MessageBox.Show("Login Successful!"); this.Hide(); MainMenu fm = new MainMenu(); fm.ShowDialog(); this.Close(); } else { MessageBox.Show("Login Failed!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// Mohamed : : 29/12/2014 : Ends #endregion Modified By Mohamed Dangra /// <summary> /// Added by Kanchan for the requirment specified in the Discussion with Sawita Kamath and Gaurav Thakkar. /// Requirment raised: /// Gives the emailId for the employee whose Employee id is supplied. /// </summary> /// <param name="empId"></param> /// <returns></returns> public string getEmployeeEmailID(int empId) { DataAccessClass objDAForMaster = new DataAccessClass(); SqlParameter[] sqlParam = new SqlParameter[1]; BusinessEntities.MRFDetail mrfDetail = new MRFDetail(); string emailID = string.Empty; DataSet empDetail = new DataSet(); try { //Opens the connection. objDAForMaster.OpenConnection(DBConstants.GetDBConnectionString()); sqlParam[0] = new SqlParameter(SPParameter.EmpId, DbType.Int32); sqlParam[0].Value = empId; empDetail = objDAForMaster.GetDataSet(SPNames.Contract_EmpEmailID, sqlParam); foreach (DataRow dr in empDetail.Tables[0].Rows) { emailID = dr[DbTableColumn.EmailId].ToString(); } return(emailID); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, "Master", "getEmployeeEmailID", EventIDConstants.RAVE_HR_MASTER_DATA_ACCESS_LAYER); } finally { objDAForMaster.CloseConncetion(); } }
public void CreateSectionTest() { //databse connection Section section = new Section(); section.InstructorId = "c5659548-0794-44b9-9441-e462ab2f8b17"; section.Location = "online"; section.StartTime = new TimeSpan(5, 30, 0); section.EndTime = new TimeSpan(7, 30, 0); section.TermId = 2; section.Days = "MWF"; section.EnrollmentCap = 15; section.CourseId = 5; SeeSharpLMS.DataAccessLayer.DataAccessClass data = new DataAccessClass(); try { data.AddSection(section); } catch (Exception e) { System.Console.WriteLine(e); } Assert.AreEqual("c5659548-0794-44b9-9441-e462ab2f8b17", section.InstructorId); Assert.AreEqual("online", section.Location); Assert.AreEqual(new TimeSpan(5, 30, 0), section.StartTime); Assert.AreEqual(new TimeSpan(7, 30, 0), section.EndTime); Assert.AreEqual(2, section.TermId); Assert.AreEqual("MWF", section.Days); Assert.AreEqual(15, section.EnrollmentCap); Assert.AreEqual(5, section.CourseId); }
/// <summary> /// Gets the relevant experience. /// </summary> /// <param name="objGetOrganisationDetails">The obj get organisation details.</param> /// <returns></returns> public BusinessEntities.RaveHRCollection GetRelevantExperience(BusinessEntities.OrganisationDetails objGetOrganisationDetails) { // Initialise Data Access Class object objDA = new DataAccessClass(); sqlParam = new SqlParameter[1]; // Initialise Collection class object raveHRCollection = new BusinessEntities.RaveHRCollection(); try { //Open the connection to DB objDA.OpenConnection(DBConstants.GetDBConnectionString()); sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int); if (objGetOrganisationDetails.EMPId == 0) { sqlParam[0].Value = DBNull.Value; } else { sqlParam[0].Value = objGetOrganisationDetails.EMPId; } //Execute the SP objDataReader = objDA.ExecuteReaderSP(SPNames.Employee_GetRelevantExperience, sqlParam); while (objDataReader.Read()) { //Initialise the Business Entity object objOrganisationDetails = new BusinessEntities.OrganisationDetails(); objOrganisationDetails.ExperienceMonth = objDataReader[DbTableColumn.ExperienceInMonth].ToString() == string.Empty ? 0: int.Parse(objDataReader[DbTableColumn.ExperienceInMonth].ToString()); objOrganisationDetails.ExperienceYear = objDataReader[DbTableColumn.ExperienceInYear].ToString() == string.Empty ? 0: int.Parse(objDataReader[DbTableColumn.ExperienceInYear].ToString()); // Add the object to Collection raveHRCollection.Add(objOrganisationDetails); } // Return the Collection return(raveHRCollection); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, "GetRelevantExperience", EventIDConstants.RAVE_HR_PROJECTS_DATA_ACCESS_LAYER); } finally { if (objDataReader != null) { objDataReader.Close(); } objDA.CloseConncetion(); } }
public DataTable GetNominatedEmployees(int courseId) { List <DynamicGrid> objDynamicGridList; DataAccessClass objDBCon = new DataAccessClass(); objDynamicGridList = new List <DynamicGrid>(); //DynamicGrid objDynamicGrid = null; DataSet ds = null; SqlParameter[] sqlParam = new SqlParameter[1]; try { objDBCon.OpenConnection(DBConstants.GetDBConnectionString()); sqlParam[0] = new SqlParameter(SPParameter.CourseID, SqlDbType.Int); sqlParam[0].Value = courseId; ds = objDBCon.GetDataSet(SPNames.TNI_GetNominatedEmp, sqlParam); } catch (RaveHRException ex) { throw ex; } finally { objDBCon.CloseConncetion(); } return(ds.Tables[0]); //return objDynamicGridList; }
public bool SetAssessment(AssessmentPaperModel obj) { bool flag = false; DataAccessClass dataAccessClass = new DataAccessClass(); try { dataAccessClass.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[3]; sqlParam[0] = new SqlParameter(SPParameter.CourseId, SqlDbType.Int); sqlParam[0].Value = Int32.Parse(obj.CourseId.ToString()); sqlParam[1] = new SqlParameter(SPParameter.EmployeesId, SqlDbType.Text); sqlParam[1].Value = Convert.ToString(obj.EmpIdAll.ToString()); sqlParam[2] = new SqlParameter(SPParameter.CreatedBy, SqlDbType.Int); sqlParam[2].Value = Int32.Parse(obj.CreatedBy.ToString()); SqlDataReader dr = dataAccessClass.ExecuteReaderSP(SPNames.SetAssessment, sqlParam); while (dr.Read()) { flag = Convert.ToBoolean(dr[DbTableColumn.Status]); } } catch (Exception ex) { throw ex; } return(flag); }
//Validate day requested off, show an error message if the request failed private void ConfirmationPanelYesButton_Click(object sender, EventArgs e) { int success = DataAccessClass.requestDayOff_Doctor(DoctorTimeOffCalendar.SelectionStart, ucDoctorUser); if (success == -1) { ConfirmationPanelError1.Visible = true; } if (success == -2) { ConfirmationPanelError2.Visible = true; } if (success == -3) { ConfirmationPanelError3.Visible = true; } if (success == 1) { ConfirmationPanel.Visible = false; GenerateListView(); DoctorAppointmentListView.Invalidate(); DoctorAppointmentListView.Update(); } }
public IEnumerable <SelectListItem> FillDesignationList(int DeptId) { try { DataAccessClass dataAccessClass = new DataAccessClass(); dataAccessClass.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter(SPParameter.DepartmentId, SqlDbType.Int); sqlParam[0].Value = DeptId; SqlDataReader objReader = dataAccessClass.ExecuteReaderSP(SPNames.Employee_GetEmployeeDesignations, sqlParam); SelectListItem selListItem; List <SelectListItem> newList = new List <SelectListItem>(); newList.Add(new SelectListItem { Selected = true, Text = "Select", Value = "" }); while (objReader.Read()) { //assessmentModel.AssessmentPaper.AssessmentPaperId = Convert.ToInt32(dr[DbTableColumn.AssessmentPaperId]); selListItem = new SelectListItem() { Value = objReader[0].ToString().Trim(), Text = objReader[1].ToString().Trim() }; newList.Add(selListItem); } return(new SelectList(newList, "Value", "Text")); } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, clsEmployeeRepository, "GetDesignation", RMS.Common.Constants.EventIDConstants.TRAINING_DATA_ACCESS_LAYER); } }
public void AddCourse() { Course course = new Course(); //course.Id = 123; course.Subject = "PHYS"; course.Number = "4000"; course.Title = "Gravity"; course.Description = "Learn the ups and downs of Gravity"; course.CreditHours = 4; course.CourseFee = 0; SeeSharpLMS.DataAccessLayer.DataAccessClass data = new DataAccessClass(); try { data.AddCourse(course); } catch (Exception e) { System.Console.WriteLine(e); } Assert.AreEqual("PHYS", course.Subject); Assert.AreEqual("4000", course.Number); Assert.AreEqual("Gravity", course.Title); Assert.AreEqual("Learn the ups and downs of Gravity", course.Description); Assert.AreEqual(4, course.CreditHours); Assert.AreEqual(0, course.CourseFee); }
/// <summary> /// Get employee detail by id /// </summary> /// <returns>empid</returns> public EmployeeModel GetEmployeeDetailByID(int empid) { DataAccessClass objGetTraining = new DataAccessClass(); EmployeeModel employeedetail = new EmployeeModel(); try { objGetTraining.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int); sqlParam[0].Value = empid; SqlDataReader dr = objGetTraining.ExecuteReaderSP(SPNames.TNI_GetEmployeeDetailwithProject, sqlParam); while (dr.Read()) { employeedetail.EmpId = Convert.ToInt16(dr[DbTableColumn.EMPId]); employeedetail.EmployeeName = Convert.ToString(dr[DbTableColumn.EmployeeName]); employeedetail.EmailID = Convert.ToString(dr[DbTableColumn.EmailId]); employeedetail.Designation = Convert.ToString(dr[DbTableColumn.Designation]); employeedetail.PrimarySkill = Convert.ToString(dr[DbTableColumn.PrimarySkills]); } return(employeedetail); } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, clsEmployeeRepository, "GetEmployeeDetailByID", EventIDConstants.TRAINING_DATA_ACCESS_LAYER); } finally { objGetTraining.CloseConncetion(); } }
/// <summary> /// gets the Seat details as per the ID. /// </summary> /// <param name="EmpID"></param> /// <returns></returns> public BusinessEntities.SeatAllocation GetSeatDeatilsByID(BusinessEntities.SeatAllocation Seat) { DataAccessClass objDASeatAllocation = new DataAccessClass(); try { objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter(SPParameter.SeatID, DbType.Int32); sqlParam[0].Value = Seat.SeatID; //--get result DataSet dsSeatDescription = objDASeatAllocation.GetDataSet(SPNames.SeatAllocation_GetSeatDetailsByID, sqlParam); //--Create entities and add to list BusinessEntities.SeatAllocation objBESeatDetail = new BusinessEntities.SeatAllocation(); foreach (DataRow dr in dsSeatDescription.Tables[0].Rows) { if (dr[DbTableColumn.Seat_SeatName].ToString() != string.Empty) { objBESeatDetail.SeatName = dr[DbTableColumn.Seat_SeatName].ToString(); } if (dr[DbTableColumn.Seat_BayID].ToString() != string.Empty) { objBESeatDetail.BayID = Convert.ToInt32(dr[DbTableColumn.Seat_BayID]); } if (dr[DbTableColumn.Seat_Description].ToString() != string.Empty) { objBESeatDetail.SeatDescription = dr[DbTableColumn.Seat_Description].ToString(); } if (dr[DbTableColumn.Seat_ExtentionNo].ToString() != string.Empty) { objBESeatDetail.ExtensionNo = Convert.ToInt32(dr[DbTableColumn.Seat_ExtentionNo]); } if (dr[DbTableColumn.Seat_Landmark].ToString() != string.Empty) { objBESeatDetail.SeatLandmark = dr[DbTableColumn.Seat_Landmark].ToString(); } if (dr[DbTableColumn.Seat_EmployeeID].ToString() != string.Empty) { objBESeatDetail.EmployeeID = Convert.ToInt32(dr[DbTableColumn.Seat_EmployeeID].ToString()); } } return(objBESeatDetail); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetEmployeeDetailsByID", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER); } finally { objDASeatAllocation.CloseConncetion(); } }
public HygienistHomeForm(String strUserName, String strPassword) { InitializeComponent(); UserClass ucDoctorUser = BusinessLogicClass.QueryDatabaseForUser(strUserName, strPassword); DoctorHomeFormWelcomeLabel.Text = $"Welcome {ucDoctorUser.m_strFirstName} {ucDoctorUser.m_strLastName}"; List <AppointmentClass> lstAppointments = DataAccessClass.getAppointmentsWithDentistName(strUserName); int i = 1; foreach (AppointmentClass appointment in lstAppointments) { ListViewItem item = new ListViewItem("Appointment " + i); item.SubItems.Add(appointment.m_dtDateTime.Date.ToShortDateString()); item.SubItems.Add(appointment.m_dtDateTime.TimeOfDay.ToString()); item.SubItems.Add(appointment.m_strPatientName); item.SubItems.Add(appointment.m_strDescription); item.ForeColor = Color.LightSkyBlue; if (appointment.m_chrStatus[0] == 'C') { item.Font = new Font("Arial", 9F, FontStyle.Strikeout, GraphicsUnit.Point, ((byte)(0))); } else { item.Font = new Font("Arial", 9F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); } DoctorAppointmentListView.Items.Add(item); i++; } }
/// <summary> /// Updates the organisation details. /// </summary> /// <param name="objUpdateVisaDetails">The obj update visa details.</param> public void UpdateVisaDetails(BusinessEntities.VisaDetails objUpdateVisaDetails) { try { objDA = new DataAccessClass(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[5]; sqlParam[0] = new SqlParameter(SPParameter.VisaId, SqlDbType.Int); sqlParam[0].Value = objUpdateVisaDetails.VisaId; sqlParam[1] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int); sqlParam[1].Value = objUpdateVisaDetails.EMPId; sqlParam[2] = new SqlParameter(SPParameter.CountryName, SqlDbType.NChar, 50); if (objUpdateVisaDetails.CountryName == "" || objUpdateVisaDetails.CountryName == null) { sqlParam[2].Value = DBNull.Value; } else { sqlParam[2].Value = objUpdateVisaDetails.CountryName; } sqlParam[3] = new SqlParameter(SPParameter.VisaType, SqlDbType.NChar, 50); if (objUpdateVisaDetails.VisaType == "" || objUpdateVisaDetails.VisaType == null) { sqlParam[3].Value = DBNull.Value; } else { sqlParam[3].Value = objUpdateVisaDetails.VisaType; } sqlParam[4] = new SqlParameter(SPParameter.ExpiryDate, SqlDbType.SmallDateTime); if (objUpdateVisaDetails.ExpiryDate == null) { sqlParam[4].Value = DBNull.Value; } else { sqlParam[4].Value = objUpdateVisaDetails.ExpiryDate; } int UpdateVisaDetails = objDA.ExecuteNonQuerySP(SPNames.Employee_UpdateVisaDetails, sqlParam); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, Fn_UpdateVisaDetails, EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER); } finally { objDA.CloseConncetion(); } }
public void TestInitialize() { //Upewnienie, że baza posiada najnowszy model danych Database.SetInitializer(new MigrateDatabaseToLatestVersion<DataAccessProvider, Configuration>()); var dataAccessClass = new DataAccessClass(); managerDataAccess = dataAccessClass; waiterDataAccess = dataAccessClass; clientDataAccess = dataAccessClass; dataWipe = dataAccessClass; }