private void SetDataSource(ReportDocument Report) { string ProductGroupName = string.Empty; if (cboGroup.SelectedItem.Value != Constants.ZERO_STRING) { ProductGroupName = cboGroup.SelectedItem.Text; } string SubGroupName = string.Empty; if (cboSubGroup.SelectedItem.Value != Constants.ZERO_STRING) { SubGroupName = cboSubGroup.SelectedItem.Text; } System.Data.DataSet ds = new System.Data.DataSet(); RemoteBranchInventory clsBranchInventory = new RemoteBranchInventory(); ds.Tables.Add(clsBranchInventory.DataList(ProductGroupName, SubGroupName, txtProductCode.Text)); clsBranchInventory.CommitAndDispose(); Report.SetDataSource(ds); SetParameters(Report); }
private void Synchronize() { try { lblError.Text = string.Empty; Branch clsBranch = new Branch(); BranchDetails clsBranchDetails = clsBranch.Details(Convert.ToInt16(cboBranch.SelectedItem.Value.ToString())); clsBranch.CommitAndDispose(); if (IPAddress.IsOpen(clsBranchDetails.DBIP, int.Parse(clsBranchDetails.DBPort)) == false) { lblError.Text = "Sorry cannot connect to Branch '" + cboBranch.SelectedItem.Text + "'. Please check you connection to IP Address :" + clsBranchDetails.DBIP + ". <br /><br />"; lblError.Text += "HOW TO CHECK : <br /><br />"; lblError.Text += " 1. Open command prompt<br />"; lblError.Text += " 2. Type ping[space][IP Address]<br /><br />"; lblError.Text += "If the answer is 'Request timed out.' then contact system administrator.<br />"; lblError.Text += "Else if the answer is 'Reply...' Follow the next steps.<br /><br />"; lblError.Text += " 3. Type telnet[space][IP Address][sapce][IP Port]<br /><br />"; return; } Session.Timeout = 60 * 60 * 30; RemoteBranchInventory clsBranchInventory = new RemoteBranchInventory(); clsBranchInventory.GetConnectionToBranch(clsBranchDetails.DBIP); string[] InsertStatements = clsBranchInventory.GetInsertList(clsBranchDetails.BranchID); clsBranchInventory.CommitAndDispose(); clsBranchInventory = new RemoteBranchInventory(); clsBranchInventory.Delete(clsBranchDetails.BranchID); foreach (string InsertStatement in InsertStatements) { try { clsBranchInventory.Insert(InsertStatement); lblError.Text += InsertStatement + "<br /><br />"; } catch { lblError.Text += "<div class=ms-alternating> ERROR INSERTING ITEM: " + InsertStatement + "</div><br /><br />"; clsBranchInventory.Insert("';"); } } clsBranchInventory.CommitAndDispose(); lblError.Text = "Done synchronizing Branch: " + clsBranchDetails.BranchCode + "<br /><br />" + lblError.Text; } catch (Exception ex) { lblError.Text += "ERROR WHILE CREATING INSERT STATEMENT: " + ex.Message; //throw ex; } }