Пример #1
0
        protected void GridViewResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removeinsightsuppliercontactlink":
                {
                    string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
                    int      insightSupplierContactLinkId    = Convert.ToInt32(commandArgs[0]);
                    int      insightSupplierContactLicenseId = Convert.ToInt32(commandArgs[1]);

                    int insightSupplierContactIdSelectedUser = InsightSupplierContact.GetInsightSupplierContactByInsightSupplierContactLinkId(insightSupplierContactLinkId).InsightSupplierContactId;

                    InsightSupplierContactDistributionLink.DeleteInsightSupplierContactDistributionLinkByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactIdSelectedUser);
                    InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactIdSelectedUser);
                    InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactIdSelectedUser);

                    InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierContactIdInsightSupplierId(this.insightSupplierId, insightSupplierContactIdSelectedUser);

                    InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(insightSupplierContactLinkId);

                    //InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(Convert.ToInt32(e.CommandArgument));
                    BindInsightSupplierContactGridView();

                    TextBoxFirstName.Text = "";
                    TextBoxLastName.Text  = "";
                    TextBoxPosition.Text  = "";
                    TextBoxLandline.Text  = "";
                    TextBoxMobile.Text    = "";
                    TextBoxEmail.Text     = "";
                    TextBoxAddress.Text   = "";
                    TextBoxUsername.Text  = "";
                    TextBoxPassword.Text  = "";

                    BindRegion();
                    BindGift();
                    BindModel();
                    BindOption();
                    BindLink();
                    BindAccessMethod();
                    BindLicense();
                    BindQlikviewVersion();
                    PanelInstall.Visible = false;
                    PanelOnline.Visible  = false;

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                LabelError.Text = "";
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
        }
Пример #2
0
        private void SaveInsightSupplierContactDistributionModel(int insightSupplierContactId)
        {
            InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);

            foreach (ListItem listItem in CheckBoxListModel.Items)
            {
                if (listItem.Selected)
                {
                    InsightSupplierContactDistributionModel iscdM = new InsightSupplierContactDistributionModel();
                    iscdM.InsightSupplierId        = this.insightSupplierId;
                    iscdM.InsightSupplierContactId = insightSupplierContactId;
                    iscdM.ModelId      = Convert.ToInt32(listItem.Value);
                    iscdM.ModifiedUser = Context.User.Identity.GetUserName();

                    iscdM.Save();
                }
            }
        }
        protected void GridViewUser_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removeinsightsuppliercontactlink":
                {
                    string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
                    int      insightSupplierContactLinkId    = Convert.ToInt32(commandArgs[0]);
                    int      insightSupplierContactLicenseId = Convert.ToInt32(commandArgs[1]);

                    int insightSupplierContactId = InsightSupplierContact.GetInsightSupplierContactByInsightSupplierContactLinkId(insightSupplierContactLinkId).InsightSupplierContactId;

                    InsightSupplierContactDistributionLink.DeleteInsightSupplierContactDistributionLinkByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);
                    InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);
                    InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);

                    //InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierContactLicenseId(insightSupplierContactLicenseId);
                    InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierContactIdInsightSupplierId(this.insightSupplierId, insightSupplierContactId);

                    InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(insightSupplierContactLinkId);

                    //InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(Convert.ToInt32(e.CommandArgument));

                    BindInsightSupplierContactList();
                    BindInsightSupplierContactGridView();

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                LabelError.Text = "";
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
        }