Exemple #1
0
        public string ReplaceTemplateContractWithConcreteContract(string content, JobDetailsSessionView jbs, EmployeeView employeeView)
        {
            //Employee
            content = content.Replace(@"{#EmployeeName}", employeeView.ToString());
            content = content.Replace(@"{#EmployeeNo}", employeeView.EmployeeNo);
            content = content.Replace(@"{#DateOfBirth}", employeeView.DateOfBirth.ToString("dd.MM.yyyy"));
            content = content.Replace(@"{#PersonalNo}", employeeView.PersonalNumber);
            content = content.Replace(@"{#Gender}", employeeView.Gender.ToString());
            content = content.Replace(@"{#Address}", employeeView.Address);
            content = content.Replace(@"{#Country}", employeeView.Country);

            //JobTitle
            content = content.Replace(@"{#JobCode}", jbs.Job.Code);
            content = content.Replace(@"{#JobTitle}", jbs.Job.Title);
            content = content.Replace(@"{#OrganisationalUnit}", jbs.OrganisationalUnit.Title);
            #warning changed please review and edit
            //content = content.Replace(@"{#GradeKCB}", jbs.Grade.KCB.ToString("f2"));
            content = content.Replace(@"{#Step}", jbs.Step.Id);
            //content = content.Replace(@"{#StepEntry}", jbs.Step.Entry.ToString("f2"));
            content = content.Replace(@"{#Step}", jbs.Step.Id);
            content = content.Replace(@"{#Grade}", jbs.Grade.Id);
            content = content.Replace(@"{#JobDescription}", jbs.Job.Description);
            //content = content.Replace(@"{#ReportsTo}", jbs.Job.Description);

            //Contract

            content = content.Replace(@"{#OfficiallyApprovedDate}", DateTime.Now.ToString("dd.MM.yyyy"));
            //content = content.Replace(@"{#GrossValue}", jbs.Job.Code);

            //General
            content = content.Replace(@"{#TodayDate}", DateTime.Now.ToString("dd.MM.yyyy"));
            content = content.Replace(@"{#Time}", DateTime.Now.ToString("HH:mm"));

            return(content);
        }
Exemple #2
0
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            JobDetailsSessionView jbs = new JobDetailsSessionView();

            FunctionalLevelEntity flentity = new FunctionalLevelEntity();

            flentity.Id         = Convert.ToInt32(FunctionalLevelDropDownList.SelectedValue);
            flentity            = new FunctionalLevelMapper().Get(flentity);
            jbs.FunctionalLevel = flentity;

            OrganizationalUnitEntity ouentity = new OrganizationalUnitEntity();

            ouentity.Id = Convert.ToInt32(OrganisationalUnitDropDownList.SelectedValue);
            OrganizationalUnitView ouView = new OrganizationalUnitMapper().Get(ouentity);

            jbs.OrganisationalUnit = ouView;

            GradeEntity gentity = new GradeEntity();

            gentity.Id = GradeDropDownList.SelectedValue;
            gentity    = new GradeMapper().Get(gentity);
            jbs.Grade  = gentity;

            JobTitleEntity job = new JobTitleEntity();

            job.JobCode = JobDetailsDropDownList.SelectedValue;
            JobTitleView jobview = new JobTitleMapper().Get(job);

            jbs.Job = jobview;

            StepEntity sentity = new StepEntity();

            sentity.Id = StepDropDownList.SelectedValue;
            sentity    = new StepMapper().Get(sentity);
            jbs.Step   = sentity;


            foreach (ListItem item in ContractsCheckBoxList.Items)
            {
                if (item.Selected == true)
                {
                    jbs.ContractsTemplates.Add(new ContractTemplateEntity()
                    {
                        Id = Convert.ToInt32(item.Value), Title = item.Text
                    });
                }
            }

            Session.Add("JobDetails", jbs);
            Response.Redirect("Contract.aspx?EmployeeId=" + Request.QueryString["EmployeeId"] + "&ContractTemplateId=" + jbs.ContractsTemplates[0].Id);
        }
Exemple #3
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");
            }
        }
        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");
            }
        }
Exemple #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");
        }
Exemple #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());
            }
        }