public void TestAddToRebateList() { int transactionID = 1; String rebatesBefore = RebateDB.GenerateRebateChecks(); // Create Transaction int salesID = 1; int itemID = 1; int itemQuantity = 1; double itemCost = 2.29; // double rebatePercent = .05; // double totalRebate = itemQuantity * itemCost * rebatePercent; Product p1 = new Product("Diapers", itemID, itemCost); Tuple <Product, int> tuple1 = new Tuple <Product, int>(p1, itemQuantity); List <Tuple <Product, int> > items = new List <Tuple <Product, int> >(); Transaction t1 = new Transaction(salesID, items); TransactionDB.AddTransaction(t1); // create a rebates controller and try to access the transaction and then rebate it. However, error with Transactions so fails Observer ob = new Observer((string s, State status) => { Assert.AreNotEqual(rebatesBefore, s); Assert.AreEqual(status, State.Rebate); }); ReturnController controller = new ReturnController(); controller.RegisterR(ob); controller.ProcessReturn(1, 1, 1); }
// // GET: /Sends/Failed?sendID= public ActionResult Failed(string sendID, int page = 1, int pageSize = 25) { int bounceCount = TransactionDB.GetFailedCount(sendID); int pageCount = (int)Math.Ceiling(bounceCount / Convert.ToDouble(pageSize)); return(View(new SendReportBounces(TransactionDB.GetFailedInfo(sendID, page, pageSize), sendID, page, pageCount))); }
public double BillingCapCalc(DateTime DTStart, DateTime DTEnd, string eventName, string familyID, double eventFee) { TransactionDB transDB = new TransactionDB(); double cap = settings.GetBillingCap(); string start = DTStart.ToString("yyyy-MM-dd"); string end = DTEnd.ToString("yyyy-MM-dd"); if (eventName.CompareTo("Regular Childcare") == 0 || eventName.CompareTo("Infant Childcare") == 0 || eventName.CompareTo("Adolescent Childcare") == 0) { object recordFound = transDB.SumRegularCare(start, end, familyID); double sum; if (recordFound == DBNull.Value || recordFound == null) { return(0); } else { sum = Convert.ToDouble(recordFound); } double total = sum + eventFee; double capdiff = total - cap; if (capdiff > 0 && capdiff < eventFee) { return(capdiff); } else if (capdiff >= eventFee) { return(eventFee); } } return(0.0); }
private bool VerifyTextBox() { TransactionDB db = new TransactionDB(); int temp; if (txt_TransactionID.Text.Length == 10 && Int32.TryParse(txt_TransactionID.Text, out temp)) { if (db.TransactionExists(txt_TransactionID.Text)) { return(true); } else { WPFMessageBox.Show("The Transaction ID you entered does not exist in the database. Verify you entered the correct Transaction ID."); txt_TransactionID.Focus(); return(false); } } else { WPFMessageBox.Show("The Transaction ID you entered does not exist in the database. Verify you entered the correct Transaction ID."); txt_TransactionID.Focus(); return(false); } }
private void LoadTransactions() { TransactionDB transDB = new TransactionDB(); DataTable table = transDB.GetTransactions(); TransactionDataGrid.ItemsSource = table.DefaultView; }
private void SubmitChanges() { TransactionDB transDB = new TransactionDB(); string transID, eventName, transDate, checkedIn, checkedOut, transTotal; eventName = ((ComboBoxItem)cmb_EventName.SelectedItem).Content.ToString(); SetAllowanceID(); transDate = FormatDate(txt_Date.Text); checkedIn = FormatTime(txt_CheckIn.Text); checkedOut = FormatTime(txt_CheckOut.Text); transTotal = txt_TransactionTotal.Text; CheckForLateTime(checkedOut, transDate); if (this.transactionID == "") { transID = transDB.GetNextTransID(); transDB.NewTransaction(transID, eventName, this.allowanceID, transDate, checkedIn, checkedOut, transTotal); transaction.CompleteTransaction(Convert.ToDouble(this.txt_TransactionTotal.Text), eventName, DateTime.Parse(transDate).ToString("yyyy-MM-dd")); } else { transDB.UpdateTransaction(this.transactionID, eventName, this.allowanceID, transDate, checkedIn, checkedOut, transTotal); transaction.CompleteTransaction(Convert.ToDouble(this.txt_TransactionTotal.Text), eventName, DateTime.Parse(transDate).ToString("yyyy-MM-dd")); transaction.AddToBalance(this.originalEventName, (this.originalFee) * (-1)); } }
public String Deposit(Transaction transaction) { TransactionDB.Deposit(transaction); double balance = AccountDB.getBalance(transaction.Acctno); return("Deposit of $" + transaction.Amount + " made to account " + transaction.Acctno + " ($" + balance + " remaining)"); }
public void TestGetTransasctionInt() { Tuple <Product, int> item1 = new Tuple <Product, int>((new Product("Milk", 1, 1.89)), 3); Tuple <Product, int> item2 = new Tuple <Product, int>((new Product("Eggs", 2, 1.29)), 3); List <Tuple <Product, int> > list = new List <Tuple <Product, int> >(); list.Add(item1); list.Add(item2); Transaction tran = new Transaction(1, list); TransactionDB.AddTransaction(tran); Tuple <Product, int> item3 = new Tuple <Product, int>((new Product("Milk", 1, 1.89)), 3); Tuple <Product, int> item4 = new Tuple <Product, int>((new Product("Eggs", 2, 1.29)), 3); list = new List <Tuple <Product, int> >(); list.Add(item3); list.Add(item4); Transaction tran2 = new Transaction(2, list); TransactionDB.AddTransaction(tran2); Assert.AreEqual(TransactionDB.GetTransactionInt(), 4); }
static void test4() { var db = TransactionDB.Open(new DbOptions().SetCreateIfMissing(true), new TransactionDBOptions(), "transaction_db_test"); var txnOp = new TransactionOptions(); var wop = new WriteOptions(); int count = 0; while (true) { var txn = new Transaction(db, wop, txnOp); string key = testkey; txn.Put(key, data + count++); txn.Get(key); txn.Put(key, data + count++); txn.Get(key); txn.Put(key, data + count++); txn.Get(key); if (count % 2 == 0) { txn.Commit(); } else { txn.Rollback(); } if (count % 30000 == 0) { Console.WriteLine("run count:" + count / 3); } Thread.Sleep(1); } }
private void UpdateBalance(double num) { TransactionDB transDB = new TransactionDB(); if (this.type == "Regular") { transDB.UpdateRegularBalance(this.guardianID, (num)); this.callingWindow.UpdateRegularDue(this.guardianID); } else if (this.type == "Camp") { transDB.UpdateCampBalance(this.guardianID, (num)); this.callingWindow.UpdateCampDue(this.guardianID); } else if (this.type == "Misc") { transDB.UpdateMiscBalance(this.guardianID, (num)); this.callingWindow.UpdateMiscDue(this.guardianID); } else { WPFMessageBox.Show("A valid type was not sent to the PaymentEntry window!"); } this.Close(); }
internal bool PrepareTransaction(string childID, string guardianID) { TransactionDB transDB = new TransactionDB(); string[] transaction = transDB.FindTransaction(this.allowanceID); if (transaction == null || this.allowanceID == null) { WPFMessageBox.Show("Unable to check out child. Please log out then try again."); return(false); } this.eventName = transaction[1]; string transactionDate = transaction[3]; string checkInTime = transaction[4]; checkInTime = Convert.ToDateTime(checkInTime).ToString("HH:mm:ss"); string checkOutTime = DateTime.Now.ToString("HH:mm:ss"); double eventFee = FindEventFee(guardianID, eventName); this.lateTime = settings.CheckIfPastClosing(DateTime.Now.DayOfWeek.ToString(), TimeSpan.Parse(checkOutTime)); eventFee = CalculateTransaction(checkInTime, checkOutTime, eventName, eventFee); string eventFeeRounded = eventFee.ToString("f2"); db.CheckOut(DateTime.Now.ToString("HH:mm:ss"), eventFeeRounded, this.allowanceID); CompleteTransaction(eventFee, this.eventName, DateTime.Now.ToString("yyyy-MM-dd")); return(true); }
static void test6() { var dbop = new DbOptions() .SetCreateIfMissing(true) .SetCreateMissingColumnFamilies(true); var columnFamilies = new ColumnFamilies { { "reverse1", new ColumnFamilyOptions() }, { "reverse2", new ColumnFamilyOptions() }, }; var db = TransactionDB.Open(dbop, new TransactionDBOptions(), "transaction_db_test2", columnFamilies); var cfs = db.GetColumnFamilyHandleMap(); foreach (var it in cfs) { Console.WriteLine("cf=" + it.Key); } var reverse = db.GetColumnFamily("reverse1"); db.Put("uno", "one", cf: reverse); db.Put("dos", "two", cf: reverse); db.Put("tres", "three", cf: reverse); db.Dispose(); db = TransactionDB.Open(new DbOptions().SetCreateIfMissing(true), new TransactionDBOptions(), "transaction_db_test2", columnFamilies); reverse = db.GetColumnFamily("reverse1"); Console.WriteLine(db.Get("uno", reverse)); Console.WriteLine(db.Get("dos", reverse)); Console.WriteLine(db.Get("tres", reverse)); db.Dispose(); }
public async Task <IActionResult> Detail(string?id, string?date) { int labID = Int16.Parse(id ?? "1"); DateTime datetime = DateTime.ParseExact(date ?? DateTime.Now.ToString("yyyy-MM-dd HH:mm"), "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture); Laboratory lab = LabDB.GetByID(Int16.Parse(id ?? "1")); List <LabItem> items = new List <LabItem>(); IList <ItemDetail> labItems = await ItemDB.GetAllDetailByLabIDAsync(Int16.Parse(id ?? "1")); List <List <int> > allQuantity = await LabItemDB.GetCurrentQuantityByDateAsync(datetime); List <Transaction> transactions = await TransactionDB.GetByLabIDAndDateAsync(labID, datetime); List <int> availableNumber = new List <int> { allQuantity[0][labID - 1], allQuantity[1][labID - 1] }; List <Laboratory> labList = await LabDB.GetAllAsync(); List <int> type = await ItemDB.GetItemSetByLabIDAsync(labID); Dictionary <int, string> types = await ItemDB.GetItemSetAsync(); List <string> realType = new List <string>(); for (int i = 0; i < labItems.Count; i++) { var available = 0; string am = "NO"; var pm = "NO"; for (int j = 0; j < transactions.Count; j++) { if (labItems[i].uuid == transactions[j].item_id) { available = transactions[j].time_id; } } var pmm = 1 & (available >> 1); var amm = 1 & available; am = amm == 0 ? "YES" : "NO"; pm = pmm == 0 ? "YES" : "NO"; items.Add(new LabItem(labItems[i].uuid.ToString(), labItems[i].name, am, pm)); } foreach (var it in types) { realType.Add(it.Value.Substring(0, it.Value.Length - 2)); } ViewData["LabItems"] = items; ViewData["Title"] = labList; ViewData["Description"] = lab.description; ViewData["LabID"] = id; ViewData["Date"] = datetime.ToString("yyyy-MM-dd"); ViewData["Available"] = availableNumber; ViewData["Type"] = realType; ViewData["EnableType"] = type; return(View()); }
public List <Test> GetTransactionById(int id) { ITransactionDB transactionDB = new TransactionDB(); ITransactionManager transactionManager = new TransactionManager(transactionDB); return(transactionManager.GetTransactionById(id)); }
static void Main(string[] args) { TransactionDB transactionDB = new TransactionDB(0.01M, false); transactionDB.LoadTransactionDB(); transactionDB.GenerateApriori(); }
public int UpdateTransaction(Student student, double mouve) { IStudentDB studentDB = new StudentDB(); IStudentManager studentManager = new StudentManager(studentDB); ITransactionDB transactionDB = new TransactionDB(); ITransactionManager transactionManager = new TransactionManager(transactionDB); return(transactionManager.UpdateTransaction(student, mouve)); }
public void CompleteTransaction(double eventFee, string name, string date) { TransactionDB transDB = new TransactionDB(); AddToBalance(name, eventFee); if (this.isLate && name.CompareTo("Late Fee") != 0) { double lateFee = CalculateLateFee(date); } }
public async Task <IActionResult> OnDeleteTransaction(int transactionID) { if (transactionID > 0) { List <Transaction> transactions = await TransactionDB.GetAsync(transactionID); TransactionDB.Delete(transactions[0]); } return(RedirectToAction("Blacklist")); }
public async Task <IActionResult> OnCancelTransaction(int cancelTransactionID) { if (cancelTransactionID > 0) { List <Transaction> transactions = await TransactionDB.GetAsync(cancelTransactionID); TransactionDB.Cancel(transactions[0]); } return(RedirectToAction("Blacklist")); }
private void btn_DeleteTransaction_Click(object sender, RoutedEventArgs e) { if (VerifyTextBox()) { TransactionDB db = new TransactionDB(); UpdateTotals(); db.DeleteTransaction(txt_TransactionID.Text); LoadTransactions(); } }
public bool UpdateIsSendMail(long pId, string LoginName, TransactionDB trans) { bool ret = false; try { ErmTsPersonalInfoLinq erm = new ErmTsPersonalInfoLinq(); ret = erm.UpdateBySql("update ERM_TS_PERSONAL_INFO set is_send_mail = 'Y' where id='" + pId + "'", trans.Trans); erm = null; } catch (Exception ex) { ret = false; } return ret; }
public String PayBill(Transaction transaction) { bool sufficientFunds = TransactionDB.Withdraw(transaction); double balance = AccountDB.getBalance(transaction.Acctno); if (!sufficientFunds) { return("Insufficient funds ($" + balance + ") in account " + transaction.Acctno + " to pay bill of $" + transaction.Amount); } return("Bill of $" + transaction.Amount + " paid with account " + transaction.Acctno + " ($" + balance + " remaining)"); }
public String WriteCheck(Transaction transaction) { bool sufficientFunds = TransactionDB.Withdraw(transaction); double balance = AccountDB.getBalance(transaction.Acctno); if (!sufficientFunds) { return("Insufficient funds ($" + balance + ") in account " + transaction.Acctno + " to write check for $" + transaction.Amount); } return("Check for $" + transaction.Amount + " written with account " + transaction.Acctno + " ($" + balance + " remaining)"); }
// // GET: /Bounces/ public ActionResult Index(int?page = 1, int?pageSize = 25) { long deferred, rejected = 0; TransactionDB.GetBounceDeferredAndRejected(out deferred, out rejected); return(View(new BounceModel { BounceInfo = TransactionDB.GetBounceInfo(null, page.Value, pageSize.Value), CurrentPage = page.Value, PageCount = (int)Math.Ceiling(Convert.ToDouble(TransactionDB.GetBounceCount(null)) / pageSize.Value), DeferredCount = deferred, RejectedCount = rejected })); }
public ActualizarTransaccionResponse ActualizarTransaccion(ActualizarTransaccionRequest actualizarTransaccion) { string methodName = string.Format("{0}", System.Reflection.MethodBase.GetCurrentMethod().Name); this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName) .Message("Started")); ActualizarTransaccionResponse response = new ActualizarTransaccionResponse(); string sessionId = this.GetSessionId(actualizarTransaccion, response, out this.errorMessage); this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName) .Message("[" + sessionId + "] " + "Actualizando transaccion. " + String.Concat( "CodigoTransaccionExterno: ", actualizarTransaccion.CodigoTransaccionExterno, ", CodigoTransaccion: ", actualizarTransaccion.CodigoTransaccion, ", Estado: ", actualizarTransaccion.Estado, ", Mensaje: ", actualizarTransaccion.Mensaje ) )); if (this.errorMessage != ErrorMessagesMnemonics.None) { this.LogResponse(response); return(response); } try { int r = new TransactionDB().UpdateTransaction(actualizarTransaccion); return(new ActualizarTransaccionResponse { ResponseMessage = "Ok", ResponseCode = 0, TransactionID = r }); } catch (Exception e) { this.ProviderLogger.ExceptionHigh(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "]") .Exception(e)); return(new ActualizarTransaccionResponse { ResponseMessage = e.Message }); } finally { this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName) .Message("[" + sessionId + "] " + "Fin Actualización")); } }
private void ReadyTransaction(object sender, RoutedEventArgs e) { TransactionDB transDB = new TransactionDB(); ConnectionsDB conDB = new ConnectionsDB(); ChildInfoDatabase childDB = new ChildInfoDatabase(); GuardianInfoDB parentDB = new GuardianInfoDB(); if (parentDB.GuardianNameExists(txt_GuardianName.Text) && childDB.ChildNameExists(txt_ChildName.Text)) { SetAllowanceID(); this.transaction = new TransactionCharge(conDB.GetGuardianID(allowanceID), allowanceID); CalculateTransaction(sender, e); } }
internal double CalculateLateFee(string date) { TransactionDB transDB = new TransactionDB(); EventDB eventDB = new EventDB(); String name = "Late Fee"; double lateFee = eventDB.GetLateFee(name); lateFee = lateFee * this.lateTime; string maxTransactionID = transDB.GetNextTransID(); transDB.AddLateFee(maxTransactionID, name, this.allowanceID, date, lateFee); transDB.UpdateBalances(guardianID, lateFee, "MiscTotal"); return(lateFee); }
public async Task <ActionResult <HttpResponseMessage> > Delete(int transaction_id) // not sure about "Item" { if (transaction_id > 0) { List <Transaction> transactions = await TransactionDB.GetAsync(transaction_id); TransactionDB.Cancel(transactions[0]); return(StatusCode(204)); } else { return(StatusCode(400)); } }
// // GET: /Dashboard/ public ActionResult Index() { DashboardModel model = new DashboardModel { SendTransactionSummaryCollection = TransactionDB.GetLastHourTransactionSummary(), Waiting = SendDB.GetQueueCount(new SendStatus[] { SendStatus.Active, SendStatus.Discard }), Paused = SendDB.GetQueueCount(new SendStatus[] { SendStatus.Paused }), BounceInfo = TransactionDB.GetLastHourBounceInfo(3), SendSpeedInfo = TransactionDB.GetLastHourSendSpeedInfo() }; try { // Connect to Rabbit MQ and grab basic queue counts. HttpWebRequest request = HttpWebRequest.CreateHttp("http://localhost:15672/api/queues"); request.Credentials = new NetworkCredential(MtaParameters.RabbitMQ.Username, MtaParameters.RabbitMQ.Password); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { string json = new StreamReader(response.GetResponseStream()).ReadToEnd(); JArray rabbitQueues = JArray.Parse(json); foreach (JToken q in rabbitQueues.Children()) { JEnumerable <JProperty> qProperties = q.Children <JProperty>(); string queueName = (string)qProperties.First(x => x.Name.Equals("name")).Value; if (queueName.StartsWith("manta_mta_")) { long messages = (long)qProperties.First(x => x.Name.Equals("messages", System.StringComparison.OrdinalIgnoreCase)).Value; if (queueName.IndexOf("_inbound") > 0) { model.RabbitMqInbound += messages; } else if (queueName.IndexOf("_outbound_") > 0) { model.RabbitMqTotalOutbound += messages; } } } } } catch (Exception) { model.RabbitMqInbound = int.MinValue; model.RabbitMqTotalOutbound = int.MinValue; } return(View(model)); }
public long SavePersonalInfo(ErmTsPersonalInfoPara p,string LoginName, TransactionDB trans) { long ret = 0; try { ErmTsPersonalInfoLinq lnq = new ErmTsPersonalInfoLinq(); if (p.ID > 0) lnq.GetDataByPK(p.ID, trans.Trans); lnq.MEMBER_NO = p.MEMBER_NO; lnq.MEMBER_TYPE = p.MEMBER_TYPE; lnq.IDCARD_NO = p.IDCARD_NO; lnq.TITLE_NAME = p.TITLE_NAME; lnq.FIRST_NAME = p.FIRST_NAME; lnq.MIDDLE_NAME = p.MIDDLE_NAME; lnq.LAST_NAME = p.LAST_NAME; lnq.POSITION_NAME = p.POSITION_NAME; lnq.DIVISION = p.DIVISION; lnq.COMPANY_NAME = p.COMPANY_NAME; lnq.ADDRESS = p.ADDRESS; lnq.CITY = p.CITY; lnq.STATE = p.STATE; lnq.COUNTRY = p.COUNTRY; lnq.ZIPCODE = p.ZIPCODE; lnq.TELNO = p.TELNO; lnq.MOBILE_NO = p.MOBILE_NO; lnq.FAXNO = p.FAXNO; lnq.EMAIL = p.EMAIL; lnq.WEBSITE = p.WEBSITE; lnq.REGISTERED_CAPITAL = p.REGISTERED_CAPITAL; lnq.ANNUAL_SALE_VALUE_YEAR = p.ANNUAL_SALE_VALUE_YEAR; lnq.ANNUAL_SALE_VALUE_VOLUMNS = p.ANNUAL_SALE_VALUE_VOLUMNS; lnq.REGISPERIOD = p.REGISPERIOD; lnq.VALID_DATE = p.VALID_DATE; lnq.EXPIRE_DATE = p.EXPIRE_DATE; bool re = false; if (lnq.ID > 0) re = lnq.UpdateByPK(LoginName, trans.Trans); else re = lnq.InsertData(LoginName, trans.Trans); if (re == true) ret = lnq.ID; }catch(Exception ex){ _err = "Engine.Questionnaire.RegisteENG.SavePersonalInfo Exception :" + ex.Message; ret=0; } return ret; }
public void TestAllTestDB() { Product p = new Product("Test", 1, 1.99); Tuple <Product, int> tuple = new Tuple <Product, int>(p, 1); List <Tuple <Product, int> > l = new List <Tuple <Product, int> >(); l.Add(tuple); Transaction trans = new Transaction(1, l); TransactionDB.AddTransaction(trans); Assert.Equals(TransactionDB.GetTransaction(1).GetItems[0].Item1.GetName, "Test"); }
static void test5() { var db = TransactionDB.Open(new DbOptions().SetCreateIfMissing(true), new TransactionDBOptions(), "transaction_db_test"); using (var it = db.NewIterator()) { it.SeekToFirst(); while (it.Valid()) { var key = Encoding.Default.GetString(it.Key()); var value = Encoding.Default.GetString(it.Value()); Console.WriteLine("key=" + key + ",value=" + value); it.Next(); } } }
public bool DeleteInterest(long pId ,TransactionDB trans) { bool ret = false; try { int rowdelete = 0; rowdelete = Linq.Common.Utilities.SqlDB.ExecuteNonQuery("delete from scoresolutions.ERM_TS_INTEREST where erm_ts_personal_info_id ='" + pId + "'"); ret = true; } catch (Exception ex) { ret = false; } return ret; }
protected void btnOK_Click(object sender, EventArgs e) { lblerror.Text = ""; if ((txtEmail.Text.Trim()) != "" && (txtEmail.Text.IndexOf("@") < 0)) { lblerror.Text = "กรุณาระบุ E-mail ให้ถูกต้อง"; return; } if (txtEmail.Text.Trim() == "" && txtMobileNo.Text.Trim() =="") { lblerror.Text = "กรุณาระบุข้อมูลเพื่อค้นหา"; return; } Linq.TABLE.ErmTsPersonalInfoLinq lnq = new Linq.TABLE.ErmTsPersonalInfoLinq(); DataTable dt = new DataTable(); TransactionDB trans = new TransactionDB(); string sql = "select count(*) from ERM_TS_PERSONAL_INFO where 1=1"; if (txtEmail.Text.Trim() != "") { sql += " And Email ='" + txtEmail.Text.Trim() + "' "; } if (txtMobileNo.Text.Trim() != "") { sql += " And mobile_no ='" + txtMobileNo.Text.Trim() + "' "; } dt = lnq.GetListBySql(sql, trans.Trans); if (dt.Rows[0][0].ToString() == "0") { lblerror.Text = "ไม่พบข้อมูล กรุณาลงทะเบียนใหม่อีกครั้ง"; return; } Config.RedirecPage("../WebApp/frmRegister2.aspx?email=" + txtEmail.Text + "&telno=" + txtMobileNo.Text + "", this); }
public void OpenBrochure(Object Sender, EventArgs e) { Label lbl = (Label)Sender; TransactionDB transList = new TransactionDB(); EbrochureDocumentLinqDB Document = new EbrochureDocumentLinqDB(); DataTable dt; dt = Document.GetDataList("ebrochure_id=" + lbl.Name, "", transList.Trans); transList.CommitTransaction(); if (dt.Rows.Count > 0) { frmOpenBrochure f = new frmOpenBrochure(); f.ShowContent(dt.Rows[0]["file_path"] + "", GetBrochureName(dt.Rows[0]["ebrochure_id"] + "")); f.ShowDialog(); } }
public bool SaveInterest(ErmTsInterestPara p, string LoginName, TransactionDB trans) { bool ret = false; try { ErmTsInterestLinq lnq = new ErmTsInterestLinq(); if(p.ID>0) lnq.GetDataByPK(p.ID,trans.Trans); lnq.ERM_TS_PERSONAL_INFO_ID=p.ERM_TS_PERSONAL_INFO_ID; lnq.INTEREST_CODE=p.INTEREST_CODE; lnq.INTEREST_NAME=p.INTEREST_NAME; if (lnq.ID > 0) ret = lnq.UpdateByPK(LoginName, trans.Trans); else ret = lnq.InsertData(LoginName, trans.Trans); } catch (Exception ex) { _err = "Engine.Questionnaire.RegisteENG.SaveInterest Exception :" + ex.Message; ret=false; } return ret; }
public static bool InsertPrintJob(long PersonalID, string CreateBy, bool IsReprint) { bool ret = false; try { string sql = "insert into tb_print_job (create_by,create_on,erm_ts_personal_info_id,print_job_date,printed_date) "; sql += " values('" + CreateBy + "',getdate(), '" + PersonalID + "',getdate()"; if (IsReprint == true) { sql += ",getdate()"; }else{ sql += ", null"; } sql += " )"; TransactionDB trans = new TransactionDB(); ret = (Linq.Common.Utilities.SqlDB.ExecuteNonQuery(sql, trans.Trans) > -1); if (ret == true) { trans.CommitTransaction(); } else { trans.RollbackTransaction(); } } catch (Exception ex) { ret = false; } return ret; }
public static bool chkPrintedJob(long PrintJobID, TransactionDB trans) { bool ret = false; try { string sql = "select id "; sql += " from tb_print_job "; sql += " where id='" + PrintJobID + "' and printed_date is null "; DataTable dt = Linq.Common.Utilities.SqlDB.ExecuteTable(sql, trans.Trans); if (dt.Rows.Count > 0) { ret = true; } dt.Dispose(); } catch (Exception ex) { ret = false; } return ret; }
public static bool UpdatePrintJob(long PrintJobID, TransactionDB trans) { bool ret = false; try { string sql = "update tb_print_job "; sql += " set printed_date=getdate()"; sql += " where id = '" + PrintJobID + "' and printed_date is null"; ret = (Linq.Common.Utilities.SqlDB.ExecuteNonQuery(sql, trans.Trans) > -1); } catch (Exception ex) { ret = false; } return ret; }
public void RenderBrochure() { int iWidth = 587; int iHeight = 800; int iy = 224; panel1.Location = new Point(40, 322); panel1.Height = iHeight; panel1.Width = 750; iy = iy + iHeight; this.Width = 800; this.Height = 1224; pictureEmail.Location = new Point(221, iy + 100); //245, 653 TransactionDB trans = new TransactionDB(); //trans.CreateTransaction(); EbrochureLinqDB brochure = new EbrochureLinqDB(); DataTable dt; dt = brochure.GetDataList("", "", trans.Trans); trans.CommitTransaction(); x = 0; y =0 ; for (int i = 0; i < dt.Rows.Count; ++i) { AddItem(dt.Rows[i]["id"] + "", dt.Rows[i]["name_thai"] + ""); // ++i; } // AddItem(1, "Service"); //AddItem2(1, "count_queue"); //AddItem3(1, "wait_time"); //AddItem4(1, "app_queue"); dt.Dispose(); //FLP.Show(); panel1.Show(); }
public bool ExecuteNonQuery(string sql, TransactionDB trans) { bool ret = false; try { ret = (Linq.Common.Utilities.SqlDB.ExecuteNonQuery(sql, trans.Trans) > -1); } catch (Exception ex) { ret = false; _err = ex.Message + Environment.NewLine + ex.StackTrace; } return ret; }
protected void btnSave_Click(object sender, EventArgs e) { if (validate() == false) return; String strServerName = ConfigurationManager.AppSettings["ServerName"]; String strDbName = ConfigurationManager.AppSettings["DbName"]; String strDbUserID = ConfigurationManager.AppSettings["DbUserID"]; String strDbPwd = ConfigurationManager.AppSettings["DbPwd"]; SqlConnection objConn = new SqlConnection("Data Source=" + strServerName +";Initial Catalog=" + strDbName +";User ID=" +strDbUserID + ";password="******"0") { String strSql = ""; strSql = "Select Count(*) From ERM_TS_Personal_info Where first_name='" + txtFirstName.Text + "' And last_name='" + txtLastName.Text + "'"; SqlCommand objCmd = new SqlCommand(strSql, objConn); String Result = Convert.ToString(objCmd.ExecuteScalar()); if (Result != "0") { Config.SetAlert("ชื่อนี้ได้ทำการลงทะเบียนแล้ว", this); return; } strSql = "Select Count(*) From ERM_TS_Personal_info Where Email='" + txtEmail.Text + "' "; objCmd = new SqlCommand(strSql, objConn); Result = Convert.ToString(objCmd.ExecuteScalar()); if (Result != "0") { Config.SetAlert("อีเมลล์นี้ได้ทำการลงทะเบียนแล้ว", this); return; } strSql = "Select Count(*) From ERM_TS_Personal_info Where Mobile_No='" + txtMobileNo.Text + "' "; objCmd = new SqlCommand(strSql, objConn); Result = Convert.ToString(objCmd.ExecuteScalar()); if (Result != "0") { Config.SetAlert("เบอร์โทรนี้ได้ทำการลงทะเบียนแล้ว", this); return; } } int intChkA = 0; int intChkB = 0; int intChkC = 0; int intChkD = 0; int intChkE = 0; if ((rdPeriod.Items[0].Selected == false) && (rdPeriod.Items[1].Selected == false)) { Config.SetAlert("กรุณาเลือกช่วงเวลาเข้าร่วมงาน", this); return; } if (ChkA01.Checked == true) { intChkA += 1; } if (ChkA02.Checked == true) { intChkA += 1; } if (ChkA03.Checked == true) { intChkA += 1; } if (ChkA04.Checked == true) { intChkA += 1; } if (ChkA05.Checked == true) { intChkA += 1; } if (ChkA06.Checked == true) { intChkA += 1; } if (ChkA07.Checked == true) { intChkA += 1; } if (ChkA08.Checked == true) { intChkA += 1; } if (ChkA09.Checked == true) { intChkA += 1; } if (ChkA10.Checked == true) { intChkA += 1; } if (ChkA11.Checked == true) { intChkA += 1; } if (ChkA12.Checked == true) { intChkA += 1; } if (ChkA13.Checked == true) { intChkA += 1; } if (ChkA14.Checked == true) { intChkA += 1; } if (ChkA15.Checked == true) { intChkA += 1; } if (ChkA16.Checked == true) { intChkA += 1; } if (ChkA17.Checked == true) { intChkA += 1; } if (ChkB01.Checked == true) { intChkB += 1; } if (ChkB02.Checked == true) { intChkB += 1; } if (ChkB03.Checked == true) { intChkB += 1; } if (ChkB04.Checked == true) { intChkB += 1; } if (ChkB05.Checked == true) { intChkB += 1; } if (ChkB06.Checked == true) { intChkB += 1; } if (ChkB07.Checked == true) { intChkB += 1; } if (ChkB08.Checked == true) { intChkB += 1; } if (ChkB09.Checked == true) { intChkB += 1; } if (ChkB10.Checked == true) { intChkB += 1; } if (ChkB11.Checked == true) { intChkB += 1; } if (ChkB12.Checked == true) { intChkB += 1; } if (ChkB13.Checked == true) { intChkB += 1; } if (ChkB14.Checked == true) { intChkB += 1; } if (ChkC01.Checked == true) { intChkC += 1; } if (ChkC02.Checked == true) { intChkC += 1; } if (ChkC03.Checked == true) { intChkC += 1; } if (ChkC04.Checked == true) { intChkC += 1; } if (ChkC05.Checked == true) { intChkC += 1; } if (ChkC06.Checked == true) { intChkC += 1; } if (ChkC07.Checked == true) { intChkC += 1; } if (ChkD01.Checked == true) { intChkD += 1; } if (ChkD02.Checked == true) { intChkD += 1; } if (ChkE01.Checked == true) { intChkE += 1; } if (ChkE02.Checked == true) { intChkE += 1; } if (ChkE03.Checked == true) { intChkE += 1; } if (ChkE04.Checked == true) { intChkE += 1; } if (ChkE05.Checked == true) { intChkE += 1; } if (ChkE06.Checked == true) { intChkE += 1; } if (ChkE07.Checked == true) { intChkE += 1; } if (ChkE08.Checked == true) { intChkE += 1; } if (ChkE09.Checked == true) { intChkE += 1; } if (ChkE10.Checked == true) { intChkE += 1; } if (ChkE11.Checked == true) { intChkE += 1; } if (ChkE12.Checked == true) { intChkE += 1; } if (ChkE13.Checked == true) { intChkE += 1; } if (ChkE14.Checked == true) { intChkE += 1; } if (ChkE15.Checked == true) { intChkE += 1; } if (ChkE16.Checked == true) { intChkE += 1; } if (ChkE17.Checked == true) { intChkE += 1; } if (ChkE18.Checked == true) { intChkE += 1; } if (ChkE19.Checked == true) { intChkE += 1; } if (intChkA == 0) { Config.SetAlert("กรุณาระบุประเภทธุรกิจของท่าน", this); return; } if (intChkB == 0) { Config.SetAlert("กรุณาระบุช่องทางการได้รับข่าวสาร", this); return; } if (intChkC == 0) { Config.SetAlert("กรุณาระบุวัตถุประสงค์ของการเข้าชมงาน", this); return; } if (intChkD == 0) { Config.SetAlert("กรุณาระบุความต้องการการเข้าชม", this); return; } if (intChkE == 0) { Config.SetAlert("กรุณาระบุประเภทสินค้าหรือบริการที่ท่านสนใจ", this); return; } //Page.Form.DefaultFocus = txtFirstName.ClientID; ErmTsPersonalInfoPara Erm = new ErmTsPersonalInfoPara(); if (lblid.Text != "0") { Erm.ID = Convert.ToInt64(lblid.Text); } Erm.IDCARD_NO = "0"; //txtIDCardNo.Text; Erm.TITLE_NAME = rdiTitle.SelectedValue; if (rdiTitle.SelectedValue == "OTHERS") { Erm.TITLE_NAME = txtTitleOthers.Text; } Erm.FIRST_NAME = txtFirstName.Text; Erm.MIDDLE_NAME = "";// txtMiddleName.Text; Erm.LAST_NAME = txtLastName.Text; Erm.POSITION_NAME = txtPosition.Text; Erm.COMPANY_NAME = txtCompany.Text; Erm.ADDRESS = txtAddress.Text; Erm.CITY = txtCity.Text; Erm.STATE = "";//txtState.Text; Erm.COUNTRY = txtCountry.Text; Erm.ZIPCODE = txtZipCode.Text; Erm.TELNO = txtTelNumber.Text; Erm.FAXNO = txtFaxNumber.Text; Erm.EMAIL = txtEmail.Text; Erm.WEBSITE = txtWebSite.Text; Erm.DIVISION = txtDivition.Text; Erm.MOBILE_NO = txtMobileNo.Text; if ((rdPeriod.Items[0].Selected == true) && (rdPeriod.Items[1].Selected == true)) { Erm.REGISPERIOD = "3"; } else { Erm.REGISPERIOD = rdPeriod.SelectedValue; } // if (txtRegisteredCapital.Text != "") Erm.REGISTERED_CAPITAL = 0;//Convert.ToDouble(txtRegisteredCapital.Text); Erm.ANNUAL_SALE_VALUE_YEAR = DateTime.Today.Year; Erm.ANNUAL_SALE_VALUE_VOLUMNS = rdAnnualSale.SelectedValue; TransactionDB Trans = new TransactionDB(); Engine.Questionnaire.RegisterENG eng = new Engine.Questionnaire.RegisterENG(); long id; id = eng.SavePersonalInfo(Erm, "Register", Trans); if (id > 0) { bool IsDel = true; IsDel = eng.DeleteInterest(id, Trans); if (IsDel == false) { Trans.RollbackTransaction(); ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('ไม่สามารถบันทึกข้อมูลได้');", true); return; } SaveDetail(ChkA01, id, Trans,"","A"); SaveDetail(ChkA02, id, Trans, "", "A"); SaveDetail(ChkA03, id, Trans, "", "A"); SaveDetail(ChkA04, id, Trans, "", "A"); SaveDetail(ChkA05, id, Trans, "", "A"); SaveDetail(ChkA06, id, Trans, "", "A"); SaveDetail(ChkA07, id, Trans, "", "A"); SaveDetail(ChkA08, id, Trans, "", "A"); SaveDetail(ChkA09, id, Trans, "", "A"); SaveDetail(ChkA10, id, Trans, txtA10.Text, "A"); SaveDetail(ChkA11, id, Trans, "", "A"); SaveDetail(ChkA12, id, Trans, "", "A"); SaveDetail(ChkA13, id, Trans, "", "A"); SaveDetail(ChkA14, id, Trans, "", "A"); SaveDetail(ChkA15, id, Trans, "", "A"); SaveDetail(ChkA16, id, Trans, "", "A"); SaveDetail(ChkA17, id, Trans, txtA17.Text, "A"); SaveDetail(ChkB01, id, Trans, "", "B"); SaveDetail(ChkB02, id, Trans, "", "B"); SaveDetail(ChkB03, id, Trans, "", "B"); SaveDetail(ChkB04, id, Trans, txtB04.Text, "B"); SaveDetail(ChkB05, id, Trans, txtB05.Text, "B"); SaveDetail(ChkB06, id, Trans, txtB06.Text, "B"); SaveDetail(ChkB07, id, Trans, "", "B"); SaveDetail(ChkB08, id, Trans, "", "B"); SaveDetail(ChkB09, id, Trans, "", "B"); SaveDetail(ChkB10, id, Trans, "", "B"); SaveDetail(ChkB11, id, Trans, "", "B"); SaveDetail(ChkB12, id, Trans, "", "B"); SaveDetail(ChkB13, id, Trans, "", "B"); SaveDetail(ChkB14, id, Trans, txtB14.Text, "B"); SaveDetail(ChkC01, id, Trans, "", "C"); SaveDetail(ChkC02, id, Trans, "", "C"); SaveDetail(ChkC03, id, Trans, "", "C"); SaveDetail(ChkC04, id, Trans, "", "C"); SaveDetail(ChkC05, id, Trans, "", "C"); SaveDetail(ChkC06, id, Trans, "", "C"); SaveDetail(ChkC07, id, Trans, txtC07.Text, "C"); SaveDetail(ChkD01, id, Trans, "", "D"); SaveDetail(ChkD02, id, Trans, txtD02.Text, "D"); SaveDetail(ChkE01, id, Trans, "", "E"); SaveDetail(ChkE02, id, Trans, "", "E"); SaveDetail(ChkE03, id, Trans, "", "E"); SaveDetail(ChkE04, id, Trans, "", "E"); SaveDetail(ChkE05, id, Trans, "", "E"); SaveDetail(ChkE06, id, Trans, "", "E"); SaveDetail(ChkE07, id, Trans, "", "E"); SaveDetail(ChkE08, id, Trans, "", "E"); SaveDetail(ChkE09, id, Trans, "", "E"); SaveDetail(ChkE10, id, Trans, "", "E"); SaveDetail(ChkE11, id, Trans, "", "E"); SaveDetail(ChkE12, id, Trans, "", "E"); SaveDetail(ChkE13, id, Trans, "", "E"); SaveDetail(ChkE14, id, Trans, "", "E"); SaveDetail(ChkE15, id, Trans, "", "E"); SaveDetail(ChkE16, id, Trans, "", "E"); SaveDetail(ChkE17, id, Trans, "", "E"); SaveDetail(ChkE18, id, Trans, "", "E"); SaveDetail(ChkE19, id, Trans, "", "E"); Trans.CommitTransaction(); bool ret = false; ret = clsSendMail.SendEmailMessage(txtEmail.Text, "*****@*****.**", "mail.scoresolutions.co.th", "1qaz@WSX", txtFirstName.Text + " " + txtLastName.Text, id.ToString(), Server.MapPath("~/image/PrintAdsTheretrunofRFIDHERO_Resize.jpg"), 25, false, Server.MapPath("~/image/logo.png")); if (ret == false) { ret = clsSendMail.SendEmailMessage(txtEmail.Text, "*****@*****.**", "smtp.live.com", "1qaz@WSX", txtFirstName.Text + " " + txtLastName.Text, id.ToString(), Server.MapPath("~/image/PrintAdsTheretrunofRFIDHERO_Resize.jpg"), 587, true, Server.MapPath("~/image/logo.png")); } if (ret == true) { Trans = new TransactionDB(); if (eng.UpdateIsSendMail(id, "Register", Trans) == true) { Trans.CommitTransaction(); } else { Trans.RollbackTransaction(); } } eng = null; //Response.Redirect("../WebApp/frmRegisterComplete.aspx?id=" + Convert.ToString(id)); //Config.ShowModalDialog("../WebApp/frmRegisterEmailComplete.aspx?id=" +id, this); Config.RedirecPage("../WebApp/frmRegisterEmailComplete.aspx?id=" + id, this); Clear(); } else { Trans.RollbackTransaction(); Config.SetAlert("ไม่สามารถบันทึกข้อมูลได้",this); } }
protected bool SaveDetail(CheckBox chk, long id, TransactionDB Trans ,string str,string section) { bool ret =false; if (chk.Checked == true){ string InteresCode = chk.Text.Substring(0,2); string InteresName = chk.Text.Substring(3); ErmTsInterestPara Erm = new ErmTsInterestPara(); Erm.ERM_TS_PERSONAL_INFO_ID = id; Erm.INTEREST_CODE = section + InteresCode; if (str != "") {InteresName=InteresName + "##" + str;} Erm.INTEREST_NAME = InteresName; Engine.Questionnaire.RegisterENG eng = new Engine.Questionnaire.RegisterENG(); ret= eng.SaveInterest(Erm, "Register", Trans); } return ret; }
public void SendMail(string allID) { //LiveFaceScan.userinfo.email = "*****@*****.**"; //LiveFaceScan.userinfo.id = 16 + ""; Boolean ret; ret =false; EbrochureDocumentLinqDB eDocument = new EbrochureDocumentLinqDB(); TransactionDB trans = new TransactionDB(); //trans.CreateTransaction(); string status; status = "false"; string[] strId = allID.Split(','); //for (int i = 0; i < strId.Length; i++) { EbrochureSendMailJobLinqDB SendMailJob = new EbrochureSendMailJobLinqDB(); //SendMailJob.CREATE_BY = "Admin"; //SendMailJob.CREATE_ON = DateTime.Now; //SendMailJob.UPDATE_BY = "Admin"; //SendMailJob.UPDATE_ON = DateTime.Now; SendMailJob.ERM_TS_PERSONAL_INFO_ID = Convert.ToInt32( LiveFaceScan.userinfo.id); SendMailJob.CUSTOMER_EMAIL = LiveFaceScan.userinfo.email; SendMailJob.IS_SEND_MAIL = 'N'; ret = SendMailJob.InsertData("Admin", trans.Trans); if (ret == true) { //DataTable dt; //dt = eDocument.GetDataList("ebrochure_id=" + strId[0], "", trans.Trans); //for (int j = 0; j < dt.Rows.Count; j++) //{ for (int i = 0; i < strId.Length; i++) { EbrochureSendMailJobItemLinqDB SendMailJobItem = new EbrochureSendMailJobItemLinqDB(); //SendMailJobItem.CREATE_BY = "Admin"; //SendMailJobItem.CREATE_ON = DateTime.Now; //SendMailJob.UPDATE_BY = "Admin"; //SendMailJob.UPDATE_ON = DateTime.Now; SendMailJobItem.EBROCHURE_SEND_MAIL_JOB_ID = SendMailJob.ID; SendMailJobItem.EBROCHURE_ID = Convert.ToInt32(strId[i]); ret = SendMailJobItem.InsertData("Admin", trans.Trans); SendMailJobItem = null; } } SendMailJob = null; //} if (ret == false) { trans.RollbackTransaction(); MessageBox.Show("ไม่สามารถส่ง E-Mail ได้"); } else { trans.CommitTransaction(); this.Visible = false; this.Close(); frmEmailSend f = new frmEmailSend(); f.MailComplete(); f.ShowDialog(); } }
public DataTable GetDataTable(string sql, TransactionDB trans) { DataTable dt = new DataTable(); try { dt = Linq.Common.Utilities.SqlDB.ExecuteTable(sql, trans.Trans); } catch (Exception ex) { dt = new DataTable(); _err = ex.Message + Environment.NewLine + ex.StackTrace; } return dt; }