private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { RetailClusterSource.RetailCluster p = (RetailClusterSource.RetailCluster)dataGrid1.SelectedItem; if (p != null && p.RetailClusterID != 0) { rs.SelectedRetailClusterID = p.RetailClusterID; btnRemove.IsEnabled = true; btnSaveSelectedGroup.IsEnabled = true; currentselectedclusterid = p.RetailClusterID; currentselectedclustername = p.RetailClusterName; rs.LoadExistingGroups(currentselectedclusterid); btnSearchAvailable_Click(null, null); groupBox3.Header = "Available Groups for Cluster " + currentselectedclustername; gboxupgrade.Header = "Configured Groups of Cluster " + currentselectedclustername; } else { groupBox3.Header = "Available Groups"; gboxupgrade.Header = "Configured Groups"; btnRemove.IsEnabled = false; btnSaveSelectedGroup.IsEnabled = false; currentselectedclusterid = 0; rs.LoadExistingGroups(currentselectedclusterid); btnSearchAvailable_Click(null, null); } //gboxupgrade.Header = "Upgrade Option of " + p.ProductID; //txtSaveAlert.Text = "Configure selected products as the upgrade option of proudct " + p.ProductID; //sr.GetUpgradeForStandardInclusion(p.ProductID, int.Parse(cmbBrand.SelectedValue.ToString())); }
private void Config_Click(object sender, RoutedEventArgs e) { RetailClusterSource.RetailCluster rcluster = (RetailClusterSource.RetailCluster)(((Button)e.OriginalSource).DataContext); //int clusterid = int.Parse(((Button)e.OriginalSource).CommandParameter.ToString()); frmConfigureSupplierQAToCluster win = new frmConfigureSupplierQAToCluster(loginstateid, rcluster, loginuser, configType); win.ShowDialog(); }
private void btnSave_Click(object sender, RoutedEventArgs e) { Microsoft.Windows.Controls.DataGridRow row = (Microsoft.Windows.Controls.DataGridRow)(dataGrid1.ItemContainerGenerator.ContainerFromItem(dataGrid1.SelectedItem)); RetailClusterSource.RetailCluster s = (RetailClusterSource.RetailCluster)row.Item; bool exists = false; if (s.RetailClusterName != null && s.RetailClusterName.Trim() != "") { if (s.RetailClusterID == 0) { if (!RetailClusterExists(s)) { exists = false; } else { exists = true; } } if (exists) { MessageBox.Show("This cluster already exists."); } else { try { rs.SaveRetailCluster(s); if (row.DetailsVisibility == Visibility.Visible) { row.DetailsVisibility = Visibility.Collapsed; } btnSearch_Click(null, null); } catch (Exception ex) { } } } else { MessageBox.Show("Please enter a cluster name."); } }
public frmConfigureSupplierQAToCluster(int pstateid, object source, string pusercode, string configuretype) { loginstateid = pstateid; configType = configuretype; if (configuretype.ToUpper() == "RETAILCLUSTER") { rcluster = (RetailClusterSource.RetailCluster)source; clusterid = rcluster.RetailClusterID; id = clusterid.ToString(); } else if (configuretype.ToUpper() == "GROUP") { group = (RetailClusterSource.Group)source; groupid = group.GroupID; id = groupid.ToString(); } rs = new RetailClusterSource(loginstateid, pusercode); InitializeComponent(); if (configuretype.ToUpper() == "RETAILCLUSTER") { txtclustername.Text = txtclustername.Text + "Retail Clusters - " + rcluster.RetailClusterName; btnConfig.Content = "Save Template To Cluster"; } else { txtclustername.Text = txtclustername.Text + "Group - " + group.GroupName; btnConfig.Content = "Save Template To Groups"; } this.DataContext = rs; rs.LoadSuppliers(loginstateid); rs.LoadQuestions(loginstateid); rs.LoadQAndA(id, configType); this.Title = this.Title + " - " + CommonVariables.WindowTitleInfo; }
private void btnAdd_Click(object sender, RoutedEventArgs e) { RetailClusterSource.RetailCluster s = new RetailClusterSource.RetailCluster(); rs.ExistingRetailClusters.Add(s); }
private bool RetailClusterExists(RetailClusterSource.RetailCluster s) { return(rs.RetailClusterExists(s.StateID, s.RetailClusterName)); }