private void txtAccountNumber_TextChanged(object sender, EventArgs e) { List <CheckModel> Acheck = new List <CheckModel>(); DatabaseConnectionsServices dbconnection = new DatabaseConnectionsServices(); // var listofchecksAccount = Acheck.Select(a => a.AccountNo).ToList(); if (txtAccountNumber.Text.Length == 12) { dbconnection.GetNameifExisting(Acheck); for (int i = 0; i < Acheck.Count; i++) { if (txtAccountNumber.Text == Acheck[i].AccountNo) { CheckBRSTNandChkType(); txtAccountName1.Text = Acheck[i].Name1.ToString(); txtAccountName2.Text = Acheck[i].Name2.ToString(); cmbBranch.Text = Acheck[i].Address1.ToString(); cmbChkType.Text = Acheck[i].ChkTypeName.ToString(); } } //foreach (string acc in listofchecks) //{ // var acc2 = check.Where(b => b.AccountNo == txtAccountNumber.Text).ToList(); // foreach (var chk in acc2) // { // txtAccountName1.Text = chk.Name1.ToString(); // txtAccountName2.Text = chk.Name2.ToString(); // } //} } }
private void CheckLoadData() { DataTable dt = new DataTable(); DatabaseConnectionsServices dbconnection = new DatabaseConnectionsServices(); dbconnection.LoadDataToGridView(dt); dvgDatalist.DataSource = dt; }
private void ChequeName() { DataTable dataSet = new DataTable(); DatabaseConnectionsServices dbconnection = new DatabaseConnectionsServices(); dbconnection.GETChequeName(dataSet); foreach (DataRow row in dataSet.Rows) { cmbChkType.Items.Add(row[0]); } }
private void BranchLoad() // loading all the branches in Combobox { DatabaseConnectionsServices connection = new DatabaseConnectionsServices(); DataTable dataSet = new DataTable(); connection.GetBranch(dataSet); foreach (DataRow row in dataSet.Rows) { cmbBranch.Items.Add(row[0]); } }// end of function
private void btnProcess_Click(object sender, EventArgs e) { DatabaseConnectionsServices dbconnection = new DatabaseConnectionsServices(); _batchfile = DateTime.Today.ToString("MMddyyyy"); fileName = "ISL" + _batchfile.Substring(0, 4) + "P"; DialogResult result1 = MessageBox.Show("Are you sure to continue the process?", "", MessageBoxButtons.YesNo); if (result1.ToString() == "Yes") { isExist: ChecOutputServices.InputBox("", "Batch Number :", ref _batchfile); List <CheckModel> bcheck = new List <CheckModel>(); // checking if the bacth file does exists! dbconnection.GetBatchFile(bcheck); if (bcheck != null) { for (int b = 0; b < bcheck.Count; b++) { if (bcheck[b].Batchfile == _batchfile) { MessageBox.Show("Batch is already exists!!!!!"); goto isExist; } } CheckProcess(); } else { CheckProcess(); } } else { MessageBox.Show("Process Cancelled"); } //} //catch (Exception ee) //{ // MessageBox.Show(ee.Message); //} //} }
private void txtBrstn_TextChanged(object sender, EventArgs e) { List <CheckModel> Acheck = new List <CheckModel>(); DatabaseConnectionsServices dbconnection = new DatabaseConnectionsServices(); // var listofchecksAccount = Acheck.Select(a => a.AccountNo).ToList(); if (txtBrstn.Text.Length == 9) { dbconnection.GetNameifExisting(Acheck); for (int i = 0; i < Acheck.Count; i++) { if (txtBrstn.Text == Acheck[i].AccountNo) { txtBranchName.Text = Acheck[i].BranchName.ToString(); txtAddress1.Text = Acheck[i].Address1.ToString(); txtAddress2.Text = Acheck[i].Address2.ToString(); txtAddress3.Text = Acheck[i].Address3.ToString(); txtAddress4.Text = Acheck[i].Address4.ToString(); txtAddress5.Text = Acheck[i].Address5.ToString(); txtAddress6.Text = Acheck[i].Address6.ToString(); } } } }
private void btnSave_Click(object sender, EventArgs e) { DatabaseConnectionsServices dbconnection = new DatabaseConnectionsServices(); if (deliveryDate == dateTime) { MessageBox.Show("Please set the delivery date!!!"); } else { DialogResult result1 = MessageBox.Show("", "Do you to saved this record?", MessageBoxButtons.YesNo); BranchesModel branch = new BranchesModel(); if (result1.ToString() == "Yes") { CheckBRSTNandChkType(); qty = int.Parse(txtOrQty.Text); _checkModel.AccountNo = txtAccountNumber.Text; _checkModel.Address1 = cmbBranch.Text; _checkModel.ChkType = _ChkType; if (_checkModel.ChkType == "MC") { _checkModel.ChkTypeName = "MANAGERS CHECK"; } else if (_checkModel.ChkType == "MC_CONT") { _checkModel.ChkTypeName = "MANAGERS CHECK CONTINUES"; } else { _checkModel.ChkTypeName = cmbChkType.Text; } _checkModel.Name1 = txtAccountName1.Text; _checkModel.Name2 = txtAccountName2.Text; _checkModel.BRSTN = _Brstn; _checkModel.BranchName = cmbBranch.Text; _checkModel.Address1 = cmbBranch.Text; dbconnection.GetBranchesDetails(branch, _checkModel.BRSTN); if (branch != null) { _checkModel.Address2 = branch.Address2.ToString(); _checkModel.Address3 = branch.Address3.ToString(); _checkModel.Address4 = branch.Address4.ToString(); _checkModel.Address5 = branch.Address5.ToString(); _checkModel.Address6 = branch.Address6.ToString(); } _checkModel.Qty = qty; deliveryDate = dateTimePicker1.Value; _checkModel.DeliveryDate = deliveryDate; if (_checkModel != null) { for (int i = 0; i < qty; i++) { dbconnection.GetLastNO(refMode, _checkModel.ChkType, _checkModel.BRSTN); Int64 s = refMode.LastNo + 1; string lastNo = refMode.LastNo.ToString(); int endRefno = int.Parse(lastNo); _checkModel.StartSeries = s.ToString(); if (_checkModel.ChkType == "A" || _checkModel.ChkType == "MC" || _checkModel.ChkType == "MC_CONT" || _checkModel.ChkType == "SR" || _checkModel.ChkType == "TD") { endRefno = endRefno + bookperpcs; } else if (_checkModel.ChkType == "B") { endRefno = endRefno + bookperpcs; } _checkModel.EndSeries = endRefno.ToString(); refMode.Date = dateTime; refMode.LastNo = endRefno; dbconnection.SaveToSecondaryTable(_checkModel); // dbconnection.UpdateRef(refMode); string _brstn = _checkModel.BRSTN.ToString(); string _chktype = _checkModel.ChkType.ToString(); } MessageBox.Show("Data has been Saved!"); dbconnection.UpdateRef(refMode); CheckLoadData(); } // MessageBox.Show(_checkModel.DeliveryDate.ToString() + dateTime.ToString()); ClearAllInputText(); } else { MessageBox.Show("Saving Cancelled!!!!"); } } }