Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["EmployeeId"] == null)
            {
                Response.Redirect("List.aspx");
            }
            else
            {
                if (Session["JobDetails"] != null)
                {
                    #warning if this is not null set the values of the form from this session value
                }

                EmployeeView view = new EmployeeMapper()
                    .Get(new EmployeeEntity() { Id = Convert.ToInt32(Request.QueryString["EmployeeId"]) });

                if (view.EmployeeNo != null)
                {
                    if (new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = view.Id }).ContractNumber == null)
                    {
                        Session.Add("EmployeeId", Request.QueryString["EmployeeId"]);
                    }
                    else
                    {
                        Response.Redirect("Details.aspx?EmployeeId="+Request.QueryString["EmployeeId"]);
                    }
                }
                else
                {
                    Response.Redirect("List.aspx");
                }
            }
        }
Ejemplo n.º 2
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);
        }
        public static List<G_JSTree> GetAllNodes(string id, string isOrganizationUnit, string contractTemplateId)
        {
            List<G_JSTree> list = new List<G_JSTree>();
            if (isOrganizationUnit == "False")
                return list;

            if (id == "0")
            {
                List<OrganizationalUnitView> organizationalUnits = new OrganizationalUnitMapper().List("");
                foreach (OrganizationalUnitView organizationalUnit in organizationalUnits)
                {
                    G_JSTree parent = new G_JSTree();
                    parent.data = organizationalUnit.Title;
                    parent.state = "closed";
                    parent.IdServerUse = 10;
                    parent.attr = new G_JsTreeAttribute { id = "0" + organizationalUnit.Id.ToString(), selected = false, isOrganizationUnit = true };

                    list.Add(parent);
                }
            }
            else
            {
                List<EmployeeView> employees = new List<EmployeeView>();
                if (contractTemplateId != "0")
                {
                    employees = new EmployeeMapper().ListWithAdvancedFilterByContractPreffix("", "", "", Convert.ToInt32(id), "", StatusEnum.Active, Convert.ToInt32(contractTemplateId));
                }
                else
                {
                    employees = new EmployeeMapper().ListWithAdvancedFilterByContractPreffix("", "", "", Convert.ToInt32(id), "", StatusEnum.Active, null);
                }
                foreach (EmployeeView employee in employees)
                {
                    G_JSTree child = new G_JSTree();
                    child.data = employee.ToString();
                    child.state = "closed";
                    child.IdServerUse = 10;
                    child.children = null;
                    child.attr = new G_JsTreeAttribute { id = employee.Id.ToString(), selected = false, isOrganizationUnit = false };
                    list.Add(child);
                }
            }

            return list;
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["EmployeeId"] == null || Request.QueryString["ContractTemplateId"] == null)
            {
                Response.Redirect("List.aspx");
            }
            if (!IsPostBack)
            {
                ContractTemplateEntity ctemplate = new ContractTemplateMapper()
                    .Get(Convert.ToInt32(Request.QueryString["ContractTemplateId"]));

                ContractTypeHeaderText.Text = "(" + ctemplate.Title + " Contract)";
                ContractTemplateTitleLabel.InnerText = ctemplate.Title;

                string s = DateTime.Now.ToString("dd.MM.yyyy");
                s = s.Replace(".", "");

                EmployeeView employeeView = new EmployeeView();
                employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(Request.QueryString["EmployeeId"]) });

                ContractNumberTextBox.Text = employeeView.EmployeeNo.Replace("AKP", "") + " / " + ctemplate.Preffix + " / " + s;
            }
            Generate();
        }
Ejemplo n.º 5
0
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            JobDetailsSessionView jbs = new JobDetailsSessionView();
            if (Session["JobDetails"] != null)
            {
                jbs = (JobDetailsSessionView)Session["JobDetails"];
                if (jbs.IsGenerated != false)
                {
                    ContractEntity entity = new ContractEntity();
                    entity.ContractNumber = ContractNumberTextBox.Text;
                    entity.ContractTemplateTitle = jbs.ContractsTemplates[0].Title;

                    entity.OrganizationalUnitId = jbs.OrganisationalUnit.Id;
                    entity.OrganizationalUnitTitle = jbs.OrganisationalUnit.Title;
                    entity.JobCode = jbs.Job.Code;
                    entity.JobTitle = jbs.Job.Title;
                    entity.GradeId = jbs.Grade.Id;

                    #warning changed review and edit

                    //entity.GradeKCB = jbs.Grade.KCB;
                    //entity.GradeEntry = jbs.Grade.Entry;
                    entity.StepId = jbs.Step.Id;
                    //entity.StepEntry = jbs.Step.Entry;
                    entity.OfficiallyApprovedDate = DateTime.Now;
                    entity.FunctionalLevelId = jbs.FunctionalLevel.Id;
                    entity.FunctionalLevelTitle = jbs.FunctionalLevel.Title;
                    entity.EmployeeId = Convert.ToInt32(Request.QueryString["EmployeeId"]);

                    DateTime dt;
                    if (DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
                    {
                        entity.StartDate = dt;
                    }
                    if (DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt) == true)
                    {
                        entity.EndDate = dt;
                        entity.Type = ContractType.Limited;

                        TimeSpan span = entity.EndDate.Value.Subtract(entity.StartDate);
                        double years = span.TotalDays / 365;
                        if (years > 10)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.Append("<script language='javascript'>displayNoty('The contract that is not idifinite cannot be for more than 10 years.');</script>");

                            // if the script is not already registered
                            if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))
                                ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString());

                            return;
                        }
                    }
                    else
                    {
                        entity.Type = ContractType.Permanent;
                    }
                    entity.GrossValue = entity.GradeEntry + entity.StepEntry;

                    EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(Request.QueryString["EmployeeId"]) });
                    entity.EmployeeNo = employeeView.EmployeeNo;
                    entity.EmployeeFirstname = employeeView.Firstname;
                    entity.EmployeeLastname = employeeView.Lastname;
                    entity.EmployeePersonalNumber = employeeView.PersonalNumber;

                    entity.ContractStatus = ContractStatus.Aproved;
                    entity.NextContractNumber = "";
                    entity.Status = StatusEnum.Active;

                    entity.Content.ContentStatus = StatusEnum.Active;

                    new ContractMapper().Insert(entity);

                    foreach(LanguageEntity lang in new LanguageMapper().ListForContractTemplate(Convert.ToInt32(Request.QueryString["ContractTemplateId"])))
                    {
                        ContractContentEntity contentEntity = new ContractContentEntity();
                        contentEntity.Content = ((CKEditor.NET.CKEditorControl)contractVersion.FindControl(lang.Title)).Text;
                        contentEntity.ContractNumber = entity.ContractNumber;
                        contentEntity.LanguageId = lang.Id;
                        new ContractMapper().InsertContent(contentEntity);
                    }

                    jbs.ContractsTemplates.Remove(jbs.ContractsTemplates.Where(s => s.Id == Convert.ToInt32(Request.QueryString["ContractTemplateId"])).First());
                    if (jbs.ContractsTemplates.Count != 0)
                    {
                        Response.Redirect("Contract.aspx?EmployeeId=" + Request.QueryString["EmployeeId"] + "&ContractTemplateId=" + jbs.ContractsTemplates[0].Id);
                    }
                    else
                    {
                        Response.Redirect("Details.aspx?EmployeeId=" + Request.QueryString["EmployeeId"]);
                    }
                }
            }

            Response.Redirect("List.aspx");
        }
Ejemplo n.º 6
0
        private void GenerateContractVersions(string LanguageTitle, ContractTemplateEntity cte)
        {
            HtmlGenericControl parent = new HtmlGenericControl("div");
            parent.Attributes.Add("width", "100%");
            parent.Attributes.Add("clear", "both");

            HtmlGenericControl h2 = new HtmlGenericControl("h2");
            h2.Attributes.Add("id", LanguageTitle + "Title");

            HtmlGenericControl font = new HtmlGenericControl("font");
            font.Attributes.Add("color", "#707070");

            HtmlGenericControl strong = new HtmlGenericControl("strong");

            Label text = new Label();
            text.Text = LanguageTitle + " Version ";

            HyperLink link = new HyperLink();
            link.ID = LanguageTitle + "ShowHyperLink";
            link.CssClass = "fltrht employeeLinkLast employeeLink employeeLinkWithoutEm";
            link.Text = "Show";

            strong.Controls.Add(text);
            font.Controls.Add(strong);
            h2.Controls.Add(font);
            h2.Controls.Add(link);

            HtmlGenericControl container = new HtmlGenericControl("div");
            container.Attributes.Add("id", (LanguageTitle + "Div"));
            container.Attributes.Add("style", "display:none");

            CKEditor.NET.CKEditorControl ckEditor = new CKEditor.NET.CKEditorControl();
            ckEditor.ID = LanguageTitle;
            ckEditor.Height = 500;
            ckEditor.BasePath = "~/ckeditor";
            ckEditor.ReadOnly = true;
            ckEditor.FilebrowserBrowseUrl = "/HRM/ckfinder/ckfinder.html";
            ckEditor.FilebrowserImageBrowseUrl = "/HRM/ckfinder/ckfinder.html?type=Images";
            ckEditor.FilebrowserImageUploadUrl = "/HRM/ckfinder/core/connector/aspx/connector.aBspx?command=QuickUpload&type=Images";
            ckEditor.config.toolbar = new object[]
                {
                    new object[] { "Print"}
                };

            ckEditor.Text = cte.Content;

            #region replaceContractTemplate

            JobDetailsSessionView jbs = (JobDetailsSessionView)Session["JobDetails"];
            jbs.IsGenerated = true;

            EmployeeView employeeView = new EmployeeView();
            employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(Request.QueryString["EmployeeId"]) });

            ckEditor.Text = ckEditor.Text.Replace(@"{#ContractNumber}", ContractNumberTextBox.Text);
            DateTime dt;
            if (DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#StartDate}", dt.ToString("dd.MM.yyyy"));
            }
            if (DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#EndDate}", dt.ToString("dd.MM.yyyy"));
            }
            else
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#EndDate}", "");
            }

            ckEditor.Text = new GUIHelper().ReplaceTemplateContractWithConcreteContract(ckEditor.Text, jbs, employeeView);

            #endregion

            container.Controls.Add(ckEditor);

            parent.Controls.Add(h2);
            parent.Controls.Add(container);

            contractVersion.Controls.Add(parent);

            StringBuilder sb = new StringBuilder();

            sb.Append("<script language='javascript'>");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').click(function () {");
            sb.Append("\n");
            sb.Append("if($('#" + link.ClientID + "').text() == 'Hide') {");
            sb.Append("\n");
            sb.Append("$('#" + container.ClientID + "').fadeOut('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Show'); }");
            sb.Append("\n");
            sb.Append("else { $('#" + container.ClientID + "').fadeIn('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Hide');");
            sb.Append("\n");
            sb.Append("$('html,body').animate({ scrollTop: $('#" + container.ClientID + "').offset().top }, 'slow'); } });");
            sb.Append("\n");
            sb.Append("</script>");

            // if the script is not already registered
            if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), ("HeyPopup" + LanguageTitle)))
                ClientScript.RegisterStartupScript(Page.GetType(), ("HeyPopup" + LanguageTitle), sb.ToString());
        }
Ejemplo n.º 7
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;
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public CascadingDropDownNameValue[] GetEmployeesByOrganisationalUnit(string knownCategoryValues, string category)
        {
            StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);

            List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

            int organisationalId;
            if (!kv.ContainsKey("OrganizationalUnit") ||
            !Int32.TryParse(kv["OrganizationalUnit"], out organisationalId))
            {
            #warning change this code to get ur organisation unit and also do not display yourself
                //Get my organizational unit
                int myorganizationUnit = 20;
                List<EmployeeView> list = new EmployeeMapper().ListWithAdvancedFilter("", "", null, myorganizationUnit, null, StatusEnum.Active);
                foreach (EmployeeView ent in list)
                {
                    CascadingDropDownNameValue cdnv = new CascadingDropDownNameValue(ent.ToString(), ent.Id.ToString());
                    values.Add(cdnv);
                }
            }
            else
            {
                List<EmployeeView> list = new EmployeeMapper().ListWithAdvancedFilter("", "", null, organisationalId, null, StatusEnum.Active);
                foreach (EmployeeView ent in list)
                {
                    CascadingDropDownNameValue cdnv = new CascadingDropDownNameValue(ent.ToString(), ent.Id.ToString());
                    values.Add(cdnv);
                }
            }
            return values.ToArray();
        }
Ejemplo n.º 9
0
        public string[] GetEmployees(string prefixText, int count)
        {
            List<string> results = new List<string>();

            List<EmployeeView> list = new EmployeeMapper().ListWithAdvancedFilter("", prefixText, "", null, "", StatusEnum.Active);

            foreach (EmployeeView e in list)
            {
                results.Add(e.ToString() + " - " + e.EmployeeNo);
            }

            return results.ToArray();
        }
Ejemplo n.º 10
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();
                }
            }
        }
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            string strings = jsfields.Value;
            StringBuilder stb = new StringBuilder();
            stb.Append("employeeId=");
            stb.Append(strings);

            List<string> list = strings.Split(',').ToList();

            DateTime startdt;
            DateTime enddt;
            DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out startdt);
            DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out enddt);

            foreach (string s in list)
            {
                if (!s.StartsWith("0"))
                {
                    int i = Convert.ToInt32(s);

                    EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(s) });

                    ContractEntity lastContract = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = employeeView.Id });

            #warning change the 1 value parameter of getContentById
                    ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(ContractTemplateDropDownList.SelectedValue), 1);

                    JobDetailsSessionView jsv = new JobDetailsSessionView();
                    CurrentJobDetailsEntity cjde = new CurrentJobDetailsMapper().Get(new CurrentJobDetailsEntity() { EmployeeId = employeeView.Id, ContractNumber = (employeeView.Id + " / " + cte.Preffix) });

                    jsv.FunctionalLevel.Id = cjde.FunctionalLevelId;
                    jsv.FunctionalLevel.Title = cjde.FunctionalLevelTitle;

                    jsv.Grade.Id = cjde.GradeId;
                    jsv.Grade = new GradeMapper().Get(jsv.Grade);

                    jsv.Job.Code = cjde.JobCode;
                    jsv.Job.Title = cjde.JobTitle;

                    jsv.OrganisationalUnit.Id = cjde.OrganizationalUnitId;
                    jsv.OrganisationalUnit.Title = cjde.OrganizationalUnitTitle;

                    #warning changed review and edit

                    jsv.Step.Id = cjde.StepId;
                    //jsv.Step.Entry = cjde.StepEntry;

                    if (RadioButtonList1.SelectedItem.Value != "1")
                    {
                        AmandamentTemplateEntity amte = new AmandamentTemplateMapper().GetContentById(Convert.ToInt32(RadioButtonList1.SelectedValue), null);
                        AmandamentEntity am = new AmandamentEntity(cjde);

                        am.Status = StatusEnum.Active;

                        am.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(amte.Content, jsv, employeeView);
                        am.ContractNumber = cjde.ContractNumber;
                        am.Content.Content = am.Content.Content.Replace(@"{#ContractNumber}", am.ContractNumber);
                        am.StartDate = startdt;

                        #warning check for contract type Probation if this is first contract it is probation and also check if it is special contract

                        if (enddt != null)
                        {
                            am.EndDate = enddt;
                            am.Type = ContractType.Limited;

                            TimeSpan span = am.EndDate.Value.Subtract(am.StartDate);
                            double years = span.TotalDays / 365;
                            if (years > 10)
                            {
                                StringBuilder sb = new StringBuilder();
                                sb.Append("<script language='javascript'>displayNoty('The amandment that is not for idifinite period cannot be for more than 10 years.');</script>");

                                // if the script is not already registered
                                if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))
                                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString());

                                return;
                            }
                        }
                        else
                        {
                            am.Type = ContractType.Permanent;
                        }

                        new AmandamentMapper().Insert(am, employeeView.Id);
                    }
                    else
                    {
                        ContractEntity ct = new ContractEntity(cjde, employeeView);
                        ct.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(cte.Content, jsv, employeeView);

                        string dt = DateTime.Now.ToString("dd.MM.yyyy");
                        dt = dt.Replace(".", "");
                        ct.ContractNumber = (employeeView.EmployeeNo.Replace("AKP", "") + " / " + cte.Preffix + " / " + dt);

                        ct.Status = StatusEnum.Active;
                        ct.ContractStatus = ContractStatus.Aproved;
                        ct.OfficiallyApprovedDate = DateTime.Now;
                        ct.ContractTemplateTitle = cte.Preffix;

                        ct.Content.Content = ct.Content.Content.Replace(@"{#ContractNumber}", ct.ContractNumber);

                        ct.StartDate = startdt;
                        if (enddt != null)
                        {
                            ct.EndDate = enddt;
                            ct.Type = ContractType.Limited;

                            TimeSpan span = ct.EndDate.Value.Subtract(ct.StartDate);
                            double years = span.TotalDays / 365;
                            if (years > 10)
                            {
                                StringBuilder sb = new StringBuilder();
                                sb.Append("<script language='javascript'>displayNoty('The contract that is not for idifinite period cannot be for more than 10 years.');</script>");

                                // if the script is not already registered
                                if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))
                                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString());

                                return;
                            }
                        }
                        else
                        {
                            ct.Type = ContractType.Permanent;
                        }

            #warning bug please check

                        //new ContractMapper().Insert(ct);

            #warning this dosent exists why
                        //new ContractMapper().UpdatePreviousContract(new ContractEntity() { ContractNumber = lastContract.ContractNumber, NextContractNumber = ct.ContractNumber, ContractStatus = Entities.ContractStatus.Changed, Status = StatusEnum.Pasive });
                    }

                }
            }
            if (RadioButtonList1.SelectedItem.Value != "1")
            {
                Response.Redirect("Print.aspx?" + stb + "&type=newAmandament");

            }
            else
            {
                Response.Redirect("Print.aspx?" + stb + "&type=newContract");
            }
        }
Ejemplo n.º 12
0
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            string strings = jsfields.Value;
            StringBuilder stb = new StringBuilder();
            stb.Append("employeeId=");
            stb.Append(strings);

            List<string> list = strings.Split(',').ToList();

            foreach (string s in list)
            {
                if (!s.StartsWith("0"))
                {
                    int i = Convert.ToInt32(s);

                    EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(s) });

                    ContractEntity lastContract = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = employeeView.Id });

                    #warning change the 1 value parameter of getContentById
                    ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(ContractTemplateDropDownList.SelectedValue), 1);

                    JobDetailsSessionView jsv = new JobDetailsSessionView();
                    CurrentJobDetailsEntity cjde = new CurrentJobDetailsMapper().Get(new CurrentJobDetailsEntity() { EmployeeId = employeeView.Id, ContractNumber = (employeeView.Id + " / " + cte.Preffix) });

                    jsv.FunctionalLevel.Id = cjde.FunctionalLevelId;
                    jsv.FunctionalLevel.Title = cjde.FunctionalLevelTitle;

                    jsv.Grade.Id = cjde.GradeId;
                    jsv.Grade = new GradeMapper().Get(jsv.Grade);

                    jsv.Job.Code = cjde.JobCode;
                    jsv.Job.Title = cjde.JobTitle;

                    jsv.OrganisationalUnit.Id = cjde.OrganizationalUnitId;
                    jsv.OrganisationalUnit.Title = cjde.OrganizationalUnitTitle;

                    jsv.Step.Id = cjde.StepId;
            #warning changed review and edit
                    //jsv.Step.Entry = cjde.StepEntry;

                    if (RadioButtonList1.SelectedItem.Value != "1")
                    {
                        AmandamentTemplateEntity amte = new AmandamentTemplateMapper().GetContentById(Convert.ToInt32(RadioButtonList1.SelectedValue), null);
                        AmandamentEntity am = new AmandamentEntity(cjde);

                        am.Status = StatusEnum.Active;

                        am.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(amte.Content, jsv, employeeView);
                        am.ContractNumber = cjde.ContractNumber;
                        am.Content.Content = am.Content.Content.Replace(@"{#ContractNumber}", am.ContractNumber);

                        new AmandamentMapper().Insert(am, employeeView.Id);
                    }
                    else
                    {
                        ContractEntity ct = new ContractEntity(cjde, employeeView);
                        ct.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(cte.Content, jsv, employeeView);

                        string dt = DateTime.Now.ToString("dd.MM.yyyy");
                        dt = dt.Replace(".", "");
                        ct.ContractNumber = (employeeView.EmployeeNo.Replace("AKP", "") + " / " + cte.Preffix + " / " + dt);

                        ct.Status = StatusEnum.Active;
                        ct.ContractStatus = ContractStatus.Aproved;
                        ct.OfficiallyApprovedDate = DateTime.Now;
                        ct.ContractTemplateTitle = cte.Preffix;

                        ct.Content.Content = ct.Content.Content.Replace(@"{#ContractNumber}", ct.ContractNumber);
                        new ContractMapper().Insert(ct);
                        new ContractMapper().UpdatePreviousContract(new ContractEntity() { ContractNumber = lastContract.ContractNumber, NextContractNumber = ct.ContractNumber, ContractStatus = Entities.ContractStatus.Changed });
                    }

                }
            }
            if (RadioButtonList1.SelectedItem.Value != "1")
            {
                Response.Redirect("Print.aspx?" + stb + "&type=newAmandament");

            }
            else
            {
                Response.Redirect("Print.aspx?" + stb + "&type=newContract");
            }
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EmployeeNoTextBox.Text = new EmployeeMapper().GenerateEmployeeNo("AKP", "AKP");
                DateOfBirthTextBox.ToolTip = "Format: " + ConfigurationManager.AppSettings["DateFormat"];
                DateOfBirthRegularExpressionValidator.ErrorMessage = "The birth date format must be {" + ConfigurationManager.AppSettings["DateFormat"] + " }";
                DateOfBirthRegularExpressionValidator.ValidationExpression = ConfigurationManager.AppSettings["DateValidationExpression"];
            }

            if (Request.QueryString["action"] == "update" && Request.QueryString["EmployeeId"] != null)
            {
                if (!IsPostBack)
                {
                    EmployeeView view = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(Request.QueryString["EmployeeId"]) });
                    EmployeeNoTextBox.Text = view.EmployeeNo;
                    PersonalNumberTextBox.Text = view.PersonalNumber;
                    FirstnameTextBox.Text = view.Firstname;
                    LastnameTextBox.Text = view.Lastname;
                    GenderDropDownList.Text = view.Gender.ToString();
                    MiddlenameTextBox.Text = view.Middlename;
                    DateOfBirthTextBox.Text = view.DateOfBirth.ToString(ConfigurationManager.AppSettings["DateFormat"]);
                    NationalityDropDownList.Text = view.Nationality;

                    CountryCascadingDropDown.ContextKey = view.Country;
                    GenderCascadingDropDown.ContextKey = view.Gender.ToString();
                    NationalityCascadingDropDown.ContextKey = view.Nationality;
                    BankCascadingDropDown.ContextKey = view.Bank;
                    MaritalStatusCascadingDropDown.ContextKey = view.MaritalStatus.ToString();

                    CityTextBox.Text = view.City;
                    AddressTextBox.Text = view.Address;
                    MobilePhoneTextBox.Text = view.MobilePhone;
                    OtherEmailTextBox.Text = view.OtherEmail;
                    WorkEmailTextBox.Text = view.WorkEmail;
                    AccountNumberTextBox.Text = view.AccountNumber;

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

            }

            if (Request.QueryString["preview"] == "1")
            {
                if (Session["fileContents_"] != null)
                {
                    byte[] fileContents = (byte[])Session["fileContents_"];
                    if (fileContents.Length != 0)
                    {
                        Response.Clear();
                        Response.ContentType = "fileContentType_";
                        Response.BinaryWrite(fileContents);
                        Response.End();
                    }
                }
            }
        }
Ejemplo n.º 14
0
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            EmployeeEntity entity = new EmployeeEntity();
            entity.EmployeeNo = EmployeeNoTextBox.Text;
            entity.Firstname = FirstnameTextBox.Text;
            entity.Middlename = "";
            entity.Middlename = MiddlenameTextBox.Text;
            entity.Lastname = LastnameTextBox.Text;

            DateTime dt;
            if (DateTime.TryParseExact(DateOfBirthTextBox.Text, ConfigurationManager.AppSettings["DateFormat"], null, System.Globalization.DateTimeStyles.None, out dt))
            {
                entity.DateOfBirth = dt;
            }

            entity.Gender = (GenderEnum)Convert.ToInt32(GenderDropDownList.SelectedValue);
            entity.NationalityId = Convert.ToInt32(NationalityDropDownList.SelectedValue);
            entity.CountryId = Convert.ToInt32(CountryDropDownList.SelectedValue);
            entity.Address = AddressTextBox.Text;
            entity.PersonalNumber = PersonalNumberTextBox.Text;
            entity.WorkEmail = WorkEmailTextBox.Text;
            entity.MobilePhone = MobilePhoneTextBox.Text;
            entity.OtherEmail = OtherEmailTextBox.Text;
            entity.City = CityTextBox.Text;
            entity.BankId = Convert.ToInt32(BankDropDownList.SelectedValue);
            entity.AccountNumber = AccountNumberTextBox.Text;
            entity.MaritalStatus = (MaritalStatusEnum)Convert.ToInt32(MaritalStatusDropDownList.SelectedValue);

            if (Session["fileContents_"] != null)
            {
                byte[] fileContents = (byte[])Session["fileContents_"];
                entity.Image = fileContents;
            }

            EmployeeMapper mapper = new EmployeeMapper();

            try
            {
                if (Request.QueryString["action"] == "update" && Request.QueryString["EmployeeId"] != null)
                {
                    entity.Id = Convert.ToInt32(Request.QueryString["EmployeeId"]);
                    mapper.Update(entity);
                    Response.Redirect("EducationAndExperience.aspx?action=update&EmployeeId=" + entity.Id);
                }
                else
                {
                    ReminderEntity reminder = new ReminderEntity();
                    reminder.EntityPK = entity.Id.ToString();
                    reminder.EntityPKType = typeof(int).ToString();
                    reminder.ReminderType = ReminderEnum.EmployeeNoContract;
                    reminder.Url = "/HRM/HR-Managment/Employee/EmployeesWithoutContract.aspx";
                    new EmployeeMapperTransaction().InsertWithReminder(entity, reminder);
                    Response.Redirect("EducationAndExperience.aspx?EmployeeId=" + entity.Id);
                }
            }
            catch (SqlException ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<script language='javascript'>displayNoty('The Employee No { " + EmployeeNoTextBox.Text + " } has been used, plase write another number');</script>");

                // if the script is not already registered
                if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))
                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString());
            }
            finally
            {
            }
        }