protected void GridViewResult_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName.ToLower()) { case "removeinsightsupplier": { int insightSupplierId = Convert.ToInt32(e.CommandArgument); InsightSupplierCustomHeader.DeleteInsightSupplierCustomHeaderByInsightSupplierId(insightSupplierId); InsightSupplierContactDistributionLink.DeleteInsightSupplierContactDistributionLinkByInsightSupplierId(insightSupplierId); InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierId(insightSupplierId); InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierId(insightSupplierId); InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierId(insightSupplierId); InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierId(insightSupplierId); InsightSupplierMerchandising.DeleteInsightSupplierMerchandisingByInsightSupplierId(insightSupplierId); InsightSupplierMerchSupplierLink.DeleteInsightSupplierMerchSupplierLinkByInsightSupplierId(insightSupplierId); InsightSupplier.DeleteInsightSupplierByInsightSupplierId(insightSupplierId); BindGridViewResultDefault(); break; } } } catch (System.Data.SqlClient.SqlException sqlEx) { } }
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; } }
private void SaveInsightSupplierContactDistributionOption(int insightSupplierContactId) { InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId); foreach (ListItem listItem in CheckBoxListOption.Items) { if (listItem.Selected) { InsightSupplierContactDistributionOption iscdO = new InsightSupplierContactDistributionOption(); iscdO.InsightSupplierId = this.insightSupplierId; iscdO.InsightSupplierContactId = insightSupplierContactId; iscdO.OptionId = Convert.ToInt32(listItem.Value); iscdO.ModifiedUser = Context.User.Identity.GetUserName(); iscdO.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; } }
private void BindInsightSupplierContact() { try { InsightSupplierContact insightSupplierContact = InsightSupplierContact.GetInsightSupplierContactByInsightSupplierContactId(this.insightSupplierContactId); //DropDownListAccount.Items.FindByValue(insightSupplierContact.AccountId.ToString()).Selected = true; TextBoxFirstName.Text = insightSupplierContact.FirstName; TextBoxLastName.Text = insightSupplierContact.LastName; TextBoxLandline.Text = insightSupplierContact.Landline; TextBoxMobile.Text = insightSupplierContact.Mobile; TextBoxEmail.Text = insightSupplierContact.Email; TextBoxAddress.Text = insightSupplierContact.Address; DropDownListRegion.Items.FindByValue(insightSupplierContact.RegionId.ToString()).Selected = true; DropDownListGift.Items.FindByValue(insightSupplierContact.Gift.ToString()).Selected = true; DropDownListAccessMethod.Items.FindByValue(insightSupplierContact.AccessMethodId.ToString()).Selected = true; TextBoxPosition.Text = insightSupplierContact.Position; InsightSupplierContactLicense insightSupplierContactLicenseISM = InsightSupplierContactLicense.GetInsightSupplierContactLicenseInSparMapperByInsightSupplierContactId(this.insightSupplierContactId); TextBoxInSparMapperUsername.Text = insightSupplierContactLicenseISM.InSparMapperUsername; TextBoxInSparMapperPassword.Text = insightSupplierContactLicenseISM.InSparMapperPassword; BindAccessMethodLayout(); if (Convert.ToInt32(DropDownListAccessMethod.SelectedValue) == 1) //Online { BindAccessMethodLayout(); } else { //DropDownListLicense.Items.FindByValue(insightSupplierContact.LicenseId.ToString()).Selected = true; //DropDownListQlikviewVersion.Items.FindByValue(insightSupplierContact.QlikviewVersionId.ToString()).Selected = true; BindLicenseGridView(this.insightSupplierContactId); TextBoxUsername.Text = ""; TextBoxPassword.Text = ""; } List <InsightSupplierContactDistributionLink> iscdlList = InsightSupplierContactDistributionLink.GetInsightSupplierContactDistributionLinkByInsightSupplierContactId(this.insightSupplierId, this.insightSupplierContactId); foreach (ListItem listItem in CheckBoxListLink.Items) { foreach (InsightSupplierContactDistributionLink iscdl in iscdlList) { if (listItem.Value == iscdl.LinkId.ToString()) { listItem.Selected = true; } } } List <InsightSupplierContactDistributionOption> iscdOList = InsightSupplierContactDistributionOption.GetInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, this.insightSupplierContactId); foreach (ListItem listItem in CheckBoxListOption.Items) { foreach (InsightSupplierContactDistributionOption iscdO in iscdOList) { if (listItem.Value == iscdO.OptionId.ToString()) { listItem.Selected = true; } } } List <InsightSupplierContactDistributionModel> iscdMList = InsightSupplierContactDistributionModel.GetInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, this.insightSupplierContactId); foreach (ListItem listItem in CheckBoxListModel.Items) { foreach (InsightSupplierContactDistributionModel iscdM in iscdMList) { if (listItem.Value == iscdM.ModelId.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; } }