Exemplo n.º 1
0
        public ActionResult SaveSchedulerEvent(Scheduler _event, int yakkrid = 0)
        {
            List <Scheduler> m            = new List <Scheduler>();
            bool             YakkrRemoved = false;

            try
            {
                var StfInfo = StaffDetails.GetInstance();
                _event.StaffId            = new Guid(Session["UserId"].ToString());
                _event.AgencyId           = new Guid(Session["AgencyID"].ToString());
                _event.StaffRoleId        = new Guid(Session["RoleID"].ToString());
                _event.MeetingDescription = _event.title;

                string h = homeVisitorData.saveEvent(_event, yakkrid);

                m = homeVisitorData.getUserEvents();


                if (yakkrid > 0 && _event.ClientId > 0 && _event.MeetingId == 0)
                {
                    YakkrRemoved = homeVisitorData.ClearYakkr(yakkrid, _event.ClientId);
                }

                // return Json(m, JsonRequestBehavior.AllowGet);
                return(Json(new { Events = m, YakkrRemoved = YakkrRemoved }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex) {
                clsError.WriteException(ex);
            }
            return(Json(m, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        // the staff add the details of others in the package details
        public void DALStaffPackageEdit(long customerId, StaffDetails pack_details)
        {
            SqlCommand    _sqlCommand    = new SqlCommand();
            SqlConnection _sqlConnection = ConnectionHandler.GetConnection();

            _sqlCommand.CommandType = CommandType.Text;
            _sqlCommand.Connection  = _sqlConnection;
            _sqlCommand.CommandText = "update Cts_Package set pk_Employee_id = @employeeId,pk_Accept_Date=@acceptDate,pk_Current_location=@currentLocation where pk_Customer_id = @customerId";
            _sqlCommand.Parameters.AddWithValue("@employeeId", pack_details.Employee_Id);
            _sqlCommand.Parameters.AddWithValue("@acceptDate", pack_details.Accept_Date);
            _sqlCommand.Parameters.AddWithValue("@currentLocation", pack_details.Current_Location);
            _sqlCommand.Parameters.AddWithValue("@customerId", customerId);
            try
            {
                _sqlConnection.Open();
                if (_sqlConnection.State == ConnectionState.Open)
                {
                    _sqlCommand.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                _sqlConnection.Close();
            }
        }
Exemplo n.º 3
0
        public string CheckSignatureCodeData(string signatureCode, string staffUserID)
        {
            string result = "0";

            try
            {
                StaffDetails staff = StaffDetails.GetInstance();

                using (Connection = connection.returnConnection())
                {
                    command.Parameters.Clear();
                    command.Parameters.Add(new SqlParameter("@AgencyID", staff.AgencyId));
                    command.Parameters.Add(new SqlParameter("@RoleID", staff.RoleId));
                    command.Parameters.Add(new SqlParameter("@UserID", staff.UserId));
                    command.Parameters.Add(new SqlParameter("@StaffUserID", staffUserID));
                    command.Parameters.Add(new SqlParameter("@SignatureCode", EncryptDecrypt.Encrypt(signatureCode)));
                    command.Parameters.Add(new SqlParameter("@result", string.Empty)).Direction = ParameterDirection.Output;
                    command.Connection  = Connection;
                    command.CommandText = "USP_VerifyStaffSignatureCode";
                    command.CommandType = CommandType.StoredProcedure;
                    Connection.Open();
                    command.ExecuteReader();
                    result = command.Parameters["@result"].Value.ToString();
                    Connection.Close();
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
                result = "2";
            }

            return(result);
        }
Exemplo n.º 4
0
        public void GetPostedDocumentsDetails(ref DataTable dtElements)
        {
            dtElements = new DataTable();
            try
            {
                StaffDetails staff = StaffDetails.GetInstance();

                command.Parameters.Clear();
                command.Parameters.Add(new SqlParameter("@RoleId", staff.AgencyId));
                command.Parameters.Add(new SqlParameter("@UserID", staff.UserId));
                command.Parameters.Add(new SqlParameter("@AgencyID", staff.AgencyId));
                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "USP_GetMaterialPostedHistoryByUserId";
                DataAdapter         = new SqlDataAdapter(command);
                DataAdapter.Fill(dtElements);
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                if (Connection != null)
                {
                    Connection.Close();
                }
            }
        }
Exemplo n.º 5
0
        // the package details showing the details of staff for approval to admin
        public StaffDetails DALGetStaffPackageDetails(long employeeId)
        {
            SqlCommand    _sqlCommand    = new SqlCommand();
            SqlConnection _sqlConnection = ConnectionHandler.GetConnection();

            _sqlCommand.CommandType = CommandType.Text;
            _sqlCommand.Connection  = _sqlConnection;
            _sqlCommand.CommandText = "select pk_Employee_id,pk_Accept_Date,pk_Current_location from Cts_Package where pk_Employee_id = @employeeId";
            _sqlCommand.Parameters.AddWithValue("@employeeId", employeeId);
            SqlDataAdapter _sqlDataAdapter = new SqlDataAdapter(_sqlCommand);
            DataTable      _dataTable      = new DataTable();

            _sqlDataAdapter.Fill(_dataTable);
            if (_dataTable.Rows.Count > 0)
            {
                DataRow      _dataRow     = _dataTable.Rows[0];
                StaffDetails package_list = new StaffDetails
                                            (
                    long.Parse(_dataRow["pk_Employee_id"].ToString()),
                    DateTime.Parse(_dataRow["pk_Accept_Date"].ToString()),
                    _dataRow["pk_Current_location"].ToString()
                                            );
                return(package_list);
            }
            else
            {
                return(new StaffDetails());
            }
        }
Exemplo n.º 6
0
        public ActionResult EducationMaterialGroupShare()
        {
            try
            {
                // FamilyData obj = new FamilyData();
                List <SelectListItem> Centerlist = new List <SelectListItem>();
                List <FingerprintsModel.RosterNew.User> _userlist = new List <FingerprintsModel.RosterNew.User>();
                StaffDetails staff    = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>();
                DataSet      _dataset = new FamilyData().GetCenterCaseNote(staff);
                if (_dataset.Tables[0] != null && _dataset.Tables[0].Rows.Count > 0)
                {
                    SelectListItem info = null;
                    Centerlist.Add(new SelectListItem {
                        Value = "0", Text = "Choose"
                    });
                    foreach (DataRow dr in _dataset.Tables[0].Rows)
                    {
                        info       = new SelectListItem();
                        info.Value = dr["center"].ToString();
                        info.Text  = dr["centername"].ToString();
                        Centerlist.Add(info);
                    }
                    TempData["GroupCaseNotes"] = Centerlist;
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }

            return(View());
        }
Exemplo n.º 7
0
 public void GetPostedDocumentsDetailsForParent(ref DataSet dtDocument, string ClientId)
 {
     dtDocument = new DataSet();
     try
     {
         StaffDetails staff = StaffDetails.GetInstance();
         command.Parameters.Clear();
         command.Parameters.Add(new SqlParameter("@ClientId", ClientId));
         command.Parameters.Add(new SqlParameter("@RoleId", staff.AgencyId));
         command.Parameters.Add(new SqlParameter("@UserID", staff.UserId));
         command.Parameters.Add(new SqlParameter("@AgencyID", staff.AgencyId));
         command.Connection  = Connection;
         command.CommandType = CommandType.StoredProcedure;
         command.CommandText = "USP_GetMaterialDocumentForParent";
         DataAdapter         = new SqlDataAdapter(command);
         DataAdapter.Fill(dtDocument);
     }
     catch (Exception ex)
     {
         clsError.WriteException(ex);
     }
     finally
     {
         if (Connection != null)
         {
             Connection.Close();
         }
     }
 }
Exemplo n.º 8
0
        public Tuple <string, string> GetManagerDetails()
        {
            StaffDetails staffDetails = StaffDetails.GetInstance();
            string       AgencyId = ""; string UserId = "";

            if (staffDetails.AgencyId != null)
            {
                AgencyId = staffDetails.AgencyId.ToString();
                UserId   = staffDetails.UserId.ToString();
                Session.Abandon();
                Session.Clear();
                Session.RemoveAll();
                //  Session["MangAgencyId"] = AgencyId;
                // Session["MangId"] = UserId;
                //  HttpCookie Emailid = new HttpCookie("Emailid");
                //Emailid.Expires = DateTime.Now.AddDays(-1d);
            }
            else
            {
                //if (Session["MangAgencyId"] != null && Session["MangId"] != null) {
                //Redirected to
                AgencyId = Session["MangAgencyId"].ToString();
                UserId   = Session["MangId"].ToString();
            }

            var MgDetails = Tuple.Create(AgencyId, UserId);


            return(MgDetails);
        }
Exemplo n.º 9
0
 public object AddUpdate(StaffDetails obj, ref int staffId)
 {
     try
     {
         Staff s = new Staff
         {
             Id          = obj.Id,
             Name        = obj.Name,
             Designation = obj.Designation,
             Email       = obj.Email,
             Mobile      = obj.Mobile,
             Subject     = obj.Subject
         };
         if (s.Id == 0)
         {
             dbEntities.Staffs.Add(s);
         }
         else
         {
             var staff = dbEntities.Staffs.Where(sf => sf.Id == obj.Id).FirstOrDefault();
             staff.Name        = s.Name;
             staff.Designation = s.Designation;
             staff.Email       = s.Email;
             staff.Mobile      = s.Mobile;
             staff.Subject     = s.Subject;
         }
         dbEntities.SaveChanges();
         staffId = s.Id;
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 10
0
        public static StaffResponseDTO MapStaffDetailsToDto(StaffDetails staffDetails, IStaffService staffService)
        {
            _staffService = staffService;
            string count  = string.Empty;
            var    result = new StaffResponseDTO
            {
                Id           = staffDetails.Id,
                DateOfBirth  = staffDetails.Dob,
                Nationality  = staffDetails.Countrycode,
                FiredOn      = staffDetails.Firedon.Value,
                Email        = staffDetails.Emailaddress,
                JoinedOn     = staffDetails.HiredOn == null ? default(DateTime) : staffDetails.HiredOn.Value,
                ResignedOn   = staffDetails.Resignedon == null ? default(DateTime) : staffDetails.Resignedon.Value,
                StreetName1  = staffDetails.Streetname1,
                StreetName2  = staffDetails.Streetname2,
                StreetName3  = staffDetails.Streetname3,
                StreetNumber = staffDetails.Housenumber,
                Name         = staffDetails.Firstname + " " + staffDetails.Surname,
                Surname      = staffDetails.Surname,
            };

            result.HiredOn = result.JoinedOn;
            result.HiredBy = staffDetails.Hiredbyid;
            if (staffDetails.Departmentid != null)
            {
                result.Department = _staffService.GetDepartmentById(staffDetails.Departmentid.Value);
                result.Manager    = _staffService.GetManagerById(staffDetails.Departmentid.Value);
            }
            // retrieve staff teritories and languages
            result.Languages  = _staffService.GetStaffLanguageIds(staffDetails.Staffuserid);
            result.Teritories = _staffService.GetStaffTeritoryIds(staffDetails.Staffuserid);


            return(result);
        }
Exemplo n.º 11
0
        public static StaffDetails MapDtoToStaffDetails(StaffDTO staffDetails, IStaffService staffService)
        {
            _staffService = staffService;
            var result = new StaffDetails
            {
                //Id = staffDetails.Id,
                //Staffuserid = staffDetails.StaffUserId,
                //City = staffDetails.City,
                //State = staffDetails.State,
                Dob       = staffDetails.DateOfBirth, //
                DtCreated = DateTime.Now,
                // Emailaddress = staffDetails.Email,
                Firedon     = staffDetails.FiredOn,      //
                Streetname1 = staffDetails.StreetName1,  //
                Streetname2 = staffDetails.StreetName2,  //
                Streetname3 = staffDetails.StreetName3,  //
                Housenumber = staffDetails.StreetNumber, //
                Firstname   = staffDetails.Name,         //
                Surname     = staffDetails.Surname,      //
                DtModified  = DateTime.Now,
                //Phonenumber = "123456789",
                Countrycode = staffDetails.Nationality, //
                HiredOn     = staffDetails.HiredOn,     //
                Hiredbyid   = staffDetails.HiredBy,     //
                Resignedon  = staffDetails.ResignedOn,  //
            };

            //result.Hiredbyid = _staffService.GetHiredByIdFromDepartmentName(staffDetails.Department);
            result.Departmentid = _staffService.GetDepartmentIdFromName(staffDetails.Department);
            return(result);
        }
        public void ExportSubstituteRoleReport(string[] centerIds, string[] classroomIds, string[] months, int reportFormatType)
        {
            try
            {
                var substituteRole = new SubstituteRole();

                substituteRole.CenterID            = centerIds != null && centerIds.Length > 0 ? string.Join(",", centerIds) : "0";
                substituteRole.ClassroomID         = classroomIds != null && classroomIds.Length > 0 ? string.Join(",", classroomIds) : "0";
                substituteRole.Month               = months != null && months.Length > 0 ? string.Join(",", months) : "0";
                substituteRole.StaffDetails        = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>(false);
                substituteRole.StaffDetails.RoleId = new Guid(FingerprintsModel.EnumHelper.GetEnumDescription(FingerprintsModel.Enums.RoleEnum.Teacher));
                substituteRole.SubstituteRoleMode  = (int)FingerprintsModel.Enums.SubstituteRoleMode.Export;
                #region Itextsharp PDF generation Region

                string       imagePath = Server.MapPath("~/Images/");
                StaffDetails staff     = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>();


                substituteRole = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <Reporting>().GetSubstituteRoleReport(staff, substituteRole);


                var reportTypeEnum = FingerprintsModel.EnumHelper.GetEnumByStringValue <FingerprintsModel.Enums.ReportFormatType>(reportFormatType.ToString());

                MemoryStream workStream = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <Export>().ExportSubstituteRoleReport(substituteRole, reportTypeEnum, imagePath);
                string       reportName = "Substitute_Teacher_Report";

                DownloadReport(workStream, reportTypeEnum, reportName);

                #endregion
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// method to delete the Sub-Inkind Activity
        /// </summary>
        /// <param name="subActivityId"></param>
        /// <returns></returns>
        public bool DeleteInKindSubActivity(int subActivityId)
        {
            bool isRowsAffected = false;

            try
            {
                StaffDetails details = new StaffDetails();
                using (_connection)
                {
                    // command.Prepare();
                    command.Parameters.Add(new SqlParameter("@AgencyId", details.AgencyId));
                    command.Parameters.Add(new SqlParameter("@UserId", details.UserId));
                    command.Parameters.Add(new SqlParameter("@RoleId", details.RoleId));
                    command.Parameters.Add(new SqlParameter("@SubActivityId", subActivityId));
                    command.Connection  = _connection;
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "USP_DeleteSubActivity";
                    _connection.Open();
                    isRowsAffected = (command.ExecuteNonQuery() > 0);
                    _connection.Close();
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                _connection.Dispose();
                command.Dispose();
            }
            return(isRowsAffected);
        }
Exemplo n.º 14
0
        public JsonResult changePasswordAjax(string currentPassword, string newPassword)
        {
            try
            {
                StaffDetails staff = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>();


                string result = LoginData.ChangePassword(currentPassword.Trim(), newPassword.Trim(), staff.UserId.ToString());



                if (result == "1")
                {
                    string imagepath = UrlExtensions.LinkToRegistrationProcess("Content/img/logo_email.png");

                    Thread thread = new Thread(delegate()
                    {
                        SendMail.Sendchangepassword(staff.EmailID, newPassword.Trim(), string.Empty, Server.MapPath("~/MailTemplate"), imagepath);
                    });
                    thread.Start();
                }


                return(Json(result));
            }
            catch (Exception Ex)
            {
                return(Json(Ex.Message));
            }
        }
        /// <summary>
        /// Update a StaffDetails
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="lockID"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public void DeleteStaffDetails(string currentUser, string user, string appID, string overrideID, string code, string lockID, IRepository <StaffDetails> dataRepository, IUnitOfWork uow)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (string.IsNullOrEmpty(code))
                {
                    throw new ArgumentOutOfRangeException("code");
                }
                if (string.IsNullOrEmpty(lockID))
                {
                    throw new ArgumentOutOfRangeException("lockID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }

                #endregion

                using (uow)
                {
                    // Convert string to guid
                    Guid codeGuid = Guid.Parse(code);

                    // Find item based on ID
                    StaffDetails dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                    // Delete the item
                    dataRepository.Delete(dataEntity);

                    // Commit unit of work
                    uow.Commit();
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                ExceptionManager.ShieldException(e);
            }
        }
        public PartialViewResult GetAttendanceMealAuditReportByCenter(AttendanceMealAuditReport report)
        {
            StaffDetails staff = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>();

            report.SkipRows = report.GetSkipRows();
            report          = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <Reporting>().GetAttendanceMealAuditReport(report, staff);

            return(PartialView("~/Views/Reporting/_AttendanceMealAuditReportTable.cshtml", report.AttendanceMealAuditReportList));
        }
Exemplo n.º 17
0
        public async Task <StaffDetails> UpdateStaff(int value, StaffDetails staff, List <string> langIds, List <string> territoryIds)
        {
            // save languages
            if (langIds != null && langIds.Any())
            {
                // remove all language entries of this staff from the db
                var staffLangs = uow.StaffLanguageRepository.Find(s => s.Staffuserid == staff.Staffuserid).ToList();
                if (staffLangs != null && staffLangs.Any())
                {
                    uow.StaffLanguageRepository.RemoveRange(staffLangs);
                }

                // save new languages
                var data = new List <StaffLanguages>();
                foreach (var id in langIds)
                {
                    data.Add(new StaffLanguages
                    {
                        Languageid  = int.Parse(id),
                        Staffuserid = staff.Staffuserid,
                        DtCreated   = DateTime.Now,
                        DtModified  = DateTime.Now
                    });
                }
                uow.StaffLanguageRepository.AddRange(data);
            }

            // save the territories
            if (territoryIds != null && territoryIds.Any())
            {
                // remove all language entries of this staff from the db
                var staffTers = uow.StaffTerritoryRepository.Find(s => s.Staffuserid == staff.Staffuserid).ToList();
                if (staffTers != null && staffTers.Any())
                {
                    uow.StaffTerritoryRepository.RemoveRange(staffTers);
                }

                // save new territories
                var data = new List <StaffTerritory>();
                foreach (var id in territoryIds)
                {
                    data.Add(new StaffTerritory
                    {
                        Territory   = int.Parse(id),
                        Staffuserid = staff.Staffuserid,
                        DtCreated   = DateTime.Now,
                        DtModified  = DateTime.Now
                    });
                }
                uow.StaffTerritoryRepository.AddRange(data);
            }


            uow.Save();

            return(staff);
        }
Exemplo n.º 18
0
        public FacilitesModel GetFacilitiesStaffDashboard(StaffDetails details)
        {
            FacilitesModel facilitiesModel = new FacilitesModel();

            facilitiesModel.FacilitiesDashboardList = new List <FacilitiesManagerDashboard>();
            try
            {
                using (_connection)
                {
                    if (_connection.State == ConnectionState.Open)
                    {
                        _connection.Close();
                    }

                    command.Parameters.Clear();
                    command.Parameters.Add(new SqlParameter("@AgencyId", details.AgencyId));
                    command.Parameters.Add(new SqlParameter("@userId", details.UserId));
                    command.Parameters.Add(new SqlParameter("@RoleId", details.RoleId));
                    command.Connection  = _connection;
                    command.CommandType = CommandType.StoredProcedure;
                    // command.CommandText = "USP_FacilitiesManagerDashboard";
                    command.CommandText = "USP_FacilitiesStaffDashboardCount";
                    dataAdapter         = new SqlDataAdapter(command);
                    _dataset            = new DataSet();
                    dataAdapter.Fill(_dataset);
                    if (_dataset.Tables[0] != null)
                    {
                        if (_dataset.Tables[0].Rows.Count > 0)
                        {
                            facilitiesModel.FacilitiesDashboardList = (from DataRow dr in _dataset.Tables[0].Rows

                                                                       select new FacilitiesManagerDashboard
                            {
                                CenterId = Convert.ToInt64(dr["CenterId"]),
                                Enc_CenterId = EncryptDecrypt.Encrypt64(dr["CenterId"].ToString()),
                                CenterName = dr["CenterName"].ToString(),
                                OpenedWorkOrders = Convert.ToInt64(dr["OpenedWorkOrders"]),

                                CompletedWorkOrders = Convert.ToInt64(dr["CompletedWorkOrders"]),
                                TemporarilyFixedWorkOrders = Convert.ToInt64(dr["TemporarilyFixed"])
                            }).ToList();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                dataAdapter.Dispose();
                command.Dispose();
                _dataset.Dispose();
            }
            return(facilitiesModel);
        }
Exemplo n.º 19
0
        /// <summary>
        /// method to get the Staff under the PIR Access Roles based on Agency.
        /// </summary>
        /// <returns></returns>
        public PIRAccessStaffs GetPIRUsers(PIRAccessStaffs pirStaffs)
        {
            PIRAccessStaffs pIRAccessStaffs = new PIRAccessStaffs();

            try
            {
                StaffDetails staffDetails = StaffDetails.GetInstance();

                if (Connection.State == ConnectionState.Open)
                {
                    Connection.Close();
                }

                using (Connection)
                {
                    command.Parameters.Clear();
                    command.Parameters.Add(new SqlParameter("@AgencyId", staffDetails.AgencyId));
                    command.Parameters.Add(new SqlParameter("@UserId", staffDetails.UserId));
                    command.Parameters.Add(new SqlParameter("@RoleId", staffDetails.RoleId));
                    command.Parameters.Add(new SqlParameter("@Take", pirStaffs.Take));
                    command.Parameters.Add(new SqlParameter("@Skip", pirStaffs.Skip));
                    command.Parameters.Add(new SqlParameter("@RequestedPage", pirStaffs.RequestedPage));
                    command.Parameters.Add(new SqlParameter("@SearchText", pirStaffs.SearchText));
                    command.Connection  = Connection;
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "USP_GetPIRAccessStaffs";
                    Connection.Open();
                    DataAdapter = new SqlDataAdapter(command);
                    _dataset    = new DataSet();
                    DataAdapter.Fill(_dataset);
                    Connection.Close();
                }
                if (_dataset != null)
                {
                    if (_dataset.Tables[0].Rows.Count > 0)
                    {
                        pIRAccessStaffs.TotalRecord = Convert.ToInt32(_dataset.Tables[0].Rows[0]["TotalRecord"]);

                        pIRAccessStaffs.PIRStaffsList = _dataset.Tables[0].AsEnumerable().OrderBy(x => x.Field <string>("StaffName"))
                                                        .Select(x => new PIRStaffs
                        {
                            StaffName      = x.Field <string>("StaffName"),
                            RoleId         = x.Field <Guid>("RoleId"),
                            UserId         = x.Field <Guid>("UserId"),
                            RoleName       = x.Field <string>("RoleName"),
                            IsShowSectionB = x.Field <bool>("IsShowSectionB")
                        }).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(pIRAccessStaffs);
        }
Exemplo n.º 20
0
        public static StaffDetails MapStaffToStaffDetails(this Staff user)
        {
            StaffDetails staff = new StaffDetails();

            staff.Designation   = user.Designation;
            staff.IsAdmin       = user.IsAdmin;
            staff.StaffLastName = user.StaffLastName;
            staff.StaffName     = user.StaffName;
            return(staff);
        }
Exemplo n.º 21
0
 public ActionResult Create([Bind(Include = "StaffKey,StaffName,StaffLastName,Designation,Role,IsAdmin")] StaffDetails user)
 {
     if (ModelState.IsValid)
     {
         iStaffRepository.AddUpdateStaff(user);
         ViewBag.Success = "User updated successfully";
     }
     //ModelState.Clear();
     return(View(user));
 }
Exemplo n.º 22
0
 public Result AddStaff(StaffDetails inStaff)
 {
     try
     {
         InStaff inStaff1 = new InStaff();
         using (DB_A3E3FF_scampus2020Context db = new DB_A3E3FF_scampus2020Context())
         {
             inStaff1.Name              = inStaff.Name;
             inStaff1.Dob               = inStaff.Dob;
             inStaff1.Gender            = inStaff.Gender;
             inStaff1.Address           = inStaff.Address;
             inStaff1.ContactNumber     = inStaff.ContactNumber;
             inStaff1.MobileNumber      = inStaff.MobileNumber;
             inStaff1.HomeContactNumber = inStaff.HomeContactNumber;
             inStaff1.ContactPerson     = inStaff.ContactPerson;
             inStaff1.BloodGroup        = inStaff.BloodGroup;
             inStaff1.PersonalEmail     = inStaff.PersonalEmail;
             inStaff1.Designation       = inStaff.Designation;
             inStaff1.JoiningDate       = inStaff.JoiningDate;
             inStaff1.Salary            = inStaff.Salary;
             inStaff1.Experience        = inStaff.Experience;
             inStaff1.BranchId          = inStaff.BranchId;
             inStaff1.Department        = inStaff.Department;
             inStaff1.PreviousCompany   = inStaff.PreviousCompany;
             inStaff1.UserName          = inStaff.UserName;
             inStaff1.Password          = inStaff.Password;
             inStaff1.IdcardType        = inStaff.IdcardType;
             inStaff1.Idnumber          = inStaff.Idnumber;
             inStaff1.UploadId          = inStaff.UploadId;
             inStaff1.CertificateTitle  = inStaff.CertificateTitle;
             inStaff1.UserRole          = inStaff.UserRole;
             inStaff1.CreatedBy         = inStaff.CreatedBy;
             inStaff1.CreatedDate       = inStaff.CreatedDate;
             db.InStaff.Add(inStaff1);
             var result = db.SaveChanges();
             if (result == 1)
             {
                 return(new Result {
                     StatusCode = 1, Message = "Staff Added Successfully..!"
                 });
             }
             else
             {
                 return(new Result {
                     StatusCode = -1, Message = "Staff Adding Failed..!"
                 });
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 23
0
        public static Staff MapUserToStaff(this StaffDetails user)
        {
            Staff staff = new Staff();

            staff.Designation   = user.Designation;
            staff.IsAdmin       = user.IsAdmin;
            staff.RoleSKey      = (int)user.Role;
            staff.StaffLastName = user.StaffLastName;
            staff.StaffName     = user.StaffName;
            return(staff);
        }
Exemplo n.º 24
0
        public List <UserDetails> GetUsersforMultipleRoles(List <string> RolesList)
        {
            List <UserDetails> UserList     = new List <UserDetails>();
            StaffDetails       staffDetails = StaffDetails.GetInstance();

            try
            {
                if (Connection.State == ConnectionState.Open)
                {
                    Connection.Close();
                }

                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                _dataset            = new DataSet();
                command.Parameters.Clear();
                command.Parameters.Add(new SqlParameter("@Agencyid", staffDetails.AgencyId));
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[1] {
                    new DataColumn("RoleId", typeof(string)),
                });
                if (RolesList != null && RolesList.Count > 0)
                {
                    foreach (string roles in RolesList)
                    {
                        dt.Rows.Add(roles);
                    }
                }
                command.Parameters.AddWithValue("@RolesList", dt);
                command.CommandText = "SP_GetUsersforMultipleRoles";
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(_dataset);
                Connection.Close();
                if (_dataset != null)
                {
                    if (_dataset.Tables[0].Rows.Count > 0)
                    {
                        UserList = (from DataRow dr5 in _dataset.Tables[0].Rows
                                    select new UserDetails
                        {
                            StaffName = dr5["StaffName"].ToString(),
                            UserId = dr5["UserId"].ToString(),
                            RoleName = dr5["RoleName"].ToString()
                        }).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(UserList);
        }
Exemplo n.º 25
0
        private IEnumerable <Claim> GetUserClaims(StaffDetails user)
        {
            var claims = new Claim[]
            {
                new Claim(ClaimTypes.Name, user.Id.ToString()),
                new Claim("USERID", user.Staffuserid),
                //new Claim("ACCESS_LEVEL", user.ACCESS_LEVEL?.ToUpper()),
                //new Claim("READ_ONLY", user.READ_ONLY?.ToUpper())
            };

            return(claims);
        }
Exemplo n.º 26
0
 public Result UpdateStaff(StaffDetails inStaff)
 {
     try
     {
         using (DB_A3E3FF_scampus2020Context db = new DB_A3E3FF_scampus2020Context())
         {
             var data = db.InStaff.Where(x => x.StaffId == inStaff.StaffId).FirstOrDefault();
             data.Name              = inStaff.Name;
             data.Dob               = inStaff.Dob;
             data.Gender            = inStaff.Gender;
             data.Address           = inStaff.Address;
             data.ContactNumber     = inStaff.ContactNumber;
             data.MobileNumber      = inStaff.MobileNumber;
             data.HomeContactNumber = inStaff.HomeContactNumber;
             data.ContactPerson     = inStaff.ContactPerson;
             data.BloodGroup        = inStaff.BloodGroup;
             data.PersonalEmail     = inStaff.PersonalEmail;
             data.Designation       = inStaff.Designation;
             data.JoiningDate       = inStaff.JoiningDate;
             data.Salary            = inStaff.Salary;
             data.Experience        = inStaff.Experience;
             data.BranchId          = inStaff.BranchId;
             data.Department        = inStaff.Department;
             data.PreviousCompany   = inStaff.PreviousCompany;
             data.UserName          = inStaff.UserName;
             data.Password          = inStaff.Password;
             data.IdcardType        = inStaff.IdcardType;
             data.Idnumber          = inStaff.Idnumber;
             data.UploadId          = inStaff.UploadId;
             data.CertificateTitle  = inStaff.CertificateTitle;
             data.UserRole          = inStaff.UserRole;
             data.UpdatedBy         = inStaff.CreatedBy;
             data.UpdatedDate       = inStaff.CreatedDate;
             var result = db.SaveChanges();
             if (result == 1)
             {
                 return(new Result {
                     StatusCode = 1, Message = "Staff Added Successfully..!"
                 });
             }
             else
             {
                 return(new Result {
                     StatusCode = -1, Message = "Staff Adding Failed..!"
                 });
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 27
0
        public List <StaffEventCreation> GetStaffEventList(int Mode)
        {
            List <StaffEventCreation> events = new List <StaffEventCreation>();

            try
            {
                if (Connection.State == ConnectionState.Open)
                {
                    Connection.Close();
                }
                Connection.Open();
                StaffDetails staff = new StaffDetails();
                _dataset = new DataSet();
                command.Parameters.Clear();
                command.Parameters.Add(new SqlParameter("@Agencyid", staff.AgencyId));
                command.Parameters.Add(new SqlParameter("@userid", staff.UserId));
                command.Parameters.Add(new SqlParameter("@Mode", Mode));
                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_EventCreation";
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(_dataset);
                if (_dataset != null && _dataset.Tables[0] != null && _dataset.Tables[0].Rows.Count > 0)
                {
                    events = (from DataRow dr5 in _dataset.Tables[0].Rows
                              select new StaffEventCreation
                    {
                        EventDescription = dr5["Description"].ToString(),
                        EvenitAddress = dr5["EventAddress"].ToString(),
                        EventDate = dr5["TrainingDate"].ToString(),
                        Eventid = Convert.ToInt32(dr5["EventId"]),
                        EventName = dr5["TrainingName"].ToString(),
                        ContinuingEdu = dr5["ContinuingEducation"].ToString(),
                        TotalHours = dr5["TotalHours"].ToString(),
                        Trainer = dr5["Trainer"].ToString(),
                        CancelReason = dr5["CancellReason"].ToString(),
                        ModifiedDate = dr5["ModifiedDate"].ToString(),
                        IsTodayEvent = Convert.ToInt32(dr5["IsTodayEvent"])
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                Connection.Close();
                command.Dispose();
            }
            return(events);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Method to set the Activity Amount for Parent
        /// </summary>
        /// <param name="transactionsList"></param>
        /// <returns>List<InKindTransactions></returns>
        public List <InKindTransactions> SetActivityAmtForParent(List <InKindTransactions> transactionsList)
        {
            //List<InKindTransactions> transList = new List<InKindTransactions>();
            //transList = transactionsList;

            try
            {
                Inkind       inkind  = new Inkind();
                StaffDetails details = StaffDetails.GetInstance();
                inkind = new InKindData().GetInkindActivities(details);

                if (inkind.InkindActivityList.Count() > 0 && transactionsList != null && transactionsList.Count() > 0)
                {
                    foreach (var item in transactionsList)
                    {
                        item.ParentID = EncryptDecrypt.Decrypt64(item.ParentID);
                        string actvitytype        = "";
                        string ActivityAmountRate = "";

                        if (item.ActivityID > 0)
                        {
                            actvitytype = inkind.InkindActivityList.Where(x => x.ActivityCode == item.ActivityID.ToString()).Select(x => x.ActivityType).FirstOrDefault();
                        }

                        if (actvitytype == "2" || item.ActivityID == 0)
                        {
                            actvitytype = (actvitytype == "") ? (item.Hours > 0 || item.Minutes > 0) ? "2" : (item.MilesDriven > 0) ? "1" : actvitytype : actvitytype;

                            item.ActivityID    = inkind.InkindActivityList.Where(x => x.ActivityType == actvitytype).Select(x => Convert.ToInt32(x.ActivityCode)).FirstOrDefault();
                            ActivityAmountRate = inkind.InkindActivityList.Where(x => x.ActivityCode == item.ActivityID.ToString()).Select(x => x.ActivityAmountRate).FirstOrDefault();
                        }

                        else
                        {
                            ActivityAmountRate = inkind.InkindActivityList.Where(x => x.ActivityCode == item.ActivityID.ToString()).Select(x => x.ActivityAmountRate).FirstOrDefault();
                        }


                        if (item.Hours > 0 || item.Minutes > 0)
                        {
                            // var InKindAmount1 = Convert.ToDouble(ActivityAmountRate) * (4 + (45 / 60));//46.56
                            item.InKindAmount = Convert.ToDecimal((Convert.ToDouble(ActivityAmountRate) * (item.Hours + (item.Minutes / 60))).ToString("F", CultureInfo.InvariantCulture));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(transactionsList);
        }
Exemplo n.º 29
0
 public JsonResult Getclassrooms(string Centerid = "0")
 {
     try
     {
         StaffDetails staff = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>();
         return(Json(new RosterData(staff).Getclassrooms(Centerid)));
     }
     catch (Exception Ex)
     {
         clsError.WriteException(Ex);
         return(Json("Error occured please try again."));
     }
 }
Exemplo n.º 30
0
        protected void lblButton_Click(object sender, EventArgs e)
        {
            StaffDetails staffDetails = new StaffDetails
                                        (
                Session["StaffId"].ToString(),
                DateTime.Parse((txtAcceptDate).Text.ToString()),
                txtCurrentLocation.Text.ToString()
                                        );
            BAL_Admin staffpackage = new BAL_Admin();

            staffpackage.BALStaffPackageEdit(Session["packageId"].ToString(), staffDetails);
            LoadData(Session["packageId"].ToString());
        }