protected void modalBtnSubmit_Command(object sender, CommandEventArgs e)
        {
            if (modalLabelError.Visible == true)
                this.programmaticModalPopup.Show();
            else
            {
                bool ischkBoxEmpty = IsDeptCheckBoxEmpty();
                int userid = Convert.ToInt32(Session["UserId"]);
                JobType jobtype = new JobType();
                if (modalLabelJobTypeId.Text.Trim() != "")
                {
                    jobtype = jobtype.GetJobType(Convert.ToInt32(modalLabelJobTypeId.Text));
                }
                jobtype.Description = modalTxtBoxDescription.Text.Trim();
                jobtype.Acronym = modalTxtBoxAcronym.Text.Trim();
                jobtype.Position = Convert.ToInt32(modalTxtBoxPosition.Text);
                jobtype.LastUpdateDate = DateTime.Now;
                jobtype.LastUpdatedBy = userid;
                //jobtype.DepartmentId = Convert.ToInt32(modalDropDownDepartment.SelectedItem.Value);
                if (modalChkBoxRequiredJobId.Checked == true)
                    jobtype.RequiredJobId = true;
                else
                    jobtype.RequiredJobId = false;
                if (modalChkBoxComputeTime.Checked == true)
                    jobtype.ComputeTime = true;
                else
                    jobtype.ComputeTime = false;
                if (modalChkBoxShowJobOverview.Checked == true)
                    jobtype.ShowInJobOverview = true;
                else
                    jobtype.ShowInJobOverview = false;
                if (e.CommandArgument.ToString() == "Add" && ischkBoxEmpty == false)
                {
                    jobtype.CreateDate = DateTime.Now;
                    jobtype.CreatedBy = userid;
                    jobtype.Insert(jobtype);
                    jobtype = jobtype.GetJobTypeByAcronym(modalTxtBoxAcronym.Text.Trim());
                    JobTypeDepartmentAction(jobtype.Id);
                    this.programmaticModalPopup.Hide();
                }
                else if (e.CommandArgument.ToString() == "Update" && ischkBoxEmpty == false)
                {
                    jobtype.Update(jobtype);
                    JobTypeDepartmentAction(jobtype.Id);
                    this.programmaticModalPopup.Hide();
                }
                else if (e.CommandArgument.ToString() == "Update" && ischkBoxEmpty == true)
                {
                    JobTypeDepartmentAction(jobtype.Id);
                    jobtype.Delete(jobtype.Id);
                    this.programmaticModalPopup.Hide();
                }

                InitializeGridViewJobType();
            }
        }
        protected void modalAcronym_Changed(object sender, EventArgs e)
        {
            string errorMsg = "Acronym already used.";
            if (modalTxtBoxAcronym.Text.Trim() != "")
            {
                JobType jobtype = new JobType();
                jobtype = jobtype.GetJobTypeByAcronym(modalTxtBoxAcronym.Text.Trim());

                if (jobtype != null)
                {
                    if (modalLabelJobTypeId.Text.Trim() == "")
                    {
                        modalLabelError.Text += errorMsg;
                        modalLabelError.Visible = true;
                    }
                    else
                    {
                        JobType j = jobtype.GetJobType(Convert.ToInt32(modalLabelJobTypeId.Text));
                        if (j.Acronym.Trim().Equals(modalTxtBoxAcronym.Text.Trim(), StringComparison.OrdinalIgnoreCase) == true)
                        {
                            modalLabelError.Text += errorMsg;
                            modalLabelError.Visible = true;
                        }
                        else
                        {
                            modalLabelError.Text = modalLabelError.Text.Replace(errorMsg, "").Trim();
                        }
                    }
                }
                else
                {
                    modalLabelError.Text = modalLabelError.Text.Replace(errorMsg, "").Trim();
                }
            }
            else
            {
                modalLabelError.Text = modalLabelError.Text.Replace(errorMsg, "").Trim();
            }
            if (modalLabelError.Text.Trim().Length == 0)
            {
                modalLabelError.Visible = false;
            }
            this.programmaticModalPopup.Show();
        }