public ProductSearchForm() { InitializeComponent(); productTableAdapter = new JSManagementDataSetTableAdapters.ProductTableAdapter(); this.productTableAdapter.Connection = CommonHelper.GetSQLConnection(); getProductInOutDetailTableAdapter.Connection = CommonHelper.GetSQLConnection(); storeTableAdapter = new JSManagementDataSetTableAdapters.StoreTableAdapter(); storeTableAdapter.Connection = CommonHelper.GetSQLConnection(); this.prnDialog = new System.Windows.Forms.PrintDialog(); prodTableAdapter = new JSManagementDataSetTableAdapters.ProdTableAdapter(); prodTableAdapter.Connection = CommonHelper.GetSQLConnection(); this.prnPreview = new System.Windows.Forms.PrintPreviewDialog(); this.prnDocument = new System.Drawing.Printing.PrintDocument(); // the Event of 'PrintPage' prnDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler (prnDocument_PrintPage); }
private void MainForm_Load(object sender, EventArgs e) { if (!LoginInfor.IsSucess) { LoginForm loginForm = new LoginForm(); loginForm.StartPosition = FormStartPosition.CenterScreen; loginForm.ShowDialog(); } if (LoginInfor.IsSucess) { btOperationResult.Visible = LoginInfor.IsAdmin; btManageCash.Visible = LoginInfor.IsAdmin; JSManagementDataSetTableAdapters.StoreTableAdapter storeTableAdapter = new JSManagementDataSetTableAdapters.StoreTableAdapter(); storeTableAdapter.Connection = CommonHelper.GetSQLConnection(); JSManagementDataSet.StoreDataTable storeData = storeTableAdapter.GetDataByStoreIds(LoginInfor.StoreId); lbUserName.Text = string.Format("Đăng nhập: {0} {1} Kho hàng: {2}", LoginInfor.UserName, Environment.NewLine, storeData.Rows[0][1].ToString()); } this.StartPosition = FormStartPosition.CenterScreen; }