public async Task <IActionResult> PutCBS([FromRoute] int id, [FromBody] CBS cBS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cBS.Id) { return(BadRequest()); } _context.Entry(cBS).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CBSExists(id)) { return(NotFound()); } else { throw; } } return(Ok(cBS)); }
public IActionResult OnPostFind() { CBS RequestDirector = new CBS(); ModelState.Remove("MembershipLevel"); ModelState.Remove("FirstName"); ModelState.Remove("LastName"); ModelState.Remove("Password"); ModelState.Remove("DateOfBirth"); ModelState.Remove("Sponser1"); ModelState.Remove("Sponser2"); ModelState.Remove("MembershipStartDate"); if (ModelState.IsValid) { Golfer = RequestDirector.GetGolfer(MemberNumber); if (Golfer.FirstName == null) { Golfer = null; Alert = $"Could Not Find Member"; TempData["Danger"] = true; } else { Golfer.MembershipStartDate = DateTime.Now; TempData["MemberNumber"] = MemberNumber; } } return(Page()); }
public IActionResult OnPostReview() { Confirmation = false; CBS RequestDirecter = new CBS(); Golfer.Approved = Approved.ToString(); DateTime.TryParse(MembershipStartDate, out DateTime date); Golfer.MembershipStartDate = date; Golfer.MemberNumber = (int)TempData["MemberNumber"]; Confirmation = RequestDirecter.ReviewMembershipApplication(Golfer); if (Confirmation) { TempData["Alert"] = $"Successfully Updated Membership Application"; return(RedirectToPage("/Index")); } else { TempData["Danger"] = true; Alert = $"Could Not Update Membership Application"; Golfer = null; } return(Page()); }
public void OnPost() { // Message = "OnPost"; if (ModelState.IsValid) { bool Confirmation; MembershipApplication newApplication = new MembershipApplication { FirstName = FirstNameField, LastName = LastNameField, Status = 'P', Occupation = OccupationField, CompanyName = CompanyNameField, HomeAddress = HomeAddressField, CompanyAddress = CompanyAddressField, HomePostalCode = HomePostalCodeField, CompanyPostalCode = CompanyPostalCodeField, HomePhone = HomePhoneField, CompanyPhone = CompanyPhoneField, HomeAlternatePhone = HomeAlternatePhoneField, Email = EmailField, DateOfBirth = DateOfBirthField, DateCompleted = DateTime.Now, ShareholderName1 = ShareHolder1Field, ShareholderName2 = ShareHolder2Field }; CBS RequestDirector = new CBS(); Confirmation = RequestDirector.AddMembershipApplication(newApplication); Message = $"Error adding {newApplication.FirstName}:{Confirmation}"; } else { Message = $"Not Valid"; } }
public string LoginUser(int MemberNumber, string Password) { //var user = golfers.SingleOrDefault(x => x.MemberNumber == MemberNumber); CBS RequestDirector = new CBS(); var user = RequestDirector.GetGolfer(MemberNumber); if (user == null) { return(null); } if (Password == user.Password) { var key = Encoding.ASCII.GetBytes("as;dlkfjas;ldkfja;sldkfjas98a8***p0a9sdfa"); var JWToken = new JwtSecurityToken( issuer: "http://localhost:5000/", audience: "http://localhost:5000/", claims: GetUserClaims(user), notBefore: new DateTimeOffset(DateTime.Now).DateTime, expires: new DateTimeOffset(DateTime.Now.AddDays(1)).DateTime, signingCredentials: new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)); var token = new JwtSecurityTokenHandler().WriteToken(JWToken); return(token); } else { return(null); } }
public void OnGet() { CBS RequestDirector = new CBS(); var MemberNum = User.Claims.FirstOrDefault(c => c.Type == "MemberNumber").Value; Int32.TryParse(MemberNum, out int MemberNumber); StandingTeeTimeRequest = RequestDirector.FindStandingTeeTimeRequest(MemberNumber); if (StandingTeeTimeRequest.MemberNumber1 != MemberNumber) { TempData["Danger"] = true; Alert = $"You don't have a Standing Tee Time Request"; StandingTeeTimeRequest = null; } else { StartDate = StandingTeeTimeRequest.StartDate.ToString("yyyy-MM-dd"); EndDate = StandingTeeTimeRequest.EndDate.ToString("yyyy-MM-dd"); time = StandingTeeTimeRequest.Time.ToString("t"); TempData.Put("key", StandingTeeTimeRequest); } }
public ActionResult OnPost() { if (ModelState.IsValid) { NewMembershipApplication.LastName = LastName; NewMembershipApplication.FirstName = FirstName; NewMembershipApplication.Address = Address; NewMembershipApplication.PostalCode = PostalCode; NewMembershipApplication.City = City; NewMembershipApplication.DateofBirth = DateofBirth; NewMembershipApplication.Email = Email; NewMembershipApplication.Phone = Phone; NewMembershipApplication.AlternatePhone = AlternatePhone; NewMembershipApplication.Occupation = Occupation; NewMembershipApplication.CompanyName = CompanyName; NewMembershipApplication.CompanyAddress = CompanyAddress; NewMembershipApplication.CompanyPostalCode = CompanyPostalCode; NewMembershipApplication.CompanyCity = CompanyCity; NewMembershipApplication.CompanyPhone = CompanyPhone; NewMembershipApplication.Shareholder1 = Shareholder1; NewMembershipApplication.Shareholder2 = Shareholder2; NewMembershipApplication.MembershipType = MembershipType; bool confirmation; CBS RequestDirector = new CBS(); confirmation = RequestDirector.RecordMembershipApplication(NewMembershipApplication); if (confirmation) { Alert = $"Application has been Submitted Successfully!"; } } return(Page()); }
public IActionResult OnPostCancelTeeTime() { ModelState.Remove("Date"); ModelState.Remove("Time"); if (ModelState.IsValid) { Confirmation = false; CBS RequestDirector = new CBS(); var selectedTeeTimeTemp = TempData.Get <TeeTime>("key"); selectedTeeTime = selectedTeeTimeTemp; Confirmation = RequestDirector.DeleteTeeTime(selectedTeeTime); if (Confirmation) { TempData["Alert"] = $"Successfully Cancelled Tee Time"; return(RedirectToPage("/Index")); } else { TempData["Danger"] = true; Alert = $"Could Not Modify Tee Time Tee Time"; } } return(Page()); }
public void ViewAllAccountsSummaryConainsNewAccount() { membershipApplication.CreateMemberAccount(out string _); var accountsSummary = new CBS(connectionString).ViewAllAccountsSummary(); RemoveMemberAccount(); Assert.Contains(accountsSummary, s => s.Email == membershipApplication.ProspectiveMemberContactInfo.Email); }
public void CopyZipFile(string _processby, CBS main) { string dPath = @" C:\Users\CaptiveIT1\Documents\Temp" + @"\AFT_" + main.batchfile + "_" + _processby + "_" + CBS.outputFolder.ToUpper() + ".zip"; string sPath = Application.StartupPath + "\\" + Form1.banks + "\\AFT_" + Form1.banks.ToUpper() + "_" + main.batchfile + "_" + _processby + "_" + CBS.outputFolder.ToUpper() + ".zip"; File.Copy(sPath, dPath, true); //string dPath2 = "\\\\192.168.0.254\\PrinterFiles\\ISLA\\2019\\"; //string sPath2 = "\\\\192.168.0.254\\captive\\Auto\\IslaBank\\Test\\"; }
public void FilteredAccountDetails_ContainsOnlyFilterCriteria() { membershipApplication.CreateMemberAccount(out string _); CBS requestDirector = new CBS(connectionString); MemberAccount foundAccount = requestDirector.GetAccountDetail(membershipApplication.ProspectiveMemberContactInfo.Email, DateTime.Today.AddDays(-29), DateTime.Today.AddDays(1)); foundAccount.FilterAccountDetails("membership"); Assert.All(foundAccount.Transactions, (Transaction tran) => tran.Description.Contains("membership")); }
public void OnGet() { CBS teetimes = new CBS(); DateTime dateVal = new DateTime(1999, 02, 15); SearchParameter = DateTime.Now; teetimes.CreateTeeSheet(DateTime.Now); _sampleObjectCollection = teetimes.GetDailyTeeTimeSheet(SearchParameter.Date); }
/// <summary> /// </summary> /// <param name="cbs">The underlying CBS to use</param> /// <param name="runner"></param> /// <param name="reportSolution"> /// Whether to store the solution found by CBS in the node. /// This should greatly speed up searches.</param> /// <param name="minAboveSic"> /// The minimum increment by which to beat SIC's estimate, if possible. /// Larger values would cause each call to the heuristic to take longer, but make it return better estimates. /// </param> /// <param name="validate"></param> public CbsHeuristicForAStar(CBS cbs, Run runner, bool reportSolution = false, int minAboveSic = 1, bool validate = false) { this.cbs = cbs; this.runner = runner; this.reportSolution = reportSolution; this.minAboveSic = Math.Max(minAboveSic, 1); this.validate = validate; }
public async Task <IActionResult> PostCBS([FromBody] CBS cBS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CBSs.Add(cBS); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCBS", new { id = cBS.Id }, cBS)); }
public ActionResult OnPost() { ThisWeek = Week; CBS RequestDirector = new CBS(); Day = Request.Query["day"]; DailyStandingTeeTimeRequests = RequestDirector.FindAvailableStandingTeeTimes(Day); return(Page()); }
public IActionResult OnPost() { Confirmation = false; StandingTeeTime request = new StandingTeeTime(); if (ModelState.IsValid) { CBS RequestDirector = new CBS(); DateTime.TryParse(StartDate, out DateTime startDate); DateTime.TryParse(EndDate, out DateTime endDate); TimeSpan time = Convert.ToDateTime(Time).TimeOfDay; int memberNumber1; int memberNumber2; int memberNumber3; int memberNumber4; int.TryParse(MemberNumber1, out memberNumber1); int.TryParse(MemberNumber2, out memberNumber2); int.TryParse(MemberNumber3, out memberNumber3); int.TryParse(MemberNumber4, out memberNumber4); request.MemberNumber1 = memberNumber1; request.MemberNumber2 = memberNumber2; request.MemberNumber3 = memberNumber3; request.MemberNumber4 = memberNumber4; request.MemberName1 = MemberName1; request.MemberName2 = MemberName2; request.MemberName3 = MemberName3; request.MemberName4 = MemberName4; request.DayOfWeek = startDate; request.Time = time; request.StartDate = startDate; request.EndDate = endDate; Confirmation = RequestDirector.CreateStandingTeeTimeRequest(request); if (Confirmation) { TempData["Alert"] = $"Successfully Created Standing Tee Time Request"; return(RedirectToPage("/Index")); } else { TempData["Danger"] = true; Alert = $"Could Not Create Standing Tee Time Request"; } } return(Page()); }
public void OnPost() { error = true; TeeTime newTeeTime = new TeeTime(); CBS teetimes = new CBS(); SearchParameter = SearchParameter; CBS systemControl = new CBS(); string[] subs = Submit.Split(' '); switch (subs[0]) { case "Search": SearchParameter = SearchParameter; teetimes.CreateTeeSheet(SearchParameter); Console.WriteLine(SearchParameter); _sampleObjectCollection = teetimes.GetDailyTeeTimeSheet(SearchParameter.Date); break; case "Select": SearchParameter = SearchParameter; newTeeTimeTime = (DateTime.Parse(subs[1]).Add(DateTime.Parse(subs[2]).TimeOfDay)); _sampleObjectCollection = teetimes.GetDailyTeeTimeSheet(SearchParameter.Date); break; case "Submit": _sampleObjectCollection = teetimes.GetDailyTeeTimeSheet(SearchParameter.Date); SearchParameter = SearchParameter; newTeeTime = systemControl.GetTeeTime(DateTime.Parse(subs[1]), DateTime.Parse(subs[2])); if (newTeeTime != null) { newTeeTime.NumCarts = newNumOfCarts; newTeeTime.NumPlayers = newNumOfPlayers; newTeeTime.TeeTimeDate = DateTime.Parse(subs[2]); newTeeTime.MemberNumber = newMemberNumber; newTeeTime.EmployeeName = ""; error = systemControl.BookNewTeeTime(newTeeTime); Message = $"Tee Time Booked for {subs[1]} {subs[2]}"; } else { error = true; Message = "Error"; } break; } }
public void GetAccountDetails_NotEmpty(MembershipType membershipType) { membershipApplication = CreateAndRecordMembershipApplication(membershipType); membershipApplication.CreateMemberAccount(out string _); CBS requestDirector = new CBS(connectionString); MemberAccount foundAccount = requestDirector.GetAccountDetail(membershipApplication.ProspectiveMemberContactInfo.Email, DateTime.Today.AddDays(-29), DateTime.Today.AddDays(1)); Assert.NotEmpty(foundAccount.Transactions); Assert.False(string.IsNullOrWhiteSpace(foundAccount.Name)); Assert.False(string.IsNullOrWhiteSpace(foundAccount.MembershipLevel)); Assert.NotNull(foundAccount.MembershipType); RemoveMemberAccount(); RemoveMembershipApplication(); }
public void OnPost() { bool confirm = false; CBS systemControl = new CBS(); string[] subs = Submit.Split(' '); switch (subs[0]) { case "Cancel": StandingTeeTime teeTime = new StandingTeeTime(); teeTime.StandingTeeTimeID = int.Parse(subs[1]); teeTime.IsCancelled = true; confirm = systemControl.ModifyStandingTeeTime(teeTime); break; } _sampleObjectCollection = systemControl.GetStandingTeeTimeList(); }
public void OnGet() { Golfer golfer = new Golfer(); CBS RequestDirector = new CBS(); var MemberNum = User.Claims.FirstOrDefault(c => c.Type == "MemberNumber").Value; Int32.TryParse(MemberNum, out int MemberNumber); Golfer = RequestDirector.ViewMemberAccount(MemberNumber); if (Golfer.FirstName == null) { TempData["Danger"] = true; Alert = $"Catastrophic Failure! How are you logged in?!"; Golfer = null; } else { Golfer = golfer; } }
public void ZipFileS(string _processby, CBS main) { string sPath = Application.StartupPath + "\\" + Form1.banks + "\\Output\\" + CBS.outputFolder; string dPath = Application.StartupPath + "\\" + Form1.banks + "\\AFT_" + Form1.banks.ToUpper() + "_" + main.batchfile + "_" + _processby + "_" + CBS.outputFolder.ToUpper() + ".zip"; //deleting existing file if (File.Exists(dPath)) { File.Delete(dPath); } //create zip file ZipFile.CreateFromDirectory(sPath, dPath); Ionic.Zip.ZipFile zips = new Ionic.Zip.ZipFile(dPath); //Adding order file to zip file zips.AddItem(Application.StartupPath + "\\" + Form1.banks + "\\Head"); zips.Save(); DeleteSQl(); }
public void OnPost() { // Message = "OnPost"; if (ModelState.IsValid) { bool Confirmation; StandingTeeTime newStandingTeeTimeRequest = new StandingTeeTime { ShareHolderNumber = Member1NumField, MemberNumber2 = Member2NumField, MemberNumber3 = Member3NumField, MemberNumber4 = Member4NumField, ShareHolderName = Member1NameField, Member2Name = Member2NameField, Member3Name = Member3NameField, Member4Name = Member4NameField, DateStart = StartDateField, DateEnd = EndDateField, TeeTimeTime = TeeTimeTimeField, RequestedDayOfWeek = Convert.ToInt32(DayOfWeek) + 1 }; CBS RequestDirector = new CBS(); Confirmation = RequestDirector.InsertStandingTeeTimeRequest(newStandingTeeTimeRequest); if (Confirmation == false) { Message = $"Successfully added Standing Tee Time Request for {Member1NameField}"; } else { Message = $"Error adding Standing Tee Time Request for {Member1NameField}"; } } else { Message = $"Not Valid"; } }
public IActionResult OnPostCancel() { if (ModelState.IsValid) { StandingTeeTimeRequest = TempData.Get <StandingTeeTime>("key"); Confirmation = false; CBS RequestDirector = new CBS(); Confirmation = RequestDirector.CancelStandingTeeTimeRequest(StandingTeeTimeRequest.StandingTeeTimeID); if (Confirmation) { TempData["Alert"] = $"Successfully Cancelled Standing Tee Time Request"; return(RedirectToPage("/Index")); } else { TempData["Danger"] = true; TempData["Alert"] = $"Could Not Cancel Standing Tee Time Request"; RedirectToPage("/CancelStandingTeeTimeRequest"); } } return(Page()); }
public void OnGet() { CBS systemControl = new CBS(); _sampleObjectCollection = systemControl.SearchApplicationsByParam("P"); this.Options = new List <SelectListItem> { new SelectListItem { Text = "Pending", Value = "P" }, new SelectListItem { Text = "Approved", Value = "A" }, new SelectListItem { Text = "Rejected", Value = "R" }, new SelectListItem { Text = "On-Hold", Value = "H" }, new SelectListItem { Text = "Wait Listed", Value = "W" }, }; selectedFilter = "P"; }
public void PrinterFile(List <OrderModel> _checkModel, CBS _mainForm) { string outputFolder = Application.StartupPath + "\\" + Form1.banks + "\\Output"; // DbConServices db = new DbConServices(); // db.GetAllData(_checkModel, _mainForm._batchfile); StreamWriter file; var listofchecks = _checkModel.Select(e => e.ChkType).Distinct().ToList(); foreach (string checktype in listofchecks) { if (checktype == "CV") { string printerFilePathA = outputFolder + "\\" + CBS.outputFolder + "\\CV" + _mainForm.batchfile.Substring(0, 4) + "CA.txt"; var check = _checkModel.Where(e => e.ChkType == checktype).ToList(); if (File.Exists(printerFilePathA)) { File.Delete(printerFilePathA); } file = File.CreateText(printerFilePathA); file.Close(); //for (int a = 0; a < check.Count; a++) //{ using (file = new StreamWriter(File.Open(printerFilePathA, FileMode.Append))) { string output = DataOutputServices.ConvertToPrinterFile(check); file.WriteLine(output); } //} // ZipFileServices.CopyPrinterFile(checktype, _mainForm); // ZipFileServices.CopyPackingDBF(checktype, _mainForm); } } foreach (string checktype in listofchecks) { if (checktype == "B") { string printerFilePath = outputFolder + "\\" + CBS.outputFolder + "\\CBS" /*+ _mainForm.batchfile.Substring(0, 4)*/ + "C.txt"; var check = _checkModel.Where(e => e.ChkType == checktype).ToList(); if (File.Exists(printerFilePath)) { File.Delete(printerFilePath); } file = File.CreateText(printerFilePath); file.Close(); //for (int a = 0; a < check.Count; a++) //{ using (file = new StreamWriter(File.Open(printerFilePath, FileMode.Append))) { string output = DataOutputServices.ConvertToPrinterFile(check); file.WriteLine(output); } //} // ZipFileServices.CopyPrinterFile(checktype, _mainForm); //ZipFileServices.CopyPackingDBF(checktype, _mainForm); } } foreach (string checktype in listofchecks) { if (checktype == "CW") { // _outputFolder = "Check Write"; string printerFilePath = outputFolder + "\\" + CBS.outputFolder + "\\CBS" /*+ _mainForm.batchfile.Substring(0, 4)*/ + "C.txt"; var check = _checkModel.Where(e => e.ChkType == checktype).ToList(); if (File.Exists(printerFilePath)) { File.Delete(printerFilePath); } file = File.CreateText(printerFilePath); file.Close(); //for (int a = 0; a < check.Count; a++) //{ using (file = new StreamWriter(File.Open(printerFilePath, FileMode.Append))) { string output = DataOutputServices.ConvertToPrinterFile(check); file.WriteLine(output); } //} // ZipFileServices.CopyPrinterFile(checktype, _mainForm); //ZipFileServices.CopyPackingDBF(checktype, _mainForm); } } foreach (string checktype in listofchecks) { if (checktype == "A") { //_outputFolder = "Check with Voucher"; string printerFilePath = outputFolder + "\\" + CBS.outputFolder + "\\CBS" /*+ _mainForm.batchfile.Substring(0, 4)*/ + "C.txt"; var check = _checkModel.Where(e => e.ChkType == checktype).ToList(); if (File.Exists(printerFilePath)) { File.Delete(printerFilePath); } file = File.CreateText(printerFilePath); file.Close(); //for (int a = 0; a < check.Count; a++) //{ using (file = new StreamWriter(File.Open(printerFilePath, FileMode.Append))) { string output = DataOutputServices.ConvertToPrinterFile(check); file.WriteLine(output); } //} // ZipFileServices.CopyPrinterFile(checktype, _mainForm); //ZipFileServices.CopyPackingDBF(checktype, _mainForm); } } }
public void SaveToPackingDBF(List <OrderModel> _checks, string _batchNumber, CBS _mainForm) { string dbConnection; string tempCheckType = ""; int blockNo = 0, blockCounter = 0; DbConServices db = new DbConServices(); // db.GetAllData(_checks, _mainForm._batchfile); // OleDbConnection Connect; var listofchecks = _checks.Select(e => e.ChkType).Distinct().ToList(); //for (int i = 0; i < listofchecks.Count; i++) //{ // if(_checks[i].BRSTN == null) // { // i++; // } // else // { //for (int i = 0; i < _checks.Count; i++) //{ // Connect = new OleDbConnection(dbConnection); // if (_checks[i].ChkType == "CV") // { // _outputFolder = "Check with Voucher"; // dbConnection = "Provider=VfpOleDB.1; Data Source=" + Application.StartupPath +"\\" +Form1.banks+ "\\Output\\" + _outputFolder + "\\Packing.dbf" + "; Mode=ReadWrite;"; // //Check if packing file exists // //if (!File.Exists(_filepath)) // //{ // OleDbCommand oCommand; // Connect.Open(); // oCommand = new OleDbCommand("DELETE FROM PACKING", Connect); // oCommand.ExecuteNonQuery(); // if (tempCheckType != _checks[i].ChkType) // blockNo = 1; // tempCheckType = _checks[i].ChkType; // if (blockCounter < 4) // blockCounter++; // else // { // blockCounter = 1; // blockNo++; // } // string sql = "INSERT INTO PACKING (BATCHNO,BLOCK, RT_NO,BRANCH, ACCT_NO, ACCT_NO_P, CHKTYPE, ACCT_NAME1,ACCT_NAME2," + // "NO_BKS, CK_NO_B, CK_NO_E, DELIVERTO, ADDRESS1, ADDRESS2,ADDRESS3,ADDRESS4, ADDRESS5, ADDRESS6 ) VALUES('" + _batchNumber + "'," + blockNo.ToString() + ",'" + _checks[i].BRSTN + "','" + _checks[i].BranchName + // "','" + _checks[i].AccountNo + "','" + _checks[i].AccountNo + "','" + _checks[i].ChkType + "','" + _checks[i].AccountName.Replace("'", "''") + "','" + _checks[i].AccountName2.Replace("'", "''") + "',1,'" + // _checks[i].StartingSerial + "','" + _checks[i].EndingSerial + "','','" + _checks[i].BranchName + "','" + _checks[i].Address2 + "','" + _checks[i].Address3 + "','" + _checks[i].Address4 + "','" + _checks[i].Address5 + "','" + _checks[i].Address6 + "')"; // oCommand = new OleDbCommand(sql, Connect); // oCommand.ExecuteNonQuery(); // Connect.Close(); // } //} foreach (string checktype in listofchecks) { if (checktype == "A" || checktype == "B") { dbConnection = "Provider=VfpOleDB.1; Data Source=" + Application.StartupPath + "\\Output\\" + CBS.outputFolder + "\\Packing.dbf" + "; Mode=ReadWrite;"; //Check if packing file exists //if (!File.Exists(_filepath)) //{ OleDbConnection oConnect = new OleDbConnection(dbConnection); OleDbCommand oCommand; oConnect.Open(); oCommand = new OleDbCommand("DELETE FROM PACKING", oConnect); oCommand.ExecuteNonQuery(); //foreach (var check in _checks) //{ for (int i = 0; i < _checks.Count; i++) { if (_checks[i].ChkName == "") { } else { if (tempCheckType != _checks[i].ChkType) { blockNo = 1; } tempCheckType = _checks[i].ChkType; if (blockCounter < 4) { blockCounter++; } else { blockCounter = 1; blockNo++; } string sql = "INSERT INTO PACKING (BATCHNO,BLOCK, RT_NO,BRANCH, ACCT_NO, ACCT_NO_P, CHKTYPE, ACCT_NAME1,ACCT_NAME2," + "NO_BKS, CK_NO_B, CK_NO_E, DELIVERTO, ADDRESS1, ADDRESS2,ADDRESS3,ADDRESS4, ADDRESS5, ADDRESS6 ) VALUES('" + _batchNumber + "'," + blockNo.ToString() + ",'" + _checks[i].BRSTN + "','" + _checks[i].BranchName.Trim(' ') + "','" + _checks[i].AccountNo + "','" + _checks[i].AccountNo + "','" + _checks[i].ChkType + "','" + _checks[i].AccountName.Replace("'", "''") + "','" + _checks[i].AccountName2.Replace("'", "''") + "',1,'" + _checks[i].StartingSerial + "','" + _checks[i].EndingSerial + "','','" + _checks[i].BranchName.Trim(' ') + "','" + _checks[i].Address2.Trim(' ') + "','" + _checks[i].Address3.Trim(' ') + "','" + _checks[i].Address4.Trim(' ') + "','" + _checks[i].Address5.Trim() + "','" + _checks[i].Address6.Trim() + "')"; oCommand = new OleDbCommand(sql, oConnect); oCommand.ExecuteNonQuery(); } } oConnect.Close(); // } // } } } foreach (string checktype in listofchecks) { if (checktype == "CV") { //var checksorder = _checks.FirstOrDefault(e => e.ChkType == checktype); // _outputFolder = "Check with Voucher"; dbConnection = "Provider=VfpOleDB.1; Data Source=" + Application.StartupPath + "\\" + Form1.banks + "\\Output\\" + CBS.outputFolder + "\\Packing.DBF" + "; Mode=ReadWrite;"; //Check if packing file exists //if (!File.Exists(_filepath)) //{ OleDbConnection oConnect = new OleDbConnection(dbConnection); OleDbCommand oCommand; oConnect.Open(); oCommand = new OleDbCommand("DELETE FROM PACKING", oConnect); oCommand.ExecuteNonQuery(); foreach (var check in _checks) { if (check.ChkName == "") { //i++; oConnect.Close(); } else { if (tempCheckType != check.ChkType) { blockNo = 1; } tempCheckType = check.ChkType; if (blockCounter < 4) { blockCounter++; } else { blockCounter = 1; blockNo++; } string sql = "INSERT INTO PACKING (BATCHNO,BLOCK, RT_NO,BRANCH, ACCT_NO, ACCT_NO_P, CHKTYPE, ACCT_NAME1,ACCT_NAME2," + "NO_BKS, CK_NO_B, CK_NO_E, DELIVERTO, ADDRESS1, ADDRESS2,ADDRESS3,ADDRESS4, ADDRESS5, ADDRESS6 ) VALUES('" + _batchNumber + "'," + blockNo.ToString() + ",'" + check.BRSTN + "','" + check.BranchName + "','" + check.AccountNo + "','" + check.AccountNo + "','" + check.ChkType + "','" + check.AccountName.Replace("'", "''") + "','" + check.AccountName2.Replace("'", "''") + "',1,'" + check.StartingSerial + "','" + check.EndingSerial + "','','" + check.BranchName + "','" + check.Address2 + "','" + check.Address3 + "','" + check.Address4 + "','" + check.Address5 + "','" + check.Address6 + "')"; oCommand = new OleDbCommand(sql, oConnect); oCommand.ExecuteNonQuery(); } } oConnect.Close(); // } // } } } foreach (string checktype in listofchecks) { if (checktype == "CW") { // var checksorder = _checks.FirstOrDefault(e => e.ChkType == checktype); // _outputFolder = "CheckWrite"; dbConnection = "Provider=VfpOleDB.1; Data Source=" + Application.StartupPath + "\\" + Form1.banks + "\\Output\\" + CBS.outputFolder + "\\Packing.DBF" + "; Mode=ReadWrite;"; //Check if packing file exists //if (!File.Exists(_filepath)) //{ OleDbConnection oConnect = new OleDbConnection(dbConnection); OleDbCommand oCommand; oConnect.Open(); oCommand = new OleDbCommand("DELETE FROM PACKING", oConnect); oCommand.ExecuteNonQuery(); foreach (var check in _checks) { if (check.ChkName == "") { //i++; oConnect.Close(); } else { if (tempCheckType != check.ChkType) { blockNo = 1; } tempCheckType = check.ChkType; if (blockCounter < 4) { blockCounter++; } else { blockCounter = 1; blockNo++; } string sql = "INSERT INTO PACKING (BATCHNO,BLOCK, RT_NO,BRANCH, ACCT_NO, ACCT_NO_P, CHKTYPE, ACCT_NAME1,ACCT_NAME2," + "NO_BKS, CK_NO_B, CK_NO_E, DELIVERTO, ADDRESS1, ADDRESS2,ADDRESS3,ADDRESS4, ADDRESS5, ADDRESS6 ) VALUES('" + _batchNumber + "'," + blockNo.ToString() + ",'" + check.BRSTN + "','" + check.BranchName + "','" + check.AccountNo + "','" + check.AccountNo + "','" + check.ChkType + "','" + check.AccountName.Replace("'", "''") + "','" + check.AccountName2.Replace("'", "''") + "',1,'" + check.StartingSerial + "','" + check.EndingSerial + "','','" + check.BranchName + "','" + check.Address2 + "','" + check.Address3 + "','" + check.Address4 + "','" + check.Address5 + "','" + check.Address6 + "')"; oCommand = new OleDbCommand(sql, oConnect); oCommand.ExecuteNonQuery(); } } oConnect.Close(); // } // } } } }
//string folderName = ""; public void DoBlockProcess(List <OrderModel> _checks, CBS _mainForm) { string outputFolder = Application.StartupPath + "\\" + Form1.banks + "\\Output"; var listofcheck = _checks.Select(r => r.ChkType).ToList(); foreach (string Scheck in listofcheck) { if (Scheck == "A") { string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\BlockP.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checks.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToBlockText(checks, "PERSONAL", _mainForm.batchfile, _mainForm.deliveryDate, LogIn.userName); file.WriteLine(output); } } } foreach (string Scheck in listofcheck) { if (Scheck == "B") { string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\BlockC.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checks.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToBlockText(checks, "COMMERCIAL", _mainForm.batchfile, _mainForm.deliveryDate, LogIn.userName); file.WriteLine(output); } } } foreach (string Scheck in listofcheck) { if (Scheck == "CW") { //_outpuFolder = "Check Write"; string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\BlockP.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checks.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToBlockText(checks, "Check Write", _mainForm.batchfile, _mainForm.deliveryDate, LogIn.userName); file.WriteLine(output); } } } foreach (string Scheck in listofcheck) { if (Scheck == "CV") { // _outpuFolder = "Check with Voucher"; string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\BlockP.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checks.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToBlockText(checks, "Check With Voucher", _mainForm.batchfile, _mainForm.deliveryDate, LogIn.userName); file.WriteLine(output); } } } }
public void PackingText(List <OrderModel> _checksModel, CBS _mainForm) { StreamWriter file; DbConServices db = new DbConServices(); // db.GetAllData(_checksModel, _mainForm._batchfile); var listofcheck = _checksModel.Select(e => e.ChkType).ToList(); string outputFolder = Application.StartupPath + "\\" + Form1.banks + "\\Output"; foreach (string Scheck in listofcheck) { if (Scheck == "A") { string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\PackingP.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checksModel.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToPackingList(checks, "PERSONAL", _mainForm); file.WriteLine(output); } } } foreach (string Scheck in listofcheck) { if (Scheck == "B") { string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\PackingC.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checksModel.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToPackingList(checks, "COMMERCIAL", _mainForm); file.WriteLine(output); } } } foreach (string Scheck in listofcheck) { if (Scheck == "CW") { //_outputFolder = "Check Write"; string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\PackingA.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checksModel.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToPackingList(checks, "Check Write", _mainForm); file.WriteLine(output); } } } foreach (string Scheck in listofcheck) { if (Scheck == "CV") { //_outputFolder = "Check with Voucher"; string packkingListPath = outputFolder + "\\" + CBS.outputFolder + "\\PackingB.txt"; if (File.Exists(packkingListPath)) { File.Delete(packkingListPath); } var checks = _checksModel.Where(a => a.ChkType == Scheck).Distinct().ToList(); file = File.CreateText(packkingListPath); file.Close(); using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append))) { string output = DataOutputServices.ConvertToPackingList(checks, "Check with Voucher", _mainForm); file.WriteLine(output); } } } }
public void OnPost() { int total = 0; // Message = "OnPost"; if (ModelState.IsValid) { int Confirmation; List <GolfGameHole> holes = new List <GolfGameHole>(); GolfGameHole golfGameHole1 = new GolfGameHole { HoleNumber = 1, Score = Hole1Field, }; holes.Add(golfGameHole1); GolfGameHole golfGameHole2 = new GolfGameHole { HoleNumber = 2, Score = Hole2Field, }; holes.Add(golfGameHole2); GolfGameHole golfGameHole3 = new GolfGameHole { HoleNumber = 3, Score = Hole3Field, }; holes.Add(golfGameHole3); GolfGameHole golfGameHole4 = new GolfGameHole { HoleNumber = 4, Score = Hole4Field, }; holes.Add(golfGameHole4); GolfGameHole golfGameHole5 = new GolfGameHole { HoleNumber = 5, Score = Hole5Field, }; holes.Add(golfGameHole5); GolfGameHole golfGameHole6 = new GolfGameHole { HoleNumber = 6, Score = Hole6Field, }; holes.Add(golfGameHole6); GolfGameHole golfGameHole7 = new GolfGameHole { HoleNumber = 7, Score = Hole7Field, }; holes.Add(golfGameHole7); GolfGameHole golfGameHole8 = new GolfGameHole { HoleNumber = 8, Score = Hole8Field, }; holes.Add(golfGameHole8); GolfGameHole golfGameHole9 = new GolfGameHole { HoleNumber = 9, Score = Hole9Field, }; GolfGameHole golfGameHole10 = new GolfGameHole { HoleNumber = 10, Score = Hole10Field, }; holes.Add(golfGameHole10); GolfGameHole golfGameHole11 = new GolfGameHole { HoleNumber = 11, Score = Hole11Field, }; holes.Add(golfGameHole11); GolfGameHole golfGameHole12 = new GolfGameHole { HoleNumber = 12, Score = Hole12Field, }; holes.Add(golfGameHole12); GolfGameHole golfGameHole13 = new GolfGameHole { HoleNumber = 13, Score = Hole13Field, }; holes.Add(golfGameHole13); GolfGameHole golfGameHole14 = new GolfGameHole { HoleNumber = 14, Score = Hole14Field, }; holes.Add(golfGameHole14); GolfGameHole golfGameHole15 = new GolfGameHole { HoleNumber = 15, Score = Hole15Field, }; holes.Add(golfGameHole15); GolfGameHole golfGameHole16 = new GolfGameHole { HoleNumber = 16, Score = Hole16Field, }; holes.Add(golfGameHole16); GolfGameHole golfGameHole17 = new GolfGameHole { HoleNumber = 17, Score = Hole17Field, }; holes.Add(golfGameHole17); GolfGameHole golfGameHole18 = new GolfGameHole { HoleNumber = 18, Score = Hole18Field, }; holes.Add(golfGameHole18); foreach (var hole in holes) { total += hole.Score; } GolfGame golfGame = new GolfGame { MemberNumber = MemberNumberField, GolfCourse = GolfCourseField, GolfGameDate = GolfGateDate, CourseRating = CourseRatingField, SlopeRating = SlopeRatingField, TotalScore = total, holeList = holes }; CBS RequestDirector = new CBS(); Confirmation = RequestDirector.AddGameScore(golfGame); Message = $" {golfGame.GolfCourse}:{Confirmation} added"; } else { Message = $"Not Valid"; } }
public void OnGet() { CBS systemControl = new CBS(); _sampleObjectCollection = systemControl.GetStandingTeeTimeList(); }