private void SaveInsightSupplierModel(int insightSupplierId)
        {
            InsightSupplierModel.DeleteInsightSupplierModelByInsightSupplierId(insightSupplierId);

            foreach (ListItem listItem in CheckBoxListModel.Items)
            {
                if (listItem.Selected)
                {
                    InsightSupplierModel ism = new InsightSupplierModel();
                    ism.InsightSupplierId = insightSupplierId;
                    ism.ModelId           = Convert.ToInt32(listItem.Value);
                    ism.ModifiedUser      = Context.User.Identity.GetUserName();

                    ism.Save();
                }
            }
        }
        private void BindInsightSupplier()
        {
            try
            {
                InsightSupplier insightSupplier = InsightSupplier.GetInsightSupplierByInsightSupplierId(this.insightSupplierId);
                TextBoxSupplierName.Text      = insightSupplier.SupplierName;
                TextBoxSupplierNameModel.Text = insightSupplier.SupplierNameModel;
                TextBoxPastelRef.Text         = insightSupplier.PastelRef;
                TextBoxMonths.Text            = insightSupplier.Months.ToString();
                TextBoxNotes.Text             = insightSupplier.Notes;

                DropDownListSupplierType.Items.FindByValue(insightSupplier.SupplierTypeId.ToString()).Selected = true;
                //DropDownListOption.Items.FindByValue(insightSupplier.OptionId.ToString()).Selected = true;
                DropDownListSecurity.Items.FindByValue(insightSupplier.SecurityId.ToString()).Selected = true;
                //DropDownListLink.Items.FindByValue(insightSupplier.LinkId.ToString()).Selected = true;
                DropDownListCategoryReduction.Items.FindByValue(insightSupplier.CategoryReductionId.ToString()).Selected = true;
                DropDownListBuild.Items.FindByValue(insightSupplier.BuildId.ToString()).Selected   = true;
                DropDownListStatus.Items.FindByValue(insightSupplier.StatusId.ToString()).Selected = true;
                DropDownListCatman.Items.FindByValue(insightSupplier.CatmanId.ToString()).Selected = true;
                DropDownListCustom.Items.FindByValue(insightSupplier.CustomId.ToString()).Selected = true;
                DropDownListDaily.Items.FindByValue(insightSupplier.DailyId.ToString()).Selected   = true;
                DropDownListWeekly.Items.FindByValue(insightSupplier.WeeklyId.ToString()).Selected = true;
                DropDownListPromo.Items.FindByValue(insightSupplier.PromoId.ToString()).Selected   = true;

                List <InsightSupplierModel> ismList = InsightSupplierModel.GetInsightSupplierModelByInsightSupplierId(this.insightSupplierId);

                foreach (ListItem listItem in CheckBoxListModel.Items)
                {
                    foreach (InsightSupplierModel ism in ismList)
                    {
                        if (listItem.Value == ism.ModelId.ToString())
                        {
                            listItem.Selected = true;
                        }
                    }
                }

                List <InsightSupplierOption> isoList = InsightSupplierOption.GetInsightSupplierOptionByInsightSupplierId(this.insightSupplierId);

                foreach (ListItem listItem in CheckBoxListOption.Items)
                {
                    foreach (InsightSupplierOption iso in isoList)
                    {
                        if (listItem.Value == iso.OptionId.ToString())
                        {
                            listItem.Selected = true;
                        }
                    }
                }

                List <InsightSupplierLink> islList = InsightSupplierLink.GetInsightSupplierLinkByInsightSupplierId(this.insightSupplierId);

                foreach (ListItem listItem in CheckBoxListLink.Items)
                {
                    foreach (InsightSupplierLink isl in islList)
                    {
                        if (listItem.Value == isl.LinkId.ToString())
                        {
                            listItem.Selected = true;
                        }
                    }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
            catch (Exception exception)
            {
                LabelError.Text   += (exception.Message + "<br />");
                PanelError.Visible = true;
            }
        }