Ejemplo n.º 1
0
        public ContractTemplateEntity Get(int Id)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_GetContractTemplateById", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@ContractTemplateId", Id);

                SqlDataReader rdr = cmd.ExecuteReader();
                ContractTemplateEntity content = new ContractTemplateEntity();

                while (rdr.Read())
                {
                    content.Id = Convert.ToInt32(rdr["Id"]);
                    content.Title = Convert.ToString(rdr["Title"]);
                    content.Preffix = Convert.ToString(rdr["Preffix"]);
                    content.Status = (StatusEnum)Convert.ToInt32(rdr["Status"]);
                    content.LeaveDaysPerMonth = Convert.ToDouble(rdr["LeaveDaysPerMonth"]);
                    content.LeaveDaysPerYearExperience = Convert.ToDouble(rdr["LeaveDaysPerYearExperience"]);
                    content.DaysCarriedForwardPerYear = Convert.ToDouble(rdr["DaysCarriedForwardPerYear"]);
                }

                return content;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
Ejemplo n.º 2
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.º 3
0
        public ContractTemplateEntity GetContentById(int ContractTemplateId, int LanguageId)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_GetContractTemplateContentById", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@ContractTemplateId", ContractTemplateId);
                cmd.Parameters.AddWithValue("@LanguageId", LanguageId);

                SqlDataReader rdr = cmd.ExecuteReader();
                ContractTemplateEntity content = new ContractTemplateEntity();

                while (rdr.Read())
                {
                    content.Id = Convert.ToInt32(rdr["ContractTemplateId"]);
                    content.Title = Convert.ToString(rdr["Title"]);
                    content.Preffix = Convert.ToString(rdr["Preffix"]);
                    content.LanguageId = Convert.ToInt32(rdr["LanguageId"]);
                    content.Content = Convert.ToString(rdr["Content"]);
                }

                return content;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
Ejemplo n.º 4
0
        public void Update(ContractTemplateEntity t)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_UpdateContractTemplate", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Id", t.Id);
                cmd.Parameters.AddWithValue("@Title", t.Title);
                cmd.Parameters.AddWithValue("@Preffix", t.Preffix);
                cmd.Parameters.AddWithValue("@Status", t.Status);
                cmd.Parameters.AddWithValue("@LanguageId", t.LanguageId);
                cmd.Parameters.AddWithValue("@Content", t.Content);
                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
Ejemplo n.º 5
0
        public List<ContractTemplateEntity> ListWithAdvancedFilter(string search, StatusEnum? status)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_ListContractsTemplates", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Search", search);

                if (status != null)
                {
                    cmd.Parameters.AddWithValue("@Status", status);
                }

                SqlDataReader rdr = cmd.ExecuteReader();
                List<ContractTemplateEntity> list = new List<ContractTemplateEntity>();

                while (rdr.Read())
                {
                    ContractTemplateEntity entity = new ContractTemplateEntity();
                    entity.Id = Convert.ToInt32(rdr["Id"]);
                    entity.Title = Convert.ToString(rdr["Title"]);
                    entity.Preffix = Convert.ToString(rdr["Preffix"]);
                    entity.Status = (StatusEnum)Convert.ToInt32(rdr["Status"]);

                    list.Add(entity);
                }

                return list;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
Ejemplo n.º 6
0
        public void Insert(ContractTemplateEntity t)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = DALHelper.CreateSqlDbConnection();
                cmd = new SqlCommand("usp_InsertContractTemplate", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Title", t.Title);
                cmd.Parameters.AddWithValue("@Preffix", t.Preffix);
                cmd.Parameters.AddWithValue("@Status", t.Status);
                cmd.Parameters.AddWithValue("@LanguageId", t.LanguageId);
                cmd.Parameters.AddWithValue("@Content", t.Content);
                cmd.Parameters.AddWithValue("@LeaveDaysPerMonth", t.LeaveDaysPerMonth);
                cmd.Parameters.AddWithValue("@LeaveDaysPerYearExperience", t.LeaveDaysPerYearExperience);
                cmd.Parameters.AddWithValue("@DaysCarriedForwardPerYear", t.DaysCarriedForwardPerYear);

                t.Id = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
                cmd.Dispose();
                conn.Dispose();
            }
        }
Ejemplo n.º 7
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());
                }
            }
        }