Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
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");
        }
        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");
            }
        }
        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");
            }
        }