private void FillGridView() { PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); txt_From.Text = TheStaffMaster.EmailID; //*******************************// //To Get emailAddress his/her supervisor List <StaffMaster> ReporttingEmployeeList = new List <StaffMaster>(); ReporttingEmployeeList = StaffMasterManagement.GetInstance.GetReportingEmployeesEmailAllByEmployee(TheStaffMaster.EmployeeID); foreach (StaffMaster emp in ReporttingEmployeeList) { string email = emp.EmailID; txt_To.Text = email; } List <LeaveTypeSettings> LeaveBalanceList; LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheStaffMaster.EmployeeID); gridview_LeaveApplyBalance.DataSource = LeaveBalanceList; gridview_LeaveApplyBalance.DataBind(); List <LeaveApplication> LeaveApplicationLists = new List <LeaveApplication>(); LeaveApplicationLists = LeaveApplicationManagement.GetEmployeeLeaveApplicationsAll(TheStaffMaster.EmployeeID); gridview_LeaveApplyBalanceShow.DataSource = LeaveApplicationLists; gridview_LeaveApplyBalanceShow.DataBind(); }
private void SendLeaveRequestMail(StaffMaster TheStaffMaster, LeaveApplication TheLeaveRequest) { try { string AppNamdAndVersion = Micro.WebApplication.App_MasterPages.Micro_Website.GetAppNameWithVersion(); string MailSubject = ReadXML.GetGeneralMessage("LEAVE_APPLICATION_MAIL_SUBJECT", false).Replace("#APP#", AppNamdAndVersion.ToUpper()); string MailBody = string.Format("YOUR FULL NAME : {0}<br/> EMPLOYEE CODE : {1} <br/> DEPARTMENT DESCRIPTION : {2} <br/> DESIGNATION DESCRIPTION : {3} <br/> LEAVE DESCRIPTION : {4} <br/> DATE FROM : {5} <br/> DATE TO : {6} <br/> REASON: <B>{7}</B>", TheStaffMaster.EmployeeName, TheStaffMaster.EmployeeCode, TheStaffMaster.DepartmentDescription, TheStaffMaster.DesignationDescription, TheLeaveRequest.LeaveTypeDescription, TheLeaveRequest.DateFrom.ToShortDateString(), TheLeaveRequest.DateTo.ToShortDateString(), txt_Reason.Text); MailMessage eMail = new MailMessage(); eMail.To.Add(new MailAddress(txt_To.Text)); eMail.Subject = MailSubject; eMail.Body = MailBody; string emailContent = GetHtmlTemplateCode(); lit_Message.Text = string.Format("<font color='#003500'>{0} to user '{1}' on his/her email address '{2}'</font>", Micro.Commons.SendMail.SendEmail(eMail, emailContent), TheStaffMaster.EmployeeName, TheStaffMaster.EmailID); } catch (Exception ex) { //string theFailureMessage = string.Concat(ReadXML.GetFailureMessage("PASSWORD_NOT_SEND"), " </br></br> Reason:", ex.Message.ToString()); lit_Message.Text = string.Format("<font color='#990000'>Failed to send an email to user '{0}' on his/her email address '{1}'.<br/><br/> Reason: '{2}'</font>", TheStaffMaster.EmployeeName, TheStaffMaster.EmailID, ex.Message.ToString()); } }
public static List <StaffMaster> GetReportingEmployeesEmailAllByEmployee(int EmployeeID) { try { DataTable EmployeeTable = new DataTable(); EmployeeTable = StaffMasterDataAccess.GetInstance.GetReportingEmployeesEmailAllByEmployee(EmployeeID); List <StaffMaster> EmployeeList = new List <StaffMaster>(); foreach (DataRow dr in EmployeeTable.Rows) { StaffMaster ObjStaffMaster = new StaffMaster(); ObjStaffMaster.EmployeeID = int.Parse(dr["EmployeeID"].ToString()); //ObjEmployee.EmployeeName = dr["EmployeeName"].ToString().Trim(); ObjStaffMaster.EmailID = dr["EmailID"].ToString().Trim(); ObjStaffMaster.ReportingToEmployeeID = int.Parse(dr["ReportingToEmployeeID"].ToString()); //ObjEmployee.ReportingToEmployeeName = dr["ReportingToEmployeeName"].ToString(); ObjStaffMaster = GetEmployeeDetailsByID(int.Parse(dr["EmployeeID"].ToString())); EmployeeList.Add(ObjStaffMaster); } return(EmployeeList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
private bool ValidateFormFieldsLeaveBalance() { bool ReturnValue = true; PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheStaffMaster.EmployeeID); var LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.TotalNumberOfLeavesElligibleToAvail).First(); int TotalLeaveBalance = LeaveBalance; LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.NumberOfConsecutiveDaysAllowed).First(); if (TotalLeaveBalance < int.Parse(txt_Count.Text)) { lbl_TheMessage.Text = ReadXML.GetFailureMessage("KO_INSUFFICIENT_LEAVEBALANCE"); ReturnValue = false; } else { ReturnValue = true; } return(ReturnValue); }
// insert staff master data public void insertStaffMaster(StaffMaster staff) { if (staff == null) { throw new ArgumentNullException("staff"); } _staffMasterRepository.Insert(staff); }
private int InsertRecord() { int ProcReturnValue = 0; LeaveApplication TheLeaveApplication = new LeaveApplication(); PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheStaffMaster.EmployeeID); var LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.TotalNumberOfLeavesElligibleToAvail).First(); int TotalLeaveBalance = LeaveBalance; LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.NumberOfConsecutiveDaysAllowed).First(); LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.LeaveTypeID).First(); int LeaveTypeID = LeaveBalance; if (txt_Count.Text == "") { txt_Count.Text = "0"; } TheLeaveApplication.EmployeeID = TheStaffMaster.EmployeeID; TheLeaveApplication.LeaveTypeID = LeaveTypeID; TheLeaveApplication.LeaveTypeDescription = ddl_LeaveDescription.SelectedItem.ToString(); TheLeaveApplication.DateApplied = DateTime.Today.Date; TheLeaveApplication.DateFrom = DateTime.Parse(txt_FromDate.Text); TheLeaveApplication.DateTo = DateTime.Parse(txt_Todate.Text); TheLeaveApplication.ApplicationReason = txt_Reason.Text; TheLeaveApplication.Status = "Pending"; ProcReturnValue = LeaveApplicationManagement.InsertLeaveApplication(TheLeaveApplication); if (ProcReturnValue > 0) { //========================================================= // SENDING THE LEAVE REQUEST MAIL TO THE SUPERVISOR //========================================================= SendLeaveRequestMail(TheStaffMaster, TheLeaveApplication); //========================================================== } return(ProcReturnValue); }
private bool ValidateFormFields() { PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); bool ReturnValue = true; ReturnValue = ValidateFormFieldsLeaveBalance(); if (ReturnValue) { ReturnValue = ValidDateRange(TheStaffMaster.EmployeeID, txt_FromDate.Text); } return(ReturnValue); }
public int DeleteEmployee(StaffMaster theStaffMaster) { int ReturnValue = 0; using (SqlCommand DeleteCommand = new SqlCommand()) { DeleteCommand.CommandType = CommandType.StoredProcedure; DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; DeleteCommand.Parameters.Add(GetParameter("@EmployeeID", SqlDbType.Int, theStaffMaster.EmployeeID)); DeleteCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); DeleteCommand.CommandText = "pHRM_Employees_Delete"; ExecuteStoredProcedure(DeleteCommand); ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString()); return(ReturnValue); } }
protected void lnkEdit_Click(object sender, EventArgs e) { PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); LinkButton TheLinkBtn = (LinkButton)sender; btn_Save.Text = MicroEnums.DataOperation.Update.GetStringValue(); btn_LeaveCancel.Visible = true; LeaveApplicationID = int.Parse(TheLinkBtn.CommandArgument); LeaveApplication LType = new LeaveApplication(); LType = LeaveApplicationManagement.GetLeaveApplicationByLeaveApplicationID(LeaveApplicationID); if (LType.Status != "Pending") { ddl_LeaveDescription.Text = LType.LeaveTypeDescription; ddl_LeaveDescription.Enabled = false; txt_FromDate.Text = LType.DateFrom.ToShortDateString(); txt_FromDate.Enabled = false; txt_Todate.Text = LType.DateTo.ToShortDateString(); txt_Todate.Enabled = false; txt_Reason.Text = LType.ApplicationReason; txt_Reason.Enabled = false; txt_Status.Text = LType.Status; txt_ApprovedBy.Text = LType.ApprovedByEmployeeName; txt_RemarksDetails.Text = LType.ApprovalOrRejectionReason; btn_Save.Visible = false; } else { ddl_LeaveDescription.Text = LType.LeaveTypeDescription; txt_FromDate.Text = LType.DateFrom.ToShortDateString(); txt_Todate.Text = LType.DateTo.ToShortDateString(); txt_Reason.Text = LType.ApplicationReason; txt_Status.Text = LType.Status; txt_ApprovedBy.Text = ""; txt_RemarksDetails.Text = ""; btn_Save.Visible = true; txt_Todate_TextChanged(sender, e); } }
private void BindDetailViewStaff(int staffId) { optCategory.Visible = false; if (PageVar.StaffMasterList == null) { PageVar.StaffMasterList = StaffMasterManagement.GetInstance.GetOfficeEmployeeList(); } StaffMaster theStaff = new StaffMaster(); theStaff = PageVar.StaffMasterList.Find(a => a.EmployeeID == staffId); lit_StaffDetails.Text = ""; if (theStaff == null) { lit_StaffDetails.Text = string.Format("NO SUCH RECORD AVAILABLE FOR: <span class='Name'>{0} </span>", staffId); return; } else { //optCategory.SelectedIndex = -1; lit_StaffDetails.Text = string.Format("Detail Information of the Staff:- <span class='Name'> {0} {1} - </span><span class='Desig'>{2}</span> <span class='dept'>({3})</span>", theStaff.Salutation, theStaff.EmployeeName, theStaff.DesignationDescription, theStaff.DepartmentDescription); } PropertyInfo[] propertiesStudent = theStaff.GetType().GetProperties(); StringBuilder sbStaffDetails = new StringBuilder("<ul id='StaffDetailsView' class='StaffDetails'>"); //Display Details //sbStaffDetails.Append(string.Format("<li class='FullRow'></li>", pi.Name, theVar, ctr)); int ctr = 0; foreach (PropertyInfo pi in propertiesStudent) { ctr++; if (ctr > 1) // don't print the first row, as it it is the Employee ID column { string theVar = string.Concat(pi.GetValue(theStaff, null), " "); sbStaffDetails.Append(string.Format("<li class='theName'>{2}. {0}</li><li class='theValue'>{1}</li>", pi.Name, theVar, ctr)); } } sbStaffDetails.Append("</ul>"); //studentDeails.InnerText = sbStaffDetails.ToString(); lit_StaffDetailsInfo.Text = sbStaffDetails.ToString(); }
private void DataBindDropDownList() { PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); List <LeaveTypeSettings> LeaveBalanceList; LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheStaffMaster.EmployeeID); gridview_LeaveApplyBalance.DataSource = LeaveBalanceList; gridview_LeaveApplyBalance.DataBind(); var LeaveTypeDescriptionList = from st in LeaveBalanceList select st.LeaveTypeDescription; ddl_LeaveDescription.DataSource = LeaveTypeDescriptionList; ddl_LeaveDescription.DataMember = "LeaveTypeDescription"; ddl_LeaveDescription.DataBind(); }
protected void lnkCancel_Click(object sender, EventArgs e) { PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheStaffMaster.EmployeeID); LinkButton TheLinkBtn = (LinkButton)sender; LeaveApplicationID = int.Parse(TheLinkBtn.CommandArgument); LeaveApplication LType = new LeaveApplication(); int ProcReturnValue = 0; LType = LeaveApplicationManagement.GetLeaveApplicationByLeaveApplicationID(LeaveApplicationID); if (LType.Status == "Pending") { LeaveApplication LeaveApplicationObject = new LeaveApplication(); LeaveApplicationObject.EmployeeID = TheStaffMaster.EmployeeID; LeaveApplicationObject.ApplicationReason = txt_Reason.Text; LeaveApplicationObject.Status = "Pending"; if (LeaveApplicationID > 0) { LeaveApplicationObject.LeaveApplicationID = LeaveApplicationID; ProcReturnValue = LeaveApplicationManagement.DeletetLeaveApplication(LeaveApplicationObject); lbl_TheMessage.Text = ReadXML.GetSuccessMessage("OK_LEAVEAPPLICATION_DELETED"); dialog_Message.Show(); // ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", "alert('Leave Application Deleted Successfully');", true); btn_LeaveCancel.Visible = false; FillGridView(); } } else { lbl_TheMessage.Text = ReadXML.GetSuccessMessage("KO_LEAVEAPPLICATION_DELETED"); dialog_Message.Show(); // ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", "alert('Leave Application n't Cancelled Due to Approved/Cancelled');", true); } }
public static List <StaffMaster> GetEmployeeDetailsByFieldForce(string OfficeIDs, string DateFrom, string DateTo, string ApprovalStatus) { List <StaffMaster> GetEmployeeList = new List <StaffMaster>(); DataTable GetFieldForceChain = new DataTable(); GetFieldForceChain = StaffMasterDataAccess.GetInstance.GetEmployeeDetailsByFieldForce(OfficeIDs, DateFrom, DateTo, ApprovalStatus); foreach (DataRow dr in GetFieldForceChain.Rows) { StaffMaster TheStaffMaster = new StaffMaster(); TheStaffMaster.EmployeeID = int.Parse(dr["EmployeeID"].ToString()); TheStaffMaster.EmployeeCode = dr["EmployeeCode"].ToString(); TheStaffMaster.EmployeeName = dr["EmployeeName"].ToString(); TheStaffMaster.DepartmentDescription = dr["DepartmentDescription"].ToString(); TheStaffMaster.DesignationDescription = dr["DesignationDescription"].ToString(); GetEmployeeList.Add(TheStaffMaster); } return(GetEmployeeList); }
private int UpdateRecord() { int ProcReturnValue = 0; LeaveApplication TheLeaveApplication = new LeaveApplication(); PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheStaffMaster.EmployeeID); var LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.TotalNumberOfLeavesElligibleToAvail).First(); LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.NumberOfConsecutiveDaysAllowed).First(); LeaveBalance = (from st in LeaveBalanceList where st.LeaveTypeDescription == ddl_LeaveDescription.Text select st.LeaveTypeID).First(); int LeaveTypeID = LeaveBalance; TheLeaveApplication.LeaveApplicationID = LeaveApplicationID; TheLeaveApplication.LeaveTypeID = LeaveTypeID; TheLeaveApplication.LeaveTypeDescription = ddl_LeaveDescription.SelectedItem.ToString(); TheLeaveApplication.DateApplied = DateTime.Today.Date; TheLeaveApplication.DateFrom = DateTime.Parse(txt_FromDate.Text); TheLeaveApplication.DateTo = DateTime.Parse(txt_Todate.Text); TheLeaveApplication.ApplicationReason = txt_Reason.Text; TheLeaveApplication.Status = "Pending"; ProcReturnValue = LeaveApplicationManagement.UpdateLeaveApplication(TheLeaveApplication); return(ProcReturnValue); }
public static List <StaffMaster> GetDuplicateEmployeeList(string employeeName, string fatherName, string dateofBirth, bool allOffices = false, bool showDeleted = false) { List <StaffMaster> TheEmployeeList = GetEmployeeList(); List <StaffMaster> TheDuplicateEmployeeList = new List <StaffMaster>(); if (TheEmployeeList.Count > 0) { var DuplicateEmployeeList = (from EmployeeList in TheEmployeeList where EmployeeList.EmployeeName.ToUpper() == employeeName.ToUpper() && EmployeeList.FatherName.ToUpper() == fatherName.ToUpper() && EmployeeList.DateOfBirth.ToUpper() == dateofBirth.ToUpper() select EmployeeList).ToList(); foreach (StaffMaster EachEmployee in DuplicateEmployeeList) { StaffMaster TheEmployee = (StaffMaster)EachEmployee; TheDuplicateEmployeeList.Add(TheEmployee); } } return(TheDuplicateEmployeeList); }
public int UpdateEmployeeContactInfo(StaffMaster theStaffMaster) { try { int ReturnValue = 0; SqlCommand UpdateCommand = new SqlCommand(); UpdateCommand.CommandType = CommandType.StoredProcedure; UpdateCommand.Parameters.Add(GetParameter("ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; UpdateCommand.Parameters.Add(GetParameter("EmployeeID", SqlDbType.Int, theStaffMaster.EmployeeID)); UpdateCommand.Parameters.Add(GetParameter("PhoneNumber", SqlDbType.VarChar, theStaffMaster.PhoneNumber)); UpdateCommand.Parameters.Add(GetParameter("Mobile", SqlDbType.VarChar, theStaffMaster.Mobile)); UpdateCommand.Parameters.Add(GetParameter("EmailID", SqlDbType.VarChar, theStaffMaster.EmailID)); UpdateCommand.Parameters.Add(GetParameter("PersonalEMailID", SqlDbType.VarChar, theStaffMaster.PersonalEMailID)); UpdateCommand.Parameters.Add(GetParameter("EmergencyContactNumber", SqlDbType.VarChar, theStaffMaster.EmergencyContactNumber)); UpdateCommand.Parameters.Add(GetParameter("IsActive", SqlDbType.Int, theStaffMaster.IsActive)); UpdateCommand.Parameters.Add(GetParameter("ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); UpdateCommand.CommandText = "pHRM_Employees_Update_ContactInfo"; ExecuteStoredProcedure(UpdateCommand); ReturnValue = int.Parse(UpdateCommand.Parameters[0].Value.ToString()); return(ReturnValue); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public int UpdateEmployeeContactInfo(StaffMaster theStaffMaster) { return(StaffMasterIntegration.UpdateEmployeeContactInfo(theStaffMaster)); }
public static StaffMaster GetEmployeeByEmployeeCode(string employeeCode) { try { DataRow EmployeeRow = StaffMasterDataAccess.GetInstance.GetEmployeeByEmployeeCode(employeeCode); StaffMaster ObjEmployee = new StaffMaster(); if (EmployeeRow != null) { ObjEmployee.EmployeeID = int.Parse(EmployeeRow["EmployeeID"].ToString()); ObjEmployee.EmployeeCode = EmployeeRow["EmployeeCode"].ToString(); ObjEmployee.Salutation = EmployeeRow["Salutation"].ToString().Trim(); ObjEmployee.EmployeeName = EmployeeRow["EmployeeName"].ToString().Trim(); string eName = ObjEmployee.EmployeeName; ObjEmployee.EmployeeFirstName = (eName.Contains(" ") == true ? eName.Substring(0, eName.IndexOf(" ")) : eName); ObjEmployee.EmployeeLastName = (eName.Contains(" ") == true ? eName.Substring(eName.IndexOf(" "), eName.Length - eName.IndexOf(" ")) : eName); ObjEmployee.FatherName = EmployeeRow["FatherName"].ToString(); ObjEmployee.SpouseName = EmployeeRow["SpouseName"].ToString(); if (EmployeeRow["DateOfBirth"].ToString() + "" != "") { ObjEmployee.DateOfBirth = DateTime.Parse(EmployeeRow["DateOfBirth"].ToString()).ToString(MicroConstants.DateFormat); } ObjEmployee.Gender = EmployeeRow["Gender"].ToString(); ObjEmployee.BloodGroup = EmployeeRow["BloodGroup"].ToString(); ObjEmployee.Religion = EmployeeRow["Religion"].ToString(); ObjEmployee.Nationality = EmployeeRow["Nationality"].ToString(); ObjEmployee.MaritalStatus = EmployeeRow["MaritalStatus"].ToString(); ; ObjEmployee.KnownAilments = EmployeeRow["KnownAilments"].ToString(); ObjEmployee.IdentificationMark = EmployeeRow["IdentificationMark"].ToString(); ObjEmployee.Address_Present_TownOrCity = EmployeeRow["Address_Present_TownOrCity"].ToString(); ObjEmployee.Address_Present_LandMark = EmployeeRow["Address_Present_LandMark"].ToString(); if (EmployeeRow["Address_Present_DistrictID"].ToString() != "") { ObjEmployee.Address_Present_DistrictID = int.Parse(EmployeeRow["Address_Present_DistrictID"].ToString()); ObjEmployee.Address_Present_DistrictName = EmployeeRow["Address_Present_DistrictName"].ToString(); } ObjEmployee.Address_Present_Pincode = EmployeeRow["Address_Present_Pincode"].ToString(); ; ObjEmployee.Address_Permanent_TownOrCity = EmployeeRow["Address_Permanent_TownOrCity"].ToString(); ObjEmployee.Address_Permanent_LandMark = EmployeeRow["Address_Permanent_LandMark"].ToString(); if (EmployeeRow["Address_Permanent_DistrictID"].ToString() != "") { ObjEmployee.Address_Permanent_DistrictID = int.Parse(EmployeeRow["Address_Permanent_DistrictID"].ToString()); ObjEmployee.Address_Permanent_DistrictName = EmployeeRow["Address_Permanent_DistrictName"].ToString(); } ObjEmployee.Address_Permanent_Pincode = EmployeeRow["Address_Permanent_Pincode"].ToString(); ; ObjEmployee.PhoneNumber = EmployeeRow["PhoneNumber"].ToString(); ; ObjEmployee.Mobile = EmployeeRow["Mobile"].ToString(); ObjEmployee.EmailID = EmployeeRow["EmailID"].ToString(); ObjEmployee.PersonalEMailID = EmployeeRow["PersonalEMailID"].ToString(); ObjEmployee.EmergencyContactNumber = EmployeeRow["EmergencyContactNumber"].ToString(); ObjEmployee.ReferenceName = EmployeeRow["ReferenceName"].ToString(); ObjEmployee.ReferencePhone = EmployeeRow["ReferencePhone"].ToString(); ObjEmployee.ReferenceMobile = EmployeeRow["ReferenceMobile"].ToString(); ObjEmployee.IsMatriculate = (EmployeeRow["IsMatriculate"].ToString() == "True" ? 1 : 0); ObjEmployee.LastQualification = EmployeeRow["LastQualification"].ToString(); ; ObjEmployee.YearOfPassing = int.Parse(EmployeeRow["YearOfPassing"].ToString()); ObjEmployee.Institution = EmployeeRow["Institution"].ToString(); ; ObjEmployee.BoardOrUniversity = EmployeeRow["BoardOrUniversity"].ToString(); ObjEmployee.ProfessionalQualification = EmployeeRow["ProfessionalQualification"].ToString(); ObjEmployee.ProfessionalInstitution = EmployeeRow["ProfessionalInstitution"].ToString(); if (EmployeeRow["JoiningDate"].ToString() + "" != "") { ObjEmployee.PostingDate = DateTime.Parse(EmployeeRow["JoiningDate"].ToString()); ; } ObjEmployee.DepartmentID = int.Parse(EmployeeRow["DepartmentID"].ToString()); ObjEmployee.DepartmentDescription = EmployeeRow["DepartmentDescription"].ToString(); ObjEmployee.DesignationID = int.Parse(EmployeeRow["DesignationID"].ToString()); ObjEmployee.DesignationDescription = EmployeeRow["DesignationDescription"].ToString(); ObjEmployee.OfficeID = (string.IsNullOrEmpty(EmployeeRow["OfficeId"].ToString()) ? 0 : int.Parse(EmployeeRow["OfficeId"].ToString())); ObjEmployee.OfficeName = EmployeeRow["OfficeName"].ToString(); ObjEmployee.ReferenceLetterNumber = EmployeeRow["ReferenceLetterNumber"].ToString(); ObjEmployee.ServiceStatus = EmployeeRow["ServiceStatus"].ToString(); ObjEmployee.ServiceType = EmployeeRow["ServiceType"].ToString(); ObjEmployee.Remarks = EmployeeRow["Remarks"].ToString(); ObjEmployee.BioDeviceEmployeeID = EmployeeRow["BioDeviceEmployeeID"].ToString(); ObjEmployee.EmployeeServiceDetailsID = (EmployeeRow["EmployeeServiceDetailsID"].ToString() + "" != "" ? int.Parse(EmployeeRow["EmployeeServiceDetailsID"].ToString()) : -1); if (EmployeeRow["EmployeePhoto"].ToString() != "") { ObjEmployee.Picture = (byte[])EmployeeRow["EmployeePhoto"]; } if (EmployeeRow["EmployeeSignature"].ToString() != "") { ObjEmployee.Signature = (byte[])EmployeeRow["EmployeeSignature"]; } ObjEmployee.ModifiedBy = (EmployeeRow["ModifiedBy"].ToString() + "" != "" ? int.Parse(EmployeeRow["ModifiedBy"].ToString()) : -1); if (EmployeeRow["DateModified"].ToString() + "" != "") { ObjEmployee.DateOfModify = DateTime.Parse(EmployeeRow["DateModified"].ToString()); } ObjEmployee.AddedBy = (EmployeeRow["AddedBy"].ToString() + "" != "" ? int.Parse(EmployeeRow["AddedBy"].ToString()) : -1); if (EmployeeRow["AddedBy"].ToString() + "" == "") { ObjEmployee.DateOfCreate = DateTime.Parse(EmployeeRow["AddedBy"].ToString()); } if (EmployeeRow["ReportingToEmployeeID"].ToString() != "") { ObjEmployee.ReportingToEmployeeID = int.Parse(EmployeeRow["ReportingToEmployeeID"].ToString()); if (EmployeeRow["ReportingToEffectiveDateFrom"].ToString() != "") { ObjEmployee.ReportingToEffectiveDateFrom = EmployeeRow["ReportingToEffectiveDateFrom"].ToString(); } } else { ObjEmployee.ReportingToEmployeeID = -1; } ObjEmployee.UserID = int.Parse(EmployeeRow["UserID"].ToString()); ObjEmployee.UserName = ""; } else { ObjEmployee = null; } return(ObjEmployee); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public static int DeleteEmployee(StaffMaster theStaffMaster) { return(StaffMasterDataAccess.GetInstance.DeleteEmployee(theStaffMaster)); }
public static StaffMaster GetEmployeeDetailsByID(int EmployeeID) { try { DataRow DtRow = StaffMasterDataAccess.GetInstance.GetEmployeeDetailsByEmployeeID(EmployeeID); StaffMaster ObjEmployee = new StaffMaster(); ObjEmployee.EmployeeID = int.Parse(DtRow["EmployeeID"].ToString()); ObjEmployee.EmployeeCode = DtRow["EmployeeCode"].ToString(); ObjEmployee.Salutation = DtRow["Salutation"].ToString().Trim(); ObjEmployee.EmployeeName = DtRow["EmployeeName"].ToString().Trim(); string eName = ObjEmployee.EmployeeName; ObjEmployee.EmployeeFirstName = (eName.Contains(" ") == true ? eName.Substring(0, eName.IndexOf(" ")) : eName); ObjEmployee.EmployeeLastName = (eName.Contains(" ") == true ? eName.Substring(eName.IndexOf(" "), eName.Length - eName.IndexOf(" ")) : eName); ObjEmployee.FatherName = DtRow["FatherName"].ToString(); ObjEmployee.SpouseName = DtRow["SpouseName"].ToString(); if (DtRow["DateOfBirth"].ToString() + "" != "") { ObjEmployee.DateOfBirth = DateTime.Parse(DtRow["DateOfBirth"].ToString()).ToString(MicroConstants.DateFormat); } ObjEmployee.Gender = DtRow["Gender"].ToString(); ObjEmployee.BloodGroup = DtRow["BloodGroup"].ToString(); ObjEmployee.Religion = DtRow["Religion"].ToString(); ObjEmployee.Nationality = DtRow["Nationality"].ToString(); ObjEmployee.MaritalStatus = DtRow["MaritalStatus"].ToString(); ObjEmployee.KnownAilments = DtRow["KnownAilments"].ToString(); ObjEmployee.IdentificationMark = DtRow["IdentificationMark"].ToString(); ObjEmployee.Address_Present_TownOrCity = DtRow["Address_Present_TownOrCity"].ToString(); ObjEmployee.Address_Present_LandMark = DtRow["Address_Present_LandMark"].ToString(); if (DtRow["Address_Present_DistrictID"].ToString() != "") { ObjEmployee.Address_Present_DistrictID = int.Parse(DtRow["Address_Present_DistrictID"].ToString()); ObjEmployee.Address_Present_DistrictName = DtRow["Address_Present_DistrictName"].ToString(); } ObjEmployee.Address_Present_StateName = DtRow["Address_Present_StateName"].ToString(); ObjEmployee.Address_Present_CountryName = DtRow["Address_Present_CountryName"].ToString(); ObjEmployee.Address_Present_Pincode = DtRow["Address_Present_Pincode"].ToString(); ObjEmployee.Address_Permanent_TownOrCity = DtRow["Address_Permanent_TownOrCity"].ToString(); ObjEmployee.Address_Permanent_LandMark = DtRow["Address_Permanent_LandMark"].ToString(); if (DtRow["Address_Permanent_DistrictID"].ToString() != "") { ObjEmployee.Address_Permanent_DistrictID = int.Parse(DtRow["Address_Permanent_DistrictID"].ToString()); ObjEmployee.Address_Permanent_DistrictName = DtRow["Address_Permanent_DistrictName"].ToString(); } ObjEmployee.Address_Permanent_StateName = DtRow["Address_Permanent_StateName"].ToString(); ObjEmployee.Address_Permanent_CountryName = DtRow["Address_Permanent_CountryName"].ToString(); ObjEmployee.Address_Permanent_Pincode = DtRow["Address_Permanent_Pincode"].ToString(); ObjEmployee.PhoneNumber = DtRow["PhoneNumber"].ToString(); ObjEmployee.Mobile = DtRow["Mobile"].ToString(); //ObjEmployee.EmergencyContactNumber = DtRow["EmergencyContactNumber"].ToString(); ObjEmployee.EmailID = DtRow["EmailID"].ToString(); ObjEmployee.PersonalEMailID = DtRow["Refmail"].ToString(); ObjEmployee.ReferenceName = DtRow["ReferenceName"].ToString(); ObjEmployee.ReferenceMobile = DtRow["ReferenceMobile"].ToString(); ObjEmployee.ReferencePhone = DtRow["ReferencePhone"].ToString(); ObjEmployee.PHStatus = DtRow["PHStatus"].ToString(); ObjEmployee.EPAndGPFAcNo = DtRow["EPAndGPFAcNo"].ToString(); ObjEmployee.PanNo = DtRow["PanNo"].ToString(); ObjEmployee.SbiAccountNo = DtRow["SbiAccountNo"].ToString(); ObjEmployee.ScaleOfPay = DtRow["ScaleOfPay"].ToString(); ObjEmployee.GpOrAGP = DtRow["GpOrAGP"].ToString(); if (DtRow["DateOfNextIncrement"].ToString() + "" != "") { ObjEmployee.DateOfNextIncrement = DateTime.Parse(DtRow["DateOfNextIncrement"].ToString()).ToString(MicroConstants.DateFormat); } ObjEmployee.ChseRegdNo = DtRow["ChseRegdNo"].ToString(); ObjEmployee.UnivRegdNo = DtRow["UnivRegdNo"].ToString(); if (DtRow["JoiningDateInOffice"].ToString() + "" != "") { ObjEmployee.JoiningDateInOffice = DateTime.Parse(DtRow["JoiningDateInOffice"].ToString()).ToString(MicroConstants.DateFormat); } if (DtRow["JoiningDateInService"].ToString() + "" != "") { ObjEmployee.JoiningDateInService = DateTime.Parse(DtRow["JoiningDateInService"].ToString()).ToString(MicroConstants.DateFormat); } ObjEmployee.Employeetype1 = DtRow["Employeetype1"].ToString(); ObjEmployee.Employeetype2 = DtRow["Employeetype2"].ToString(); ObjEmployee.Employeetype3 = DtRow["Employeetype3"].ToString(); ObjEmployee.Employeetype4 = DtRow["Employeetype4"].ToString(); if (DtRow["ServiceStatusLastWorkingDate"].ToString() + "" != "") { ObjEmployee.ServiceStatusLastWorkingDate = DateTime.Parse(DtRow["ServiceStatusLastWorkingDate"].ToString()).ToString(MicroConstants.DateFormat); } if (DtRow["ServiceStatusChangeRequestDate"].ToString() + "" != "") { ObjEmployee.ServiceStatusChangeRequestDate = DateTime.Parse(DtRow["ServiceStatusChangeRequestDate"].ToString()).ToString(MicroConstants.DateFormat); } if ((DtRow["DepartmentID"] != null)) { if (!string.IsNullOrEmpty(DtRow["DepartmentID"].ToString())) { ObjEmployee.DepartmentID = int.Parse(DtRow["DepartmentID"].ToString()); } else { ObjEmployee.DepartmentID = -1; } } ObjEmployee.DepartmentDescription = DtRow["DepartmentDescription"].ToString(); if ((DtRow["DesignationID"] != null)) { if (!string.IsNullOrEmpty(DtRow["DesignationID"].ToString())) { ObjEmployee.DesignationID = int.Parse(DtRow["DesignationID"].ToString()); } else { ObjEmployee.DesignationID = -1; } } ObjEmployee.DesignationDescription = DtRow["DesignationDescription"].ToString(); ObjEmployee.OfficeID = (string.IsNullOrEmpty(DtRow["OfficeId"].ToString()) ? 0 : int.Parse(DtRow["OfficeId"].ToString())); ObjEmployee.OfficeName = DtRow["OfficeName"].ToString(); // ObjEmployee.ReferenceLetterNumber = DtRow["ReferenceLetterNumber"].ToString(); // ObjEmployee.ServiceStatus = DtRow["ServiceStatus"].ToString(); // ObjEmployee.ServiceType = DtRow["ServiceType"].ToString(); // ObjEmployee.Remarks = DtRow["Remarks"].ToString(); ObjEmployee.BioDeviceEmployeeID = DtRow["BioDeviceEmployeeID"].ToString(); ObjEmployee.EmployeeServiceDetailsID = (DtRow["EmployeeServiceDetailsID"].ToString() + "" != "" ? int.Parse(DtRow["EmployeeServiceDetailsID"].ToString()) : -1); if (DtRow["EmployeePhoto"].ToString() != "") { ObjEmployee.Picture = (byte[])DtRow["EmployeePhoto"]; } if (DtRow["EmployeeSignature"].ToString() != "") { ObjEmployee.Signature = (byte[])DtRow["EmployeeSignature"]; } ObjEmployee.ModifiedBy = (DtRow["ModifiedBy"].ToString() + "" != "" ? int.Parse(DtRow["ModifiedBy"].ToString()) : -1); if (DtRow["DateModified"].ToString() + "" != "") { ObjEmployee.DateOfModify = DateTime.Parse(DtRow["DateModified"].ToString()); } ObjEmployee.AddedBy = (DtRow["AddedBy"].ToString() + "" != "" ? int.Parse(DtRow["AddedBy"].ToString()) : -1); if (DtRow["DateAdded"].ToString() != "") { ObjEmployee.DateOfCreate = DateTime.Parse(DtRow["DateAdded"].ToString()); } if (DtRow["ReportingToEmployeeID"].ToString() != "") { ObjEmployee.ReportingToEmployeeID = int.Parse(DtRow["ReportingToEmployeeID"].ToString()); if (DtRow["ReportingToEffectiveDateFrom"].ToString() != "") { ObjEmployee.ReportingToEffectiveDateFrom = DtRow["ReportingToEffectiveDateFrom"].ToString() == "" ? "" : DateTime.Parse(DtRow["ReportingToEffectiveDateFrom"].ToString()).ToString(MicroConstants.DateFormat); } } else { ObjEmployee.ReportingToEmployeeID = -1; } ObjEmployee.UserID = int.Parse(DtRow["UserID"].ToString()); ObjEmployee.UserName = ""; return(ObjEmployee); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public static int UpdateEmployeeContactInfo(StaffMaster theStaffMaster) { return(StaffMasterDataAccess.GetInstance.UpdateEmployeeContactInfo(theStaffMaster)); }
public static int UpdateEmployee(StaffMaster theStaffMaster, string CourseIDs, string Boards, string PassingYears, string Divisions, string PercentageMarks) { return(StaffMasterDataAccess.GetInstance.UpdateEmployee(theStaffMaster, CourseIDs, Boards, PassingYears, Divisions, PercentageMarks)); }
public int InsertEmployee(StaffMaster theStaffMaster, string CourseIDs, string Boards, string PassingYears, string Divisions, string PercentageMarks) { try { int ReturnValue = 0; SqlCommand InsertCommand = new SqlCommand(); InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; InsertCommand.Parameters.Add(GetParameter("@ReturnValueEmp", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; //InsertCommand.Parameters.Add(GetParameter("@EmployeeCode", SqlDbType.VarChar, theEmployee.EmployeeCode)); InsertCommand.Parameters.Add(GetParameter("@Salutation", SqlDbType.VarChar, theStaffMaster.Salutation)); InsertCommand.Parameters.Add(GetParameter("@EmployeeName", SqlDbType.VarChar, theStaffMaster.EmployeeName)); InsertCommand.Parameters.Add(GetParameter("@FatherName", SqlDbType.VarChar, theStaffMaster.FatherName)); InsertCommand.Parameters.Add(GetParameter("@SpouseName", SqlDbType.VarChar, theStaffMaster.SpouseName)); InsertCommand.Parameters.Add(GetParameter("@DateOfBirth", SqlDbType.VarChar, theStaffMaster.DateOfBirth == string.Empty?Convert.DBNull:theStaffMaster.DateOfBirth)); InsertCommand.Parameters.Add(GetParameter("@Gender", SqlDbType.VarChar, theStaffMaster.Gender)); InsertCommand.Parameters.Add(GetParameter("@BloodGroup", SqlDbType.VarChar, theStaffMaster.BloodGroup)); InsertCommand.Parameters.Add(GetParameter("@Religion", SqlDbType.VarChar, theStaffMaster.Religion)); InsertCommand.Parameters.Add(GetParameter("@Nationality", SqlDbType.VarChar, theStaffMaster.Nationality)); InsertCommand.Parameters.Add(GetParameter("@MaritalStatus", SqlDbType.VarChar, theStaffMaster.MaritalStatus)); InsertCommand.Parameters.Add(GetParameter("@KnownAilments", SqlDbType.VarChar, theStaffMaster.KnownAilments)); InsertCommand.Parameters.Add(GetParameter("@IdentificationMark", SqlDbType.VarChar, theStaffMaster.IdentificationMark)); InsertCommand.Parameters.Add(GetParameter("@Address_Present_TownOrCity", SqlDbType.VarChar, theStaffMaster.Address_Present_TownOrCity)); InsertCommand.Parameters.Add(GetParameter("@Address_Present_Landmark", SqlDbType.VarChar, theStaffMaster.Address_Present_LandMark)); InsertCommand.Parameters.Add(GetParameter("@Address_Present_DistrictID", SqlDbType.Int, theStaffMaster.Address_Present_DistrictID)); InsertCommand.Parameters.Add(GetParameter("@Address_Present_PinCode", SqlDbType.VarChar, theStaffMaster.Address_Present_Pincode)); InsertCommand.Parameters.Add(GetParameter("@Address_Permanent_TownOrCity", SqlDbType.VarChar, theStaffMaster.Address_Permanent_TownOrCity)); InsertCommand.Parameters.Add(GetParameter("@Address_Permanent_Landmark", SqlDbType.VarChar, theStaffMaster.Address_Permanent_LandMark)); InsertCommand.Parameters.Add(GetParameter("@Address_Permanent_DistrictID", SqlDbType.Int, theStaffMaster.Address_Permanent_DistrictID)); InsertCommand.Parameters.Add(GetParameter("@Address_Permanent_PinCode", SqlDbType.VarChar, theStaffMaster.Address_Permanent_Pincode)); InsertCommand.Parameters.Add(GetParameter("@PhoneNumber", SqlDbType.VarChar, theStaffMaster.PhoneNumber)); InsertCommand.Parameters.Add(GetParameter("@Mobile", SqlDbType.VarChar, theStaffMaster.Mobile)); InsertCommand.Parameters.Add(GetParameter("@EMailID", SqlDbType.VarChar, theStaffMaster.EmailID)); InsertCommand.Parameters.Add(GetParameter("@PHStatus", SqlDbType.VarChar, theStaffMaster.PHStatus)); InsertCommand.Parameters.Add(GetParameter("@EPAndGPFAcNo", SqlDbType.VarChar, theStaffMaster.EPAndGPFAcNo)); InsertCommand.Parameters.Add(GetParameter("@Refmail", SqlDbType.VarChar, theStaffMaster.PersonalEMailID)); InsertCommand.Parameters.Add(GetParameter("@ReferenceMobile", SqlDbType.VarChar, theStaffMaster.ReferenceMobile)); InsertCommand.Parameters.Add(GetParameter("@ReferenceName", SqlDbType.VarChar, theStaffMaster.ReferenceName)); InsertCommand.Parameters.Add(GetParameter("@ReferencePhone", SqlDbType.VarChar, theStaffMaster.ReferencePhone)); InsertCommand.Parameters.Add(GetParameter("@PanNo", SqlDbType.VarChar, theStaffMaster.PanNo)); InsertCommand.Parameters.Add(GetParameter("@SbiAccountNo", SqlDbType.VarChar, theStaffMaster.SbiAccountNo)); InsertCommand.Parameters.Add(GetParameter("@ScaleOfPay", SqlDbType.VarChar, theStaffMaster.ScaleOfPay)); InsertCommand.Parameters.Add(GetParameter("@GpOrAGP", SqlDbType.VarChar, theStaffMaster.GpOrAGP)); InsertCommand.Parameters.Add(GetParameter("@DateOfNextIncrement", SqlDbType.DateTime, theStaffMaster.DateOfNextIncrement == string.Empty ? Convert.DBNull : theStaffMaster.DateOfNextIncrement)); InsertCommand.Parameters.Add(GetParameter("@ChseRegdNo", SqlDbType.VarChar, theStaffMaster.ChseRegdNo)); InsertCommand.Parameters.Add(GetParameter("@UnivRegdNo", SqlDbType.VarChar, theStaffMaster.UnivRegdNo)); InsertCommand.Parameters.Add(GetParameter("@UserID", SqlDbType.Int, theStaffMaster.UserID)); InsertCommand.Parameters.Add(GetParameter("@DepartmentID", SqlDbType.Int, theStaffMaster.DepartmentID)); InsertCommand.Parameters.Add(GetParameter("@DesignationID", SqlDbType.Int, theStaffMaster.DesignationID)); InsertCommand.Parameters.Add(GetParameter("@OfficeID", SqlDbType.Int, theStaffMaster.OfficeID)); ////////New/////////// InsertCommand.Parameters.Add(GetParameter("@JoiningDateInOffice", SqlDbType.DateTime, theStaffMaster.JoiningDateInOffice == string.Empty ? Convert.DBNull : theStaffMaster.JoiningDateInOffice)); InsertCommand.Parameters.Add(GetParameter("@JoiningDateInService", SqlDbType.DateTime, theStaffMaster.JoiningDateInService == string.Empty ? Convert.DBNull : theStaffMaster.JoiningDateInService)); InsertCommand.Parameters.Add(GetParameter("@Employeetype1", SqlDbType.VarChar, theStaffMaster.Employeetype1)); InsertCommand.Parameters.Add(GetParameter("@Employeetype2", SqlDbType.VarChar, theStaffMaster.Employeetype2)); InsertCommand.Parameters.Add(GetParameter("@Employeetype3", SqlDbType.VarChar, theStaffMaster.Employeetype3)); InsertCommand.Parameters.Add(GetParameter("@Employeetype4", SqlDbType.VarChar, theStaffMaster.Employeetype4)); InsertCommand.Parameters.Add(GetParameter("@ServiceStatusChangeRequestDate", SqlDbType.DateTime, theStaffMaster.ServiceStatusChangeRequestDate == string.Empty ? Convert.DBNull : theStaffMaster.ServiceStatusChangeRequestDate)); InsertCommand.Parameters.Add(GetParameter("@ServiceStatusLastWorkingDate", SqlDbType.DateTime, theStaffMaster.ServiceStatusLastWorkingDate == string.Empty ? Convert.DBNull : theStaffMaster.ServiceStatusLastWorkingDate)); InsertCommand.Parameters.Add(GetParameter("@CourseIDs", SqlDbType.VarChar, CourseIDs)); InsertCommand.Parameters.Add(GetParameter("@PassingYears", SqlDbType.VarChar, PassingYears)); InsertCommand.Parameters.Add(GetParameter("@Boards", SqlDbType.VarChar, Boards)); InsertCommand.Parameters.Add(GetParameter("@Divisions", SqlDbType.VarChar, Divisions)); InsertCommand.Parameters.Add(GetParameter("@PercentageMarks", SqlDbType.VarChar, PercentageMarks)); ////////////////// //InsertCommand.Parameters.Add(GetParameter("@ReferenceName", SqlDbType.VarChar, theStaffMaster.ReferenceName)); //InsertCommand.Parameters.Add(GetParameter("@ReferencePhone", SqlDbType.VarChar, theStaffMaster.ReferencePhone)); //InsertCommand.Parameters.Add(GetParameter("@ReferenceMobile", SqlDbType.VarChar, theStaffMaster.ReferenceMobile)); InsertCommand.Parameters.Add(GetParameter("@BioDeviceEmployeeID", SqlDbType.VarChar, theStaffMaster.BioDeviceEmployeeID)); if (theStaffMaster.Picture != null) { InsertCommand.Parameters.Add(GetParameter("@EmployeeImage", SqlDbType.VarBinary, theStaffMaster.Picture)); } if (theStaffMaster.Signature != null) { InsertCommand.Parameters.Add(GetParameter("@EmployeeSignature", SqlDbType.VarBinary, theStaffMaster.Signature)); } if (theStaffMaster.ReportingToEmployeeID > 0) { InsertCommand.Parameters.Add(GetParameter("@ReportingToEmployeeID", SqlDbType.Int, theStaffMaster.ReportingToEmployeeID)); InsertCommand.Parameters.Add(GetParameter("@ReportingToEffectiveDateFrom", SqlDbType.VarChar, theStaffMaster.ReportingToEffectiveDateFrom == string.Empty ? Convert.DBNull : theStaffMaster.ReportingToEffectiveDateFrom)); } //InsertCommand.Parameters.Add(GetParameter("@TeachingOrNonTeaching", SqlDbType.VarChar, theStaffMaster.TeachingOrNonTeaching)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); InsertCommand.CommandText = "pHRM_Employees_Insert"; ExecuteStoredProcedure(InsertCommand); return(int.Parse(InsertCommand.Parameters[0].Value.ToString())); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public int DeleteEmployee(StaffMaster theStaffMaster) { return(StaffMasterIntegration.DeleteEmployee(theStaffMaster)); }
public int UpdateEmployee(StaffMaster theStaffMaster, string CourseIDs, string Boards, string PassingYears, string Divisions, string PercentageMarks) { return(StaffMasterIntegration.UpdateEmployee(theStaffMaster, CourseIDs, Boards, PassingYears, Divisions, PercentageMarks)); }
protected void Page_Load(object sender, EventArgs e) { PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID; StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID); PageVariables.AttendanceList = AttendanceManagement.GetInstance.GetEmployeeDetailsAttendanceRegister(TheStaffMaster.EmployeeID, (ddl_SelectMonth.Text != "" ? ddl_SelectMonth.SelectedIndex : DateTime.Today.Month), (ddl_SelectYear.Text != "" ? int.Parse(ddl_SelectYear.Text) : DateTime.Today.Year)); gridview_AttendanceRegisterEmployee.DataSource = PageVariables.AttendanceList; gridview_AttendanceRegisterEmployee.DataBind(); int counter = 0; if (PageVariables.AttendanceList.Count > 0) { //foreach (Attendance theAttendance in PageVariables.AttendanceList) //{ counter++; // GridViewRow therow in gview_DesignationSelect.Rows foreach (GridViewRow therow in gridview_AttendanceRegisterEmployee.Rows) { bool IsPresent = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsPresent"]; bool IsAbsent = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsAbsent"]; bool IsWeeklyOff = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsWeeklyOff"]; bool IsPresentOnWeeklyOff = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsPresentOnWeeklyOff"]; bool IsHoliday = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsHoliday"]; bool IsPresentOnHoliday = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsPresentOnHoliday"]; bool IsLeave = (bool)gridview_AttendanceRegisterEmployee.DataKeys[therow.RowIndex].Values["IsLeave"]; CheckBox theCheckBox_IsPresent = (CheckBox)therow.FindControl("chk_Present"); CheckBox theCheckBox_IsAbsent = (CheckBox)therow.FindControl("chk_Absent"); CheckBox theCheckBox_IsWeeklyOff = (CheckBox)therow.FindControl("chk_IsWeeklyOff"); CheckBox theCheckBox_IsPresentOnWeeklyOff = (CheckBox)therow.FindControl("chk_IsPresentOnWeeklyOff"); CheckBox theCheckBox_IsHoliday = (CheckBox)therow.FindControl("chk_IsHoliday"); CheckBox theCheckBox_IsPresentOnHoliday = (CheckBox)therow.FindControl("chk_IsPresentOnHoliday"); CheckBox theCheckBox_IsLeave = (CheckBox)therow.FindControl("chk_IsLeave"); if (IsPresent) { theCheckBox_IsPresent.Checked = true; } else { theCheckBox_IsPresent.Checked = false; } if (IsAbsent) { theCheckBox_IsAbsent.Checked = true; } else { theCheckBox_IsAbsent.Checked = false; } if (IsWeeklyOff) { theCheckBox_IsWeeklyOff.Checked = true; } else { theCheckBox_IsWeeklyOff.Checked = false; } if (IsPresentOnWeeklyOff) { theCheckBox_IsPresentOnWeeklyOff.Checked = true; } else { theCheckBox_IsPresentOnWeeklyOff.Checked = false; } if (IsHoliday) { theCheckBox_IsHoliday.Checked = true; } else { theCheckBox_IsHoliday.Checked = false; } if (IsPresentOnHoliday) { theCheckBox_IsPresentOnHoliday.Checked = true; } else { theCheckBox_IsPresentOnHoliday.Checked = false; } if (IsLeave) { theCheckBox_IsLeave.Checked = true; } else { theCheckBox_IsLeave.Checked = false; } } } GridViewRow row = null; for (int i = 0; i < gridview_AttendanceRegisterEmployee.Rows.Count; i++) { row = gridview_AttendanceRegisterEmployee.Rows[i]; bool isChecked = ((CheckBox)row.FindControl("chk_Present")).Checked; if (isChecked) { PageVariables.count = PageVariables.count + 1; } } }
private static List <StaffMaster> ConvertDatarowToObject(DataTable EmployeeTable) { try { //TODO: SUBRAT: handle null of this part to List <StaffMaster> EmployeeList = new List <StaffMaster>(); foreach (DataRow dr in EmployeeTable.Rows) { StaffMaster ObjEmployee = new StaffMaster(); ObjEmployee.EmployeeID = int.Parse(dr["EmployeeID"].ToString()); ObjEmployee.EmployeeCode = dr["EmployeeCode"].ToString(); ObjEmployee.Salutation = dr["Salutation"].ToString().ToUpper().Trim(); ObjEmployee.EmployeeName = dr["EmployeeName"].ToString().ToUpper().Trim(); string eName = ObjEmployee.EmployeeName; ObjEmployee.EmployeeFirstName = (eName.Contains(" ") == true ? eName.Substring(0, eName.IndexOf(" ")) : eName); ObjEmployee.EmployeeLastName = (eName.Contains(" ") == true ? eName.Substring(eName.IndexOf(" "), eName.Length - eName.IndexOf(" ")) : eName); ObjEmployee.FatherName = dr["FatherName"].ToString(); ObjEmployee.Gender = dr["Gender"].ToString(); if (dr["DateOfBirth"] != null) { ObjEmployee.DateOfBirth = (dr["DateOfBirth"].ToString().Length > 0 ? DateTime.Parse(dr["DateOfBirth"].ToString()).ToString(MicroConstants.DateFormat) : null); } //JoiningDateInOffice if (dr["JoiningDateInOffice"] != null) { ObjEmployee.JoiningDateInOffice = (dr["JoiningDateInOffice"].ToString().Length > 0 ? DateTime.Parse(dr["JoiningDateInOffice"].ToString()).ToString(MicroConstants.DateFormat) : null); } //ObjEmployee.EmployeeServiceDetailsID = int.Parse(dr["EmployeeServiceDetailsID"].ToString()); ObjEmployee.DepartmentID = (dr["DepartmentID"].ToString() != "" ? int.Parse(dr["DepartmentID"].ToString()) : 0); ObjEmployee.DepartmentDescription = dr["DepartmentDescription"].ToString().ToUpper(); ObjEmployee.DesignationID = (dr["DesignationID"].ToString() != "" ? int.Parse(dr["DesignationID"].ToString()) : 0); ObjEmployee.DesignationDescription = dr["DesignationDescription"].ToString().ToUpper(); ObjEmployee.OfficeID = (string.IsNullOrEmpty(dr["OfficeID"].ToString()) ? 0 : int.Parse(dr["OfficeId"].ToString())); ObjEmployee.OfficeName = dr["OfficeName"].ToString(); ObjEmployee.Mobile = dr["Mobile"].ToString(); ObjEmployee.PhoneNumber = dr["PhoneNumber"].ToString(); // ObjEmployee.PersonalEMailID = dr["PersonalEMailID"].ToString(); ObjEmployee.EmailID = dr["EmailID"].ToString(); // ObjEmployee.ServiceStatus = dr["ServiceStatus"].ToString(); // ObjEmployee.ServiceType = dr["ServiceType"].ToString(); // ObjEmployee.ReferenceLetterNumber = dr["ReferenceLetterNumber"].ToString(); // ObjEmployee.Remarks = dr["Remarks"].ToString(); if (dr["ReportingToEmployeeName"].ToString() != "") { ObjEmployee.ReportingToEmployeeID = int.Parse(dr["ReportingToEmployeeID"].ToString()); ObjEmployee.ReportingToEmployeeName = dr["ReportingToEmployeeName"].ToString(); } else { ObjEmployee.ReportingToEmployeeID = -1; ObjEmployee.ReportingToEmployeeName = ""; } if (dr["RoleDescription"].ToString() != "") { ObjEmployee.RoleID = int.Parse(dr["RoleID"].ToString()); ObjEmployee.RoleDescription = dr["RoleDescription"].ToString(); } else { ObjEmployee.RoleID = -1; ObjEmployee.RoleDescription = ""; } if (dr["UserID"].ToString() != "") { ObjEmployee.UserID = int.Parse(dr["UserID"].ToString()); } if (dr["Employeetype1"].ToString() != "") { ObjEmployee.Employeetype1 = dr["Employeetype1"].ToString(); } if (dr["Employeetype2"].ToString() != "") { ObjEmployee.Employeetype2 = dr["Employeetype2"].ToString(); } if (dr["Employeetype3"].ToString() != "") { ObjEmployee.Employeetype3 = dr["Employeetype3"].ToString(); } if (dr["Employeetype4"].ToString() != "") { ObjEmployee.Employeetype4 = dr["Employeetype4"].ToString(); } //LastQualification //if (dr["LastQualification"].ToString() != "") //{ // ObjEmployee.LastQualification = dr["LastQualification"].ToString(); //} //LastQualification if (dr["Address_Present_DistrictID"].ToString() != "") { ObjEmployee.Address_Present_TownOrCity = dr["Address_Present_TownOrCity"].ToString(); ObjEmployee.Address_Present_LandMark = dr["Address_Present_LandMark"].ToString(); ObjEmployee.Address_Present_DistrictID = int.Parse(dr["Address_Present_DistrictID"].ToString()); ObjEmployee.Address_Present_Pincode = dr["Address_Present_Pincode"].ToString(); ObjEmployee.Address_Present_DistrictName = dr["Address_Present_DistrictName"].ToString(); //ObjEmployee.Address_Present_StateName = dr["Address_Present_StateName"].ToString(); //ObjEmployee.Address_Present_CountryName = dr["Address_Present_CountryName"].ToString(); } if (dr["Address_Permanent_DistrictID"].ToString() != "") { ObjEmployee.Address_Permanent_TownOrCity = dr["Address_Permanent_TownOrCity"].ToString(); ObjEmployee.Address_Permanent_LandMark = dr["Address_Permanent_LandMark"].ToString(); ObjEmployee.Address_Permanent_DistrictID = int.Parse(dr["Address_Permanent_DistrictID"].ToString()); ObjEmployee.Address_Permanent_Pincode = dr["Address_Permanent_Pincode"].ToString(); ObjEmployee.Address_Permanent_DistrictName = dr["Address_Permanent_DistrictName"].ToString(); //ObjEmployee.Address_Present_StateName = dr["Address_Present_StateName"].ToString(); //ObjEmployee.Address_Present_CountryName = dr["Address_Present_CountryName"].ToString(); } try { if (dr["TeachingOrNonTeaching"] == null) { ObjEmployee.TeachingOrNonTeaching = ""; } else if (dr["TeachingOrNonTeaching"].ToString() != "") { ObjEmployee.TeachingOrNonTeaching = dr["TeachingOrNonTeaching"].ToString(); } } catch { ObjEmployee.TeachingOrNonTeaching = "T"; } EmployeeList.Add(ObjEmployee); } return(EmployeeList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }