Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string logUser;

            //IIdentity WinId = HttpContext.Current.User.Identity;
            //WindowsIdentity wi = (WindowsIdentity)WinId;
            //logUser = wi.Name.ToString().Substring(wi.Name.ToString().LastIndexOf("\\") + 1);

            logUser = Session["logUser"].ToString();

            UserView     user = new UserMapper().GetUserByUserName(logUser);
            EmployeeView emp  = new EmployeeMapper().Get(new Entities.EmployeeEntity()
            {
                Id = user.EmployeeId
            });

            NameSurnameLabel.Text      = emp.ToString();
            PersonalNoLabel.Text       = emp.PersonalNumber;
            EmployeeNoLabel.Text       = emp.EmployeeNo;
            UsernameLabel.Text         = logUser;
            JobLabel.Text              = emp.Job;
            OrganizationUnitLabel.Text = emp.OrganizationalUnit;

            #warning only for hr for simple users set to the EmployeeId
            ReminderView view = new ReminderMapper().GetReminderByType(Entities.ReminderEnum.EmployeeNoContract, null);
            EmployeeWithoutContractCountLabel.Text = view.Count.ToString();
            EmployeesWithoutContractUrl.Attributes.Add("href", view.Url);

            view = new ReminderMapper().GetReminderByType(Entities.ReminderEnum.ContractExpire, null);
            ContractExpireCountLabel.Text = view.Count.ToString();
            ContractExpireUrl.Attributes.Add("href", view.Url);

            view = new ReminderMapper().GetReminderByType(Entities.ReminderEnum.LeaveRequest, null);
            LeaveRequestsCountLabel.Text = view.Count.ToString();
            LeaveRequestsUrl.Attributes.Add("href", view.Url);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["EmployeeId"] != null)
            {
                if (!IsPostBack)
                {
                    EmployeeView view = new EmployeeMapper().Get(new EmployeeEntity()
                    {
                        Id = Convert.ToInt32(Request.QueryString["EmployeeId"])
                    });
                    if (view.Id != 0)
                    {
                        EmployeeNameLabel.Text       = view.ToString();
                        JobTitleAndUnitLabel.Text    = view.Job + " at " + view.OrganizationalUnit;
                        EmployeeNoLabel.InnerText    = view.EmployeeNo;
                        PersonalNoLabel.InnerText    = view.PersonalNumber;
                        DateOfBirthLabel.InnerText   = view.DateOfBirth.ToShortDateString();
                        GenderLabel.InnerText        = view.Gender.ToString();
                        CountryLabel.InnerText       = view.Country;
                        NationalityNoLabel.InnerText = view.Nationality;
                        CityLabel.InnerText          = view.City;
                        tMobilePhoneLabel.InnerText  = view.MobilePhone;
                        WorkEmailLabel.InnerText     = view.WorkEmail;
                    }
                    else
                    {
                        Response.Redirect("List.aspx");
                    }
                }
                else
                {
                    if (userTextBox.Text != "")
                    {
                        //PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
                        //UserPrincipal user = UserPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, userTextBox.Text);
                        //if (user != null)
                        //{
                        //    if (user.UserPrincipalName != null)
                        //    {
                        //        EmailAddressTextBox.Text = user.UserPrincipalName;
                        //    }
                        //}
                        //else
                        //{
                        //    EmailAddressTextBox.Text = "";
                        //}


                        // Get the number of items in the Contacts folder. To keep the response smaller, request only the TotalCount property.
                        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
                        service.Url         = new Uri(@"https://mail.kpaonline.org/EWS/Exchange.asmx");
                        service.Credentials = new NetworkCredential("*****@*****.**", "Passsygtech456");

                        System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object sender1, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };

                        NameResolutionCollection nameResolutions = service.ResolveName(
                            userTextBox.Text,
                            ResolveNameSearchLocation.DirectoryOnly,
                            true);

                        foreach (NameResolution nameResolution in nameResolutions)
                        {
                            EmailAddressTextBox.Text = nameResolution.Mailbox.Address;
                        }
                    }
                }
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["EmployeeId"] != null)
            {
                if (!IsPostBack)
                {
                    ((BoundField)EducationTrainingGridView.Columns[0]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)EducationTrainingGridView.Columns[1]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)EducationTrainingGridView.Columns[1]).NullDisplayText  = "On Going";

                    ((BoundField)ExperienceGridView.Columns[0]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)ExperienceGridView.Columns[1]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)ExperienceGridView.Columns[1]).NullDisplayText  = "On Going";

                    ((BoundField)EmployeeActiveContractsGridView.Columns[4]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)EmployeeActiveContractsGridView.Columns[5]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)EmployeeActiveContractsGridView.Columns[5]).NullDisplayText  = "Indifinite";

                    ((BoundField)EmployeeExpiredContractsGridView.Columns[4]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                    ((BoundField)EmployeeExpiredContractsGridView.Columns[5]).DataFormatString = "{0:" + ConfigurationManager.AppSettings["DateFormat"] + " }";

                    EmployeeView view = new EmployeeMapper().Get(new EmployeeEntity()
                    {
                        Id = Convert.ToInt32(Request.QueryString["EmployeeId"])
                    });
                    if (view.Id != 0)
                    {
                        EmployeeNameLabel.Text     = view.ToString();
                        JobTitleAndUnitLabel.Text  = view.Job + " at " + view.OrganizationalUnit;
                        EmployeeNoLabel.InnerText  = view.EmployeeNo;
                        PersonalNoLabel.InnerText  = view.PersonalNumber;
                        DateOfBirthLabel.InnerText = view.DateOfBirth.ToString(ConfigurationManager.AppSettings["DateFormat"]);

                        #warning change the static language number
                        GenderLabel.InnerText = TranslateApplicationString(2, view.Gender.ToString());

                        CountryLabel.InnerText       = view.Country;
                        NationalityNoLabel.InnerText = view.Nationality;
                        CityLabel.InnerText          = view.City;
                        tMobilePhoneLabel.InnerText  = view.MobilePhone;
                        WorkEmailLabel.InnerText     = view.WorkEmail;

                        if (view.Image != null)
                        {
                            Session["fileContents_"] = view.Image;
                            string relativePath = Page.AppRelativeVirtualPath;
                            relativePath            = relativePath.Replace("~", "");
                            empployeeImage.ImageUrl = String.Format("/HRM" + relativePath + "?preview=1");
                        }

                        EmployeeEditHyperLink.NavigateUrl                  = "PersonalInformation.aspx?action=update&EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);
                        EducationTrainingHyperLink.NavigateUrl             = "EducationAndExperience.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);
                        ExperienceHyperLink.NavigateUrl                    = "EducationAndExperience.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);
                        EmployeeActiveContractsManageHyperLink.NavigateUrl = "ContractList.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);
                        EmployeePasiveContractsManageHyperLink.NavigateUrl = "ContractList.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);

                        ContractEmployeeHyperLink.NavigateUrl = "JobDetails.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);
                        ChangeContractHyperLink.NavigateUrl   = "ContractChange.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);
                        ExtendContractHyperLink.NavigateUrl   = "ContractExtend.aspx?EmployeeId=" + Convert.ToInt32(Request.QueryString["EmployeeId"]);

                        if (new ContractMapper().GetLastContract(new ContractEntity()
                        {
                            EmployeeId = view.Id
                        }).ContractNumber != null)
                        {
                            ContractEmployeeHyperLink.Enabled = false;
                        }
                        else
                        {
                            ChangeContractHyperLink.Enabled = false;
                            ExtendContractHyperLink.Enabled = false;
                        }
                    }
                    else
                    {
                        Response.Redirect("List.aspx");
                    }
                }
                else
                {
                    Response.Redirect("List.aspx");
                }
            }

            if (Request.QueryString["preview"] == "1")
            {
                byte[] fileContents = (byte[])Session["fileContents_"];
                if (fileContents.Length != 0)
                {
                    Session.Remove("fileContents_");
                    Response.Clear();
                    Response.ContentType = "fileContentType_";
                    Response.BinaryWrite(fileContents);
                    Response.End();
                }
            }
        }