public ActionResult Signup(loginfo l, roletable r, userlogin u) { if (ModelState.IsValid) { var username = db.loginfo.Where(a => a.username == l.username).FirstOrDefault(); if (username == null) { l.Balance = 0; db.loginfo.Add(l); db.SaveChanges(); ViewBag.balance = l.Balance; ViewBag.usercount = usercount += 1; ViewBag.msg = "USER REGISTERED SUCCESSFULLY"; ViewBag.mpin = l.mpin; ViewBag.user = l.Account_No; r.user_id = l.Account_No; r.Role = "User"; db.roletable.Add(r); db.SaveChanges(); } else { ViewBag.du = "This username is already exists"; } } return(View()); }
public ActionResult Edit(offer o, transaction_table t, loginfo l) { if (ModelState.IsValid) { t.Transaction_Name = "POSTPAIDBILL"; t.Type = "Postpaid"; t.time = System.DateTime.Now.ToShortTimeString(); t.date = System.DateTime.Now.ToShortDateString(); t.offer_recharge_consumer_numbers = o.offercode; db.transaction_table.Add(t); if (db.SaveChanges() > 0) { Session["offer"] = "OFFER GET SUCCESSFULLY"; o.Account_No = string.Empty; o.amount = string.Empty; o.mpin = string.Empty; db.Entry(o).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ModelState.Clear(); l.Balance = l.Balance - t.amount; db.Entry(l).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } } else { Session["BILL"] = "*ALL FIELDS MUST FILLED"; } return(View()); }
private void objectListView1_FormatCell(object sender, FormatCellEventArgs e) { if (e.ColumnIndex != 0) { return; } loginfo info = (loginfo)e.Model; if (info.img == null) { return; } ImageDecoration decoration = new ImageDecoration(new Bitmap(info.img, 150, 150), 255); //decoration.ShrinkToWidth = true; decoration.AdornmentCorner = ContentAlignment.TopCenter; decoration.ReferenceCorner = ContentAlignment.TopCenter; e.SubItem.Decoration = decoration; // TextDecoration td = new TextDecoration("test", ContentAlignment.BottomCenter); // e.SubItem.Decorations.Add(td); Application.DoEvents(); }
public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } loginfo loginfo = db.loginfo.Find(id); if (loginfo == null) { return(HttpNotFound()); } return(View(loginfo)); }
private void objectListView1_FormatCell(object sender, FormatCellEventArgs e) { if (e.ColumnIndex != 0) return; loginfo info = (loginfo) e.Model; if (info.img == null) return; ImageDecoration decoration = new ImageDecoration(new Bitmap(info.img, 150, 150), 255); //decoration.ShrinkToWidth = true; decoration.AdornmentCorner = ContentAlignment.TopCenter; decoration.ReferenceCorner = ContentAlignment.TopCenter; e.SubItem.Decoration = decoration; }
void processbg(object directory) { //this.Invoke((MethodInvoker)delegate { objectListView1.Clear(); }); string[] files1 = Directory.GetFiles(directory.ToString(), "*.tlog", SearchOption.AllDirectories); string[] files2 = Directory.GetFiles(directory.ToString(), "*.bin", SearchOption.AllDirectories); string[] files3 = Directory.GetFiles(directory.ToString(), "*.log", SearchOption.AllDirectories); List <string> files = new List <string>(); files.AddRange(files1); files.AddRange(files2); files.AddRange(files3); //objectListView1.VirtualListSize = files.Length; List <object> logs = new List <object>(); foreach (var file in files) { if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] { file }); } var loginfo = new loginfo(); loginfo.fullname = file; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } //objectListView1.AddObject(loginfo); logs.Add(loginfo); } this.Invoke((MethodInvoker) delegate { objectListView1.AddObjects(logs); }); }
public ActionResult Deposit(loginfo l, transaction_table t) { if (ModelState.IsValid) { t.Account_No = l.accountno; t.offer_recharge_consumer_numbers = l.accountno; t.operators_ = "DEPOSIT THROUGH RECHARE.CO"; t.Transaction_Name = "Cash Depost"; t.Type = "Deposit"; t.time = System.DateTime.Now.ToShortTimeString(); t.date = System.DateTime.Now.ToShortDateString(); db.transaction_table.Add(t); if (db.SaveChanges() > 0) { l.password = l.password; l.confirm_password = l.confirm_password; l.mpin = l.mpin; Session["deposit"] = "depost successfully"; l.Balance = l.amount + l.Balance; db.Entry(l).State = System.Data.Entity.EntityState.Modified; l.amount = null; l.accountno = string.Empty; l.mpincheck = string.Empty; db.SaveChanges(); Session["Balance"] = l.Balance; } else { Session["deposit"] = null; } } return(View()); }
void processbg(object directory) { //this.Invoke((MethodInvoker)delegate { objectListView1.Clear(); }); string[] files = Directory.GetFiles(directory.ToString(), "*.tlog", SearchOption.AllDirectories); //objectListView1.VirtualListSize = files.Length; List<object> logs = new List<object>(); foreach (var file in files) { if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] { file }); } var loginfo = new loginfo(); loginfo.fullname = file; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } //objectListView1.AddObject(loginfo); logs.Add(loginfo); } this.Invoke((MethodInvoker)delegate { objectListView1.AddObjects(logs); }); }
void processbg(string file) { a++; Loading.ShowLoading(a + "/" + files.Count + " " + file, this); if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] { file }); } var loginfo = new loginfo(); loginfo.fullname = file; try { // file not found exception even though it passes the exists check above. loginfo.Size = new FileInfo(file).Length; } catch { } if (File.Exists(file + ".jpg")) { loginfo.imgfile = file + ".jpg"; } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.speechenabled = false; // file is to small if (mine.logplaybackfile.BaseStream.Length < 1024 * 4) { return; } mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; loginfo.Frame = mine.MAV.aptype.ToString(); var start = mine.lastlogread; try { mine.logplaybackfile.BaseStream.Seek(0, SeekOrigin.Begin); } catch { } var end = mine.lastlogread; var length = mine.logplaybackfile.BaseStream.Length; var a = 0; // abandon last 100 bytes while (mine.logplaybackfile.BaseStream.Position < (length - 100)) { var packet = mine.readPacket(); // gcs if (packet.sysid == 255) { continue; } if (packet.msgid == (uint)MAVLink.MAVLINK_MSG_ID.CAMERA_FEEDBACK) { loginfo.CamMSG++; } if (a % 10 == 0) { mine.MAV.cs.UpdateCurrentSettings(null, true, mine); } a++; if (mine.lastlogread > end) { end = mine.lastlogread; } } loginfo.Home = mine.MAV.cs.Location; loginfo.TimeInAir = mine.MAV.cs.timeInAir; loginfo.DistTraveled = mine.MAV.cs.distTraveled; loginfo.Duration = (end - start).ToString(); } } else if (file.ToLower().EndsWith(".bin") || file.ToLower().EndsWith(".log")) { using (DFLogBuffer colbuf = new DFLogBuffer(File.OpenRead(file))) { PointLatLngAlt lastpos = null; DateTime start = DateTime.MinValue; DateTime end = DateTime.MinValue; DateTime tia = DateTime.MinValue; // set time in air/home/distancetraveled foreach (var dfItem in colbuf.GetEnumeratorType("GPS")) { if (dfItem["Status"] != null) { var status = int.Parse(dfItem["Status"]); if (status >= 3) { var pos = new PointLatLngAlt( double.Parse(dfItem["Lat"], CultureInfo.InvariantCulture), double.Parse(dfItem["Lng"], CultureInfo.InvariantCulture), double.Parse(dfItem["Alt"], CultureInfo.InvariantCulture)); if (lastpos == null) { lastpos = pos; } if (start == DateTime.MinValue) { loginfo.Date = dfItem.time; start = dfItem.time; } end = dfItem.time; // add distance loginfo.DistTraveled += (float)lastpos.GetDistance(pos); // set home if (loginfo.Home == null) { loginfo.Home = pos; } if (dfItem.time > tia.AddSeconds(1)) { // ground speed > 0.2 or alt > homelat+2 if (double.Parse(dfItem["Spd"], CultureInfo.InvariantCulture) > 0.2 || pos.Alt > (loginfo.Home.Alt + 2)) { loginfo.TimeInAir++; } tia = dfItem.time; } } } } loginfo.Duration = (end - start).ToString(); loginfo.CamMSG = colbuf.GetEnumeratorType("CAM").Count(); loginfo.Aircraft = 0; //colbuf.dflog.param[""]; loginfo.Frame = "Unknown"; //mine.MAV.aptype.ToString(); } } lock (logs) logs.Add(loginfo); }
void processbg(object directory) { //this.Invoke((MethodInvoker)delegate { objectListView1.Clear(); }); string[] files1 = Directory.GetFiles(directory.ToString(), "*.tlog", SearchOption.AllDirectories); string[] files2 = Directory.GetFiles(directory.ToString(), "*.bin", SearchOption.AllDirectories); string[] files3 = Directory.GetFiles(directory.ToString(), "*.log", SearchOption.AllDirectories); List<string> files = new List<string>(); files.AddRange(files1); files.AddRange(files2); files.AddRange(files3); //objectListView1.VirtualListSize = files.Length; List<object> logs = new List<object>(); foreach (var file in files) { if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] {file}); } var loginfo = new loginfo(); loginfo.fullname = file; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.MAV.packets.Initialize(); // clear mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; var start = mine.lastlogread; try { mine.logplaybackfile.BaseStream.Seek(-100000, SeekOrigin.End); } catch { } var end = mine.lastlogread; while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length) { mine.readPacket(); if (mine.lastlogread > end) end = mine.lastlogread; } loginfo.Duration = (end - start).ToString(); } } objectListView1.AddObject(loginfo); logs.Add(loginfo); } /* this.Invoke((MethodInvoker)delegate { objectListView1.AddObjects(logs); }); */ }
void processbg(string file) { if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] { file }); } var loginfo = new loginfo(); loginfo.fullname = file; loginfo.Size = new FileInfo(file).Length; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.speechenabled = false; mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; var start = mine.lastlogread; try { if (mine.logplaybackfile.BaseStream.Length > MaxPlaybackLogSize) { mine.logplaybackfile.BaseStream.Seek(-100000, SeekOrigin.End); } else { mine.logplaybackfile.BaseStream.Seek(0, SeekOrigin.Begin); } } catch { } var end = mine.lastlogread; while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length) { mine.readPacket(); if (mine.lastlogread > end) { end = mine.lastlogread; } } loginfo.Duration = (end - start).ToString(); } } logs.Add(loginfo); }
public ActionResult onlinerecharge(loginfo l, transaction_table t) { Session["RECHARGE"] = null; if (ModelState.IsValid) { if (l.paymentmethod == "RECHARGE.COM") { if (l.mpincheck == l.mpin) { if (l.Balance >= l.amount) { l.Balance = l.Balance - l.amount; db.Entry(l).State = System.Data.Entity.EntityState.Modified; l.accountno = t.Account_No; l.amount = null; l.accountno = string.Empty; l.mpincheck = string.Empty; l.offer_recharge_consumer_numbers = string.Empty; if (db.SaveChanges() > 0) { t.operators_ = l.operators; t.Account_No = l.Account_No; t.Transaction_Name = "Online Recharge"; t.Type = "Recharge"; t.time = System.DateTime.Now.ToShortTimeString(); t.date = System.DateTime.Now.ToShortDateString(); db.transaction_table.Add(t); db.SaveChanges(); Session["RECHARGE"] = "Recharge successfully"; Session["PIN"] = null; Session["er"] = null; ModelState.Clear(); } Session["Balance"] = l.Balance; } else { Session["er"] = " NOT ENOUGH BALANCE"; Session["PIN"] = null; Session["RECHARGE"] = null; } } else { Session["PIN"] = "MPIN IS INVALID"; Session["er"] = null; Session["RECHARGE"] = null; return(View()); } } else { t.Transaction_Name = "Online Recharge"; t.Type = "Recharge"; t.time = System.DateTime.Now.ToShortTimeString(); t.date = System.DateTime.Now.ToShortDateString(); db.transaction_table.Add(t); db.SaveChanges(); Session["RECHARGE"] = "Recharge successfully"; } } return(View()); }
public ActionResult Moneytransfer(transaction_table t, loginfo l) { Session["MONEY"] = null; if (ModelState.IsValid) { if (l.paymentmethod == "RECHARGE.COM") { if (l.mpincheck == l.mpin) { if (l.Balance >= l.amount) { l.Balance = l.Balance - l.amount; l.accountno = t.Account_No; db.Entry(l).State = System.Data.Entity.EntityState.Modified; l.amount = null; l.accountno = string.Empty; l.mpincheck = string.Empty; l.offer_recharge_consumer_numbers = string.Empty; if (db.SaveChanges() > 0) { t.Account_No = l.Account_No; t.Transaction_Name = "MONEY TRANSFER"; t.Type = "BY CNIC"; t.time = System.DateTime.Now.ToShortTimeString(); t.date = System.DateTime.Now.ToShortDateString(); db.transaction_table.Add(t); db.SaveChanges(); Session["MONEY"] = "MONEY TRANSFER SUCCESSFULLY"; Session["PIN"] = null; Session["ER"] = null; ModelState.Clear(); } Session["Balance"] = l.Balance; } else { Session["ER"] = " NOT ENOUGH BALANCE"; Session["MONEY"] = null; Session["PIN"] = null; } } else { Session["PIN"] = "MPIN IS INVALID"; Session["ER"] = null; Session["MONEY"] = null; return(View()); } } else { t.Account_No = l.Account_No; t.Transaction_Name = "MONEY TRANSFER"; t.Type = "BY CNIC"; t.time = System.DateTime.Now.ToShortTimeString(); t.date = System.DateTime.Now.ToShortDateString(); db.transaction_table.Add(t); db.SaveChanges(); Session["MONEY"] = "MONEY TRANSFER SUCCESSFULLY"; } } else { Session["TRANSFER"] = "*ALL FIELDS MUST FILLED"; } return(View()); }
void processbg(string file) { Loading.ShowLoading(file, this); if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] {file}); } var loginfo = new loginfo(); loginfo.fullname = file; loginfo.Size = new FileInfo(file).Length; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.speechenabled = false; // file is to small if (mine.logplaybackfile.BaseStream.Length < 1024*4) return; mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; loginfo.Frame = mine.MAV.aptype.ToString(); var start = mine.lastlogread; try { mine.logplaybackfile.BaseStream.Seek(0, SeekOrigin.Begin); } catch { } var end = mine.lastlogread; var length = mine.logplaybackfile.BaseStream.Length; var a = 0; // abandon last 100 bytes while (mine.logplaybackfile.BaseStream.Position < (length-100)) { var packet = mine.readPacket(); // gcs if(packet.sysid == 255) continue; if(a % 10 == 0) mine.MAV.cs.UpdateCurrentSettings(null, true, mine); a++; if (mine.lastlogread > end) end = mine.lastlogread; } loginfo.Home = mine.MAV.cs.Location; loginfo.TimeInAir = mine.MAV.cs.timeInAir; loginfo.DistTraveled = mine.MAV.cs.distTraveled; loginfo.Duration = (end - start).ToString(); } } logs.Add(loginfo); }
void processbg(string file) { if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] {file}); } var loginfo = new loginfo(); loginfo.fullname = file; loginfo.Size = new FileInfo(file).Length; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; var start = mine.lastlogread; try { if (mine.logplaybackfile.BaseStream.Length > MaxPlaybackLogSize) { mine.logplaybackfile.BaseStream.Seek(-100000, SeekOrigin.End); } else { mine.logplaybackfile.BaseStream.Seek(0, SeekOrigin.Begin); } } catch { } var end = mine.lastlogread; while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length) { mine.readPacket(); if (mine.lastlogread > end) end = mine.lastlogread; } loginfo.Duration = (end - start).ToString(); } } logs.Add(loginfo); }
void processbg(object directory) { //this.Invoke((MethodInvoker)delegate { objectListView1.Clear(); }); string[] files1 = Directory.GetFiles(directory.ToString(), "*.tlog", SearchOption.AllDirectories); string[] files2 = Directory.GetFiles(directory.ToString(), "*.bin", SearchOption.AllDirectories); string[] files3 = Directory.GetFiles(directory.ToString(), "*.log", SearchOption.AllDirectories); List <string> files = new List <string>(); files.AddRange(files1); files.AddRange(files2); files.AddRange(files3); //objectListView1.VirtualListSize = files.Length; List <object> logs = new List <object>(); foreach (var file in files) { if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] { file }); } var loginfo = new loginfo(); loginfo.fullname = file; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.MAV.packets.Initialize(); // clear mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; var start = mine.lastlogread; try { mine.logplaybackfile.BaseStream.Seek(-100000, SeekOrigin.End); } catch { } var end = mine.lastlogread; while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length) { mine.readPacket(); if (mine.lastlogread > end) { end = mine.lastlogread; } } loginfo.Duration = (end - start).ToString(); } } objectListView1.AddObject(loginfo); logs.Add(loginfo); } /* * this.Invoke((MethodInvoker)delegate * { * objectListView1.AddObjects(logs); * }); */ }
void processbg(string file) { Loading.ShowLoading(file, this); if (!File.Exists(file + ".jpg")) { LogMap.MapLogs(new string[] { file }); } var loginfo = new loginfo(); loginfo.fullname = file; loginfo.Size = new FileInfo(file).Length; if (File.Exists(file + ".jpg")) { loginfo.img = new Bitmap(file + ".jpg"); } if (file.ToLower().EndsWith(".tlog")) { using (MAVLinkInterface mine = new MAVLinkInterface()) { try { mine.logplaybackfile = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } mine.logreadmode = true; mine.speechenabled = false; // file is to small if (mine.logplaybackfile.BaseStream.Length < 1024 * 4) { return; } mine.getHeartBeat(); loginfo.Date = mine.lastlogread; loginfo.Aircraft = mine.sysidcurrent; loginfo.Frame = mine.MAV.aptype.ToString(); var start = mine.lastlogread; try { mine.logplaybackfile.BaseStream.Seek(0, SeekOrigin.Begin); } catch { } var end = mine.lastlogread; var length = mine.logplaybackfile.BaseStream.Length; var a = 0; // abandon last 100 bytes while (mine.logplaybackfile.BaseStream.Position < (length - 100)) { var packet = mine.readPacket(); // gcs if (packet.sysid == 255) { continue; } if (a % 10 == 0) { mine.MAV.cs.UpdateCurrentSettings(null, true, mine); } a++; if (mine.lastlogread > end) { end = mine.lastlogread; } } loginfo.Home = mine.MAV.cs.Location; loginfo.TimeInAir = mine.MAV.cs.timeInAir; loginfo.DistTraveled = mine.MAV.cs.distTraveled; loginfo.Duration = (end - start).ToString(); } } logs.Add(loginfo); }