void cmbCampaign_SelectionChanged(object sender, SelectionChangedEventArgs e) { svrDisposition.Visibility = Visibility.Visible; try { DataSet ds = ClsRecycle.List_GetAll(Int64.Parse(((ListBoxItem)cmbCampaign.SelectedItem).Tag.ToString())); DataTable dt = ds.Tables[0]; lstLists.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { ListBoxItem l = new ListBoxItem(); l.Tag = dt.Rows[i][0]; l.Content = dt.Rows[i][1]; lstLists.Items.Add(l); } FncFillCheckBoxes(); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "cmbCampaign_SelectionChanged()", "CtlRecycle.xaml.xs"); } }
void btnRecycle_Click(object sender, RoutedEventArgs e) { try { rtcSummary.SelectAll(); rtcSummary.Selection.Text = ""; string strSummary = ""; //string strList = ""; for (int i = 0; i < chkDispositions.Length; i++) { if (chkDispositions[i].IsChecked == true) { DataSet ds = ClsRecycle.Recycle_Leads(Int64.Parse(chkDispositions[i].Tag.ToString()), Int64.Parse(((ListBoxItem)lstLists.SelectedItem).Tag.ToString())); DataTable dt = ds.Tables[0]; Int64 MaxID = Int64.Parse(ds.Tables[1].Rows[0][0].ToString()); for (int j = 0; j < dt.Rows.Count; j++) { dt.Rows[j][0] = MaxID; dt.Rows[j]["Status"] = "Fresh"; MaxID++; } dt.Columns.RemoveAt(dt.Columns.Count - 1); SqlBulkCopy sqlBulk = new SqlBulkCopy(VMuktiAPI.VMuktiInfo.MainConnectionString); sqlBulk.DestinationTableName = "Leads"; sqlBulk.BulkCopyTimeout = 3600; sqlBulk.WriteToServer(dt); sqlBulk.Close(); strSummary = strSummary + dt.Rows.Count.ToString() + " Leads Recycled For Disposition " + chkDispositions[i].Content.ToString() + "\n"; } } rtcSummary.AppendText(strSummary); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "btnRecycle_Click()", "CtlRecycle.xaml.xs"); } }
public void FncFillCombo() { DataSet ds = ClsRecycle.Campaign_GetAll(); DataTable dt = ds.Tables[0]; try { for (int i = 0; i < dt.Rows.Count; i++) { ComboBoxItem l = new ComboBoxItem(); l.Tag = dt.Rows[i][0]; l.Content = dt.Rows[i][1]; cmbCampaign.Items.Add(l); } } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncFillCombo()", "CtlRecycle.xaml.xs"); } }
public void FncFillCheckBoxes() { try { cnvDispo.Children.Clear(); DataSet ds = ClsRecycle.Disposition_GetAll(Int64.Parse(((ListBoxItem)cmbCampaign.SelectedItem).Tag.ToString())); DataTable dt = ds.Tables[0]; chkDispositions = new CheckBox[dt.Rows.Count]; chkAll.Content = "ALL Dispositions"; chkAll.IsChecked = false; chkAll.FontSize = 15; Canvas.SetLeft(chkAll, 10); Canvas.SetTop(chkAll, 0); if (chkAll.Parent == null) { cnvDispo.Children.Add(chkAll); } chkAll.Click += new RoutedEventHandler(chkAll_Click); for (int i = 0; i < dt.Rows.Count; i++) { chkDispositions[i] = new CheckBox(); chkDispositions[i].Content = dt.Rows[i][1].ToString(); chkDispositions[i].Tag = dt.Rows[i][0].ToString(); Canvas.SetLeft(chkDispositions[i], 10); Canvas.SetTop(chkDispositions[i], ((i + 1) * varTop)); chkDispositions[i].Click += new RoutedEventHandler(CtlRecycle_Click); cnvDispo.Children.Add(chkDispositions[i]); } cnvDispo.Height = (dt.Rows.Count + 1) * varTop; } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncFillCheckBoxes()", "CtlRecycle.xaml.xs"); } }