public static void ProcessArchiving(string _batchNumber, string _processBy, OrderSorted _orders = null) { ProcessSQLDump(); Process proc = new Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "\"" + GetWinZipLoc().Replace("\\", "\\\\") + "\""; proc.StartInfo.Arguments = "-u -r -p " + "\"" + DatabaseConnection.ArchiveOutPut + "\\AFT" + _batchNumber + "_" + _processBy + ".zip\"" + " " + "\\\\192.168.0.254\\captive\\Auto\\SBTC\\SBTC_NEW\\Output\\*.*"; proc.Start(); proc.WaitForExit(); proc.Close(); }//END FUNCTION
private void DisplayData(List <OrderModel> _orders) { sortedList = ReturnMe.Sort(_orders); string display = ""; if (sortedList.RegularPersonal.Count > 0) { display += "Regular Personal - " + sortedList.RegularPersonal.Count.ToString() + "\n"; } if (sortedList.RegularCommercial.Count > 0) { display += "Regular Commercial - " + sortedList.RegularCommercial.Count.ToString() + "\n"; } if (sortedList.ManagersCheck.Count > 0) { display += "Manager's Check - " + sortedList.ManagersCheck.Count.ToString() + "\n"; } if (sortedList.GiftCheck.Count > 0) { display += "Gift Check - " + sortedList.GiftCheck.Count.ToString() + "\n"; } if (sortedList.PersonalPreEncoded.Count > 0) { display += "Personal Pre-Encoded - " + sortedList.PersonalPreEncoded.Count.ToString() + "\n"; } if (sortedList.CommercialPreEncoded.Count > 0) { display += "Commercial Pre-Encoded - " + sortedList.CommercialPreEncoded.Count.ToString() + "\n"; } if (sortedList.CheckOnePersonal.Count > 0) { display += "CheckOne Personal - " + sortedList.CheckOnePersonal.Count.ToString() + "\n"; } if (sortedList.CheckOneCommerical.Count > 0) { display += "CheckOne Commercial - " + sortedList.CheckOneCommerical.Count.ToString() + "\n"; } if (sortedList.CheckPowerPersonal.Count > 0) { display += "CheckPower Personal - " + sortedList.CheckPowerPersonal.Count.ToString() + "\n"; } if (sortedList.CheckPowerCommercial.Count > 0) { display += "CheckPower Commercial - " + sortedList.CheckPowerCommercial.Count.ToString() + "\n"; } if (sortedList.CustomizedCheck.Count > 0) { display += "Customized Check - " + sortedList.CustomizedCheck.Count.ToString() + "\n"; } if (sortedList.ManagersCheckCont.Count > 0) { display += "Manager's Check Continous - " + sortedList.ManagersCheckCont.Count.ToString() + "\n"; } lblTotal.Text = display; }
public static void SaveHistory(OrderSorted _orders, string _batch, string _ext, DateTime _deliveryDate) { MySqlConnection myConn = new MySqlConnection(DatabaseConnection.ConnectionString); myConn.Open(); MySqlCommand cmd; string query = "INSERT INTO captive_database.sbtc_history (Date, Time, DeliveryDate, ChkType, ChequeName, BRSTN, " + "AccountNo, Name1, Name2, StartingSerial, ENdingSerial, Batch, FinalBatch, Address1, " + "Address2, Address3, Address4, Address5, Address6, DeliverTo, BranchName) "; #region Regular Personal if (_orders.RegularPersonal.Count > 0) { _orders.RegularPersonal.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 7) { start = "0" + start; } while (end.Length < 7) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Regular Personal','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region Regular Commercial if (_orders.RegularCommercial.Count > 0) { _orders.RegularCommercial.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Regular Commercial','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region Regular Personal Pre-Encoded if (_orders.PersonalPreEncoded.Count > 0) { _orders.PersonalPreEncoded.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 7) { start = "0" + start; } while (end.Length < 7) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Personal Pre-Encoded','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region Regular Commercial Pre-Encoded if (_orders.CommercialPreEncoded.Count > 0) { _orders.CommercialPreEncoded.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Commercial Pre-Encoded','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region CheckOne Personal if (_orders.CheckOnePersonal.Count > 0) { _orders.CheckOnePersonal.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 7) { start = "0" + start; } while (end.Length < 7) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','CheckOne Personal','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region CheckOne Commercial if (_orders.CheckOneCommerical.Count > 0) { _orders.CheckOneCommerical.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','CheckOne Commercial','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region CheckPower Personal if (_orders.CheckPowerPersonal.Count > 0) { _orders.CheckPowerPersonal.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 7) { start = "0" + start; } while (end.Length < 7) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','CheckPower Personal','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region CheckPower Commercial if (_orders.CheckPowerCommercial.Count > 0) { _orders.CheckPowerCommercial.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','CheckPower Commercial','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region Manager's Check if (_orders.ManagersCheck.Count > 0) { _orders.ManagersCheck.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Manager''s Check','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region Manager's Check Cont if (_orders.ManagersCheckCont.Count > 0) { _orders.ManagersCheckCont.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Manager''s Check Continues','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); }//END IF #endregion #region GiftCheck if (_orders.GiftCheck.Count > 0) { _orders.GiftCheck.ForEach(order => { string start = order.StartingSerial.ToString(), end = order.EndingSerial.ToString(); while (start.Length < 10) { start = "0" + start; } while (end.Length < 10) { end = "0" + end; } string values = "VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + DateTime.Now.ToString("H:mm") + "','" + _deliveryDate.ToString("yyyy-MM-dd") + "','" + order.CheckType + "','Gift Check','" + order.BRSTN + "','" + order.AccountNo + "','" + order.Name.Replace("'", "''") + "','" + order.Name2.Replace("'", "''") + "','" + start + "','" + end + "','" + order.FileName + "','" + _batch + "','" + order.Address1.Replace("'", "''") + "','" + order.Address2.Replace("'", "''") + "','" + order.Address3.Replace("'", "''") + "','" + order.Address4.Replace("'", "''") + "','" + order.Address5.Replace("'", "''") + "','" + order.Address6.Replace("'", "''") + "', " + "'" + order.DeliverTo + "','" + order.Address1 + "');"; cmd = new MySqlCommand(query + values, myConn); cmd.ExecuteNonQuery(); }); } #endregion myConn.Close(); }//END FUNCTION