/// <summary>
        /// This function add/edit application status
        /// </summary>
        /// <param name="appStatusDetails"></param>
        /// <returns></returns>
        public int AddUpdateApplicationStatus(ApplicationStatus appStatusDetails)
        {
            var context = new dbDataContext();
            var appStatus = context.tbl_ApplicationStatus.FirstOrDefault(t => t.ApplicationStatusId == appStatusDetails.ApplicationStatusId) ??
                            new tbl_ApplicationStatus();
            appStatus.StatusName = appStatusDetails.StatusName;
            appStatus.IsDefault = appStatusDetails.IsDefault;
            appStatus.EmailTemplateId = appStatusDetails.EmailTemplateId;
            appStatus.InterviewType = appStatusDetails.InterviewType;
            appStatus.JobId = appStatusDetails.JobId;

            //   try
            //  {
            // Add/Update application status
            if (appStatus.ApplicationStatusId <= 0)
            {
                appStatus.ViewOrder = GetNextRecordId();
                context.tbl_ApplicationStatus.InsertOnSubmit(appStatus);
            }
            context.SubmitChanges();

            //change orders  
            ChangeOrder("");
            return appStatus.ApplicationStatusId;
            // }
            // catch (Exception)
            // {
            return -1;
            // }
        }
    private void SaveApplicationStatus()
    {
        var appStatus = new ApplicationStatus
        {
            ApplicationStatusId = Convert.ToInt32(lblAppStatusId.Text),
            StatusName = txtStatus.Text.Trim(),
            IsDefault = true,
            EmailTemplateId = Convert.ToInt32(ddlTemplates.SelectedValue),
            InterviewType = rbtnInterviewFolderYes.Checked
        };

        // add/edit application status
        var appStatusId = new ApplicationStatuses().AddUpdateApplicationStatus(appStatus);
        lblAppStatusId.Text = appStatusId.ToString();
    }