예제 #1
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();
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session.Remove("ContractTemplatePreData");
            Session.Remove("BackStack");

            Stack <string> stack = new Stack <string>();

            if (!stack.Contains(Request.Url.PathAndQuery))
            {
                stack.Push(Request.Url.PathAndQuery.ToString());
            }
            Session.Add("BackStack", stack);

            if (!IsPostBack)
            {
                if (Request.QueryString["ContractTemplateId"] != null)
                {
                    int ContractTemplateId = Convert.ToInt32(Request.QueryString["ContractTemplateId"]);

                    ContractTemplateEntity entity = new ContractTemplateMapper()
                                                    .Get(ContractTemplateId);
                    LeaveDaysPerMonthTextBox.Text       = entity.LeaveDaysPerMonth.ToString();
                    LeaveDaysPerExperienceTextBox.Text  = entity.LeaveDaysPerYearExperience.ToString();
                    LeaveDaysCarriedForwardTextBox.Text = entity.DaysCarriedForwardPerYear.ToString();
                }
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["ContractTemplateId"] != null)
            {
                int contractTemplateId = Convert.ToInt32(Request.QueryString["ContractTemplateId"]);

                ContractTemplateEntity contract = new ContractTemplateMapper().Get(contractTemplateId);
                ContractTemplateTitleLabel.InnerText = contract.Title;
                ContractPreffixLabel.InnerText       = contract.Preffix;
                LeaveDaysPerMonthLabel.InnerText     = contract.LeaveDaysPerMonth.ToString();
                ExpLeaveDaysPerYearLabel.InnerText   = contract.LeaveDaysPerYearExperience.ToString();
                DaysCarriedForwardLabel.InnerText    = contract.DaysCarriedForwardPerYear.ToString();

                List <LanguageEntity> langs = new LanguageMapper().ListForContractTemplate(contractTemplateId);
                foreach (LanguageEntity ent in langs)
                {
                    ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(contractTemplateId, ent.Id);
                    GenerateContractVersions(ent.Title, cte);
                }

                GenerateButton("List.aspx");
            }
            else
            {
                Response.Redirect("List.aspx");
            }
        }
예제 #4
0
        private void Generate()
        {
            List <LanguageEntity> langs = new LanguageMapper().ListForContractTemplate(Convert.ToInt32(Request.QueryString["ContractTemplateId"]));

            foreach (LanguageEntity ent in langs)
            {
                ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(Request.QueryString["ContractTemplateId"]), ent.Id);
                GenerateContractVersions(ent.Title, cte);
            }

            GenerateButtons();
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Stack <string> stack = (Stack <string>)Session["BackStack"];

            if (!stack.Contains(Request.Url.PathAndQuery))
            {
                stack.Push(Request.Url.PathAndQuery.ToString());
            }

            Session["BackStack"] = stack;

            if (Session["ContractTemplatePreData"] == null || Request.QueryString["LanguageId"] == null)
            {
                Session.Remove("ContractTemplatePreData");
                Response.Redirect("List.aspx");
            }

            if (!IsPostBack)
            {
                if (Request.QueryString["ContractTemplateId"] != null)
                {
                    ContractTemplateEntity ent = new ContractTemplateMapper().Get(Convert.ToInt32(Request.QueryString["ContractTemplateId"]));
                    ContractTemplateTitleBox.Text = ent.Title;
                    ContractPreffixTextBox.Text   = ent.Preffix;
                }
            }

            LanguageEntity lang = new LanguageMapper().Get(Convert.ToInt32(Request.QueryString["LanguageId"]));

            LanguageLabel.Text = lang.Title;

            string s = CKEditor1.Text;

            if (!IsPostBack)
            {
                CKEditor1.config.toolbar = new object[]
                {
                    new object[] { "Save", "NewPage", "Preview" },
                    new object[] { "Cut", "Copy", "Paste", "PasteText", "PasteFromWord", "-", "Print", "SpellChecker" },
                    new object[] { "Undo", "Redo", "-", "Find", "Replace", "-", "SelectAll" },
                    "/",
                    new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript" },
                    new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent", "Blockquote" },
                    new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" },
                    new object[] { "BidiLtr", "BidiRtl" },
                    new object[] { "Image", "Table", "HorizontalRule", "SpecialChar", "PageBreak" },
                    "/",
                    new object[] { "Styles", "Format", "Font", "FontSize" },
                    new object[] { "TextColor", "BGColor" },
                    new object[] { "Maximize", "ShowBlocks" }
                };
            }
        }
예제 #6
0
        public CascadingDropDownNameValue[] GetContractsTemplates(string knownCategoryValues, string category)
        {
            List <CascadingDropDownNameValue> values = new List <CascadingDropDownNameValue>();

            List <ContractTemplateEntity> list = new ContractTemplateMapper().ListWithAdvancedFilter("", StatusEnum.Active);

            foreach (ContractTemplateEntity ent in list)
            {
                CascadingDropDownNameValue cdnv = new CascadingDropDownNameValue(ent.Title, ent.Id.ToString());
                values.Add(cdnv);
            }

            return(values.ToArray());
        }
예제 #7
0
        public CascadingDropDownNameValue[] GetContractTemplatesFromCurrentJobDetails(string knownCategoryValues, string category, string contextKey)
        {
            List <CascadingDropDownNameValue> values = new List <CascadingDropDownNameValue>();

            Dictionary <int, string> list = new ContractTemplateMapper().ListTemplateContractsFromCurrentJobDetails();

            foreach (KeyValuePair <int, string> kvp in list)
            {
                CascadingDropDownNameValue cdnv;

                cdnv = new CascadingDropDownNameValue(kvp.Value, kvp.Key.ToString());
                values.Add(cdnv);
            }

            return(values.ToArray());
        }
예제 #8
0
        protected void ProceedButton_Click(object sender, EventArgs e)
        {
            if (CKEditor1.Text != "")
            {
                ContractTemplatePreDataSessionView view = (ContractTemplatePreDataSessionView)Session["ContractTemplatePreData"];

                ContractTemplateEntity entity = new ContractTemplateEntity();
                entity.Content                    = CKEditor1.Text;
                entity.Title                      = ContractTemplateTitleBox.Text;
                entity.Preffix                    = ContractPreffixTextBox.Text;
                entity.Status                     = StatusEnum.Active;
                entity.LeaveDaysPerMonth          = view.LeaveDaysPerMonth;
                entity.LeaveDaysPerYearExperience = view.LeaveDaysPerYearExperience;
                entity.DaysCarriedForwardPerYear  = view.DaysCarriedForward;
                entity.LanguageId                 = Convert.ToInt32(Request.QueryString["LanguageId"]);

                ContractTemplateMapper mapper = new ContractTemplateMapper();

                if (Request.QueryString["ContractTemplateId"] != null)
                {
                    entity.Id = Convert.ToInt32(Request.QueryString["ContractTemplateId"]);
                    mapper.InsertContentForLanguage(entity);
                }
                else
                {
                    mapper.Insert(entity);

                    foreach (HolidayGroupEntity en in view.HolidayGroups)
                    {
                        new HolidayGroupMapper().InsertForContractTemplate(en, entity.Id);
                    }
                }

                if (view.Languages.Count > 0)
                {
                    int languageId = view.Languages[0].Id;
                    view.Languages.RemoveAt(0);
                    Response.Redirect("Edit.aspx?LanguageId=" + languageId + "&ContractTemplateId=" + entity.Id.ToString());
                }
                else
                {
                    Session.Remove("ContractTemplatePreData");
                    Response.Redirect("PayScale.aspx?ContractTemplateId=" + entity.Id.ToString());
                }
            }
        }
예제 #9
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");
            }
        }
예제 #10
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();

            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");
            }
        }