public string GetJson_SQL() { if (!Tools.CheckLogin(redirect: false)) { return("{}"); } string text = base.Request.QueryString["dbconn"]; string text2 = base.Request.QueryString["sql"]; RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection(); RoadFlow.Data.Model.DBConnection dbconn = dBConnection.Get(MyExtensions.ToGuid(text)); DataTable dataTable = dBConnection.GetDataTable(dbconn, MyExtensions.ReplaceSelectSql(MyExtensions.UrlDecode(text2).FilterWildcard())); StringBuilder stringBuilder = new StringBuilder(1000); foreach (DataRow row in dataTable.Rows) { string text3 = row[0].ToString(); string arg = (dataTable.Columns.Count > 1) ? row[1].ToString() : text3; stringBuilder.Append("{"); stringBuilder.AppendFormat("\"id\":\"{0}\",", text3); stringBuilder.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty.ToString()); stringBuilder.AppendFormat("\"title\":\"{0}\",", arg); stringBuilder.AppendFormat("\"type\":\"{0}\",", "2"); stringBuilder.AppendFormat("\"ico\":\"{0}\",", ""); stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", "0"); stringBuilder.Append("\"childs\":[]},"); } return("[" + stringBuilder.ToString().TrimEnd(',') + "]"); }
// GET: IllegalConstructions public ActionResult Index(int?page, DateTime?dc, int?rt, int?WEBstatusID) { ViewBag.WEBstatusID = new SelectList(db.WEBstatus, "WEBstatusID", "Status"); var illegalConstructions = db.IllegalConstructions.Where(x => x.RegisterTypeID > 0); if (rt != null) { ViewBag.RegisterTypeID = rt; illegalConstructions = db.IllegalConstructions.Where(x => x.RegisterTypeID == rt); } if (dc != null) { illegalConstructions = illegalConstructions.Where(p => p.DateOfComp == dc); page = 1; } if (WEBstatusID != null) { illegalConstructions = illegalConstructions.Where(p => p.WEBstatusID == WEBstatusID); page = 1; } else { int FinYr = MyExtensions.GetFinYr(); illegalConstructions = illegalConstructions.Where(x => ((DateTime)x.DateOfComp).Year == FinYr); } int pageSize = db.Configs.FirstOrDefault().RowsPerPage ?? 5; int pageNumber = (page ?? 1); return(View(illegalConstructions.OrderByDescending(a => a.IllegalConID).ToList().ToPagedList(pageNumber, pageSize))); }
public override void CanPacketReceived(CanPacket canPacket) { try { if (isRecording) { string newLine = ""; packetNumber++; newLine = newLine + MyExtensions.AlignLeft(DateTime.Now.ToString("HH:mm:ss.fff"), 14, false); newLine = newLine + MyExtensions.AlignLeft(packetNumber.ToString(), 12, true); newLine = newLine + MyExtensions.AlignLeft("0x" + canPacket.CanIdAsHex, 12, true); newLine = newLine + MyExtensions.AlignLeft(canPacket.Flags, 7, true); byte[] dataBytes = canPacket.DataBytes; Array.Reverse(dataBytes, 0, dataBytes.Length); newLine = newLine + MyExtensions.AlignLeft("0x" + MyExtensions.ByteArrayToString(dataBytes), 20, true); newLine = newLine + MyExtensions.AlignLeft(canPacket.Float1.ToString(), 15, true); newLine = newLine + MyExtensions.AlignLeft(canPacket.Float0.ToString(), 15, true); newLine = newLine + MyExtensions.AlignLeft(canPacket.SourceIPAddress.ToString(), 7, true); recordStream.WriteLine(newLine); recordStatus = "Recording Can Packet No : " + packetNumber; } } catch (Exception ex) { Console.Write(ex.StackTrace); } }
public static int EKLE(ENTITYKULUP deger) { SqlCommand komut = MyExtensions.CommandOlustur(ResourceStoredProcedure.KULUP_EKLE, SQLBAGLANTI.Baglanti); komut.Parameters.AddWithValue(ResourceTblKulup.KULUP_AD, deger.KULUPAD); return(komut.ExecuteNonQuery()); //ExecuteNonQuery ile kayıt sayısını döndürüyor (eklenen kayıt sayısını) }
private async Task <string> SendRequest(HttpRequestMessage request) { if (!MyExtensions.IsHasInternet()) { OnError?.Invoke("", "Нет подключения к интернету"); return(String.Empty); } try { var httpResponseMessage = await _client.SendAsync(request); var httpContent = httpResponseMessage.Content; var resp = await httpResponseMessage.Content.ReadAsStringAsync(); Debug.WriteLine(String.Format("Status: {0}\nresp: {1}", httpResponseMessage.StatusCode.ToString(), resp)); if (!httpResponseMessage.IsSuccessStatusCode) { OnError?.Invoke(httpResponseMessage.StatusCode.ToString(), resp); } return(resp); } catch (Exception ex) { Debug.WriteLine("Exception: " + ex.Message); OnError?.Invoke("Exception", ex.Message); return(String.Empty); } }
public virtual string CloseAndReport() { currentBalance -= serviceCharge; CalculateInterest(); Console.WriteLine("Total Deposit " + totalDeposit); Console.WriteLine("Total Withdrawn " + totalWithdrawal); Console.WriteLine("Total number of Deposits " + numDeposit); Console.WriteLine("Total number of Withdrawals " + numWithdrawal); string end = "starting balance of the month " + MyExtensions.toNAMoneyFormat(startBalance) + "\n Balance at the end of the month " + MyExtensions.toNAMoneyFormat(currentBalance) + "\n the change in balance over the month " + MyExtensions.getPercentageChange(currentBalance, startBalance) + "%" + "\n"; startBalance = currentBalance; totalDeposit = 0; numWithdrawal = 0; numDeposit = 0; totalWithdrawal = 0; //ALSO PRINT ANY DETAILS THAT public void CalculateInterest() may print return(end); }
public ActionResult Login_Post(UserModel objUserData) { //Gets the Excrypted Password to Compare //1. MD5 Encryption objUserData.Password = MyExtensions.EncodePasswordMd5(objUserData.Password).Replace("-", ""); var UserData = this._userCredentialRepository.Find(x => x.Username == objUserData.UserName && x.Password == objUserData.Password).FirstOrDefault(); if (UserData != null) { base.UserName = UserData.Username; base.Email = UserData.User.Email; base.UserRole = (UserType)UserData.Role.RoleId; base.IsAdmin = UserData.Role.RoleId == (int)Core.UserType.Administrator; base.UserId = UserData.UserId.Value; Session["ProfileName"] = this._userRepository.Table.Where(x => x.UserId == UserData.UserId.Value).Select(x => x.FirstName + " " + x.LastName).FirstOrDefault(); if (!IsAdmin) { UpdateSubscriptionExpiry(); } return(RedirectToLandingPage()); } objUserData.IsValidUserName = false; return(View(objUserData)); }
public string GetApps() { string text = base.Request.Form["type"]; string value = base.Request.Form["value"]; return(new RoadFlow.Platform.AppLibrary().GetAppsOptions(MyExtensions.ToGuid(text), value)); }
public string Query() { string text = base.Request.Form["Title"]; string text2 = base.Request.Form["Address"]; string text3 = base.Request.Form["typeid"]; string text4 = base.Request.Form["sidx"]; string text5 = base.Request.Form["sord"]; RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary(); RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary(); string type = MyExtensions.IsGuid(text3) ? appLibrary.GetAllChildsIDString(MyExtensions.ToGuid(text3)) : ""; int pageSize = Tools.GetPageSize(); int pageNumber = Tools.GetPageNumber(); string order = (MyExtensions.IsNullOrEmpty(text4) ? "Title" : text4) + " " + (MyExtensions.IsNullOrEmpty(text5) ? "asc" : text5); long count; List <RoadFlow.Data.Model.AppLibrary> pagerData = appLibrary.GetPagerData(out count, pageSize, pageNumber, MyExtensions.Trim1(text), type, MyExtensions.Trim1(text2), order); JsonData jsonData = new JsonData(); foreach (RoadFlow.Data.Model.AppLibrary item in pagerData) { string empty = string.Empty; empty = ((!MyExtensions.IsFontIco(item.Ico)) ? ("<img src=\"" + MyExtensions.Trim1(item.Ico) + "\" style=\"vertical-align:middle;\" />") : ("<i class=\"fa " + MyExtensions.Trim1(item.Ico) + "\" style=\"font-size:14px;vertical-align:middle;" + (MyExtensions.IsNullOrEmpty(item.Color) ? "" : ("color:" + item.Color + ";")) + "\"></i>")); JsonData jsonData2 = new JsonData(); jsonData2["id"] = item.ID.ToString(); jsonData2["Title"] = empty + "<span style=\"vertical-align:middle;margin-left:4px;\">" + item.Title + "</span>"; jsonData2["Address"] = item.Address; jsonData2["TypeTitle"] = dictionary.GetTitle(item.Type); jsonData2["Opation"] = "<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"edit('" + item.ID.ToString() + "');return false;\" style=\"margin-right:6px;\">编辑</a><a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"editsubpage('" + item.ID.ToString() + "');return false;\">子页面</a>"; jsonData.Add(jsonData2); } return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}"); }
public string GetDocs() { string text = base.Request.QueryString["pagenumber"]; string text2 = base.Request.QueryString["pagesize"]; string title = base.Request.QueryString["SearchTitle"]; string dirID = base.Request.QueryString["dirid"]; Guid currentUserID = RoadFlow.Platform.WeiXin.Organize.CurrentUserID; long count; DataTable list = new Documents().GetList(out count, MyExtensions.ToInt(text2), MyExtensions.ToInt(text), dirID, currentUserID.ToString(), title); JsonData jsonData = new JsonData(); if (list.Rows.Count == 0) { return("[]"); } foreach (DataRow row in list.Rows) { JsonData jsonData2 = new JsonData(); jsonData2["id"] = row["ID"].ToString(); jsonData2["title"] = row["Title"].ToString(); jsonData2["writetime"] = MyExtensions.ToDateTimeString(MyExtensions.ToDateTime(row["WriteTime"].ToString())); jsonData2["writeuser"] = row["WriteUserName"].ToString(); jsonData.Add(jsonData2); } return(jsonData.ToJson()); }
public ActionResult Order(int?LocationId, string UID, DateTime?TDate) { ViewBag.LoID = MyExtensions.GetLocations(LocationTypesEnum.Restaurant, db, LocationId); ViewBag.UID = MyExtensions.GetUsersInGroup("Waiter", db, (UID == "") ? User.Identity.GetUserId() : UID); ViewBag.TDate = TDate; return(View()); }
public Exploration(byte[,] explorationGrid) { var f = explorationGrid.Cast <byte>().ToArray(); InitialExploreSum = f.Sum <byte>(x => (int)x); CurrentExploreSum = InitialExploreSum; int width = explorationGrid.GetLength(0); int height = explorationGrid.GetLength(1); int numberOfGrids = 3; int widthOfEachGrid = width / numberOfGrids; int heightOfEachGrid = height / numberOfGrids; // Create x grids for (int x = 0; x < numberOfGrids; x++) { for (int y = 0; y < numberOfGrids; y++) { int xStart = widthOfEachGrid * x; int yStart = heightOfEachGrid * y; int clampedWidth = MyExtensions.Clamp <int>(widthOfEachGrid, 0, width - xStart); int clampedHeight = MyExtensions.Clamp <int>(heightOfEachGrid, 0, height - yStart); grids.Add(new ExplorationGrid(explorationGrid, xStart, yStart, clampedWidth, clampedHeight)); } } }
public string GetNames_Table() { string text = base.Request.QueryString["dbconn"]; string text2 = base.Request.QueryString["dbtable"]; string text3 = base.Request.QueryString["valuefield"]; string text4 = base.Request.QueryString["titlefield"]; string text7 = base.Request.QueryString["parentfield"]; string text8 = base.Request.QueryString["where"]; string obj = base.Request.QueryString["values"] ?? ""; RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection(); RoadFlow.Data.Model.DBConnection dbconn = dBConnection.Get(MyExtensions.ToGuid(text)); StringBuilder stringBuilder = new StringBuilder(); string[] array = obj.Split(','); foreach (string text5 in array) { if (!MyExtensions.IsNullOrEmpty(text5)) { string text6 = "select " + text4 + " from " + text2 + " where " + text3 + "='" + text5 + "'"; DataTable dataTable = dBConnection.GetDataTable(dbconn, MyExtensions.ReplaceSelectSql(text6)); if (dataTable.Rows.Count > 0) { stringBuilder.Append(dataTable.Rows[0][0].ToString()); stringBuilder.Append(","); } } } return(stringBuilder.ToString().TrimEnd(',')); }
public string GetJson_TableRefresh() { string text = base.Request.QueryString["dbconn"]; string text2 = base.Request.QueryString["dbtable"]; string text3 = base.Request.QueryString["valuefield"]; string text4 = base.Request.QueryString["titlefield"]; string text5 = base.Request.QueryString["parentfield"]; string text10 = base.Request.QueryString["where"]; string text6 = base.Request.QueryString["refreshid"]; RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection(); RoadFlow.Data.Model.DBConnection dbconn = dBConnection.Get(MyExtensions.ToGuid(text)); string text7 = "select " + text3 + "," + text4 + " from " + text2 + " where " + text5 + "='" + text6 + "'"; DataTable dataTable = dBConnection.GetDataTable(dbconn, MyExtensions.ReplaceSelectSql(text7)); StringBuilder stringBuilder = new StringBuilder(1000); foreach (DataRow row in dataTable.Rows) { string text8 = row[0].ToString(); string arg = (dataTable.Columns.Count > 1) ? row[1].ToString() : text8; string text9 = "select * from " + text2 + " where " + text5 + "='" + text8 + "'"; bool flag = dBConnection.GetDataTable(dbconn, MyExtensions.ReplaceSelectSql(text9)).Rows.Count > 0; stringBuilder.Append("{"); stringBuilder.AppendFormat("\"id\":\"{0}\",", text8); stringBuilder.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty.ToString()); stringBuilder.AppendFormat("\"title\":\"{0}\",", arg); stringBuilder.AppendFormat("\"type\":\"{0}\",", flag ? "1" : "2"); stringBuilder.AppendFormat("\"ico\":\"{0}\",", ""); stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", flag ? "1" : "0"); stringBuilder.Append("\"childs\":[]},"); } return("[" + stringBuilder.ToString().TrimEnd(',') + "]"); }
public ActionResult Index(FormCollection collection) { DataTable dt = new DataTable(); string keyword = string.Empty; string pager = string.Empty; string wher = string.Empty; string query = string.Empty; string TYSHXYDM = string.Empty; Dictionary <KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>, object> where = new Dictionary <KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>, object>(); if (collection != null) { if (!TYSHXYDM.IsNullOrEmpty()) { keyword = Request["Keyword"]; where.Add(new KeyValuePair <string, RoadFlow.Data.Model.SQLFilterType>("TYSHXYDM", RoadFlow.Data.Model.SQLFilterType.CHARINDEX), keyword); } } query = string.Format("&appid={0}&tabid={1}&Keyword={2}&flag={3}", Request.QueryString["appid"], Request.QueryString["tabid"], keyword, Request.QueryString["flag"]); RoadFlow.Platform.EnterpriseInfo infoDb = new RoadFlow.Platform.EnterpriseInfo(); dt = infoDb.GetPagerData(out pager, query, pageSize, RoadFlow.Utility.Tools.GetPageNumber(), where); ViewBag.DisplayName = MyExtensions.GetModelDispalyName <RoadFlow.Data.Model.EnterpriseInfo>(new List <string>() { "Name", "TYSHXYDM", "Type", "ArtificialPerson" }); ViewBag.Pager = pager; ViewBag.Keyword = keyword; return(View(dt)); }
public string Delete() { RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary(); string text = base.Request.Form["ids"]; StringBuilder stringBuilder = new StringBuilder(); using (TransactionScope transactionScope = new TransactionScope()) { string[] array = text.Split(','); for (int i = 0; i < array.Length; i++) { Guid id = default(Guid); if (MyExtensions.IsGuid(array[i], out id)) { RoadFlow.Data.Model.AppLibrary appLibrary2 = appLibrary.Get(id); if (appLibrary2 != null) { stringBuilder.Append(MyExtensions.Serialize(appLibrary2)); appLibrary.Delete(id); new RoadFlow.Platform.AppLibraryButtons1().DeleteByAppID(id); new RoadFlow.Platform.AppLibrarySubPages().DeleteByAppID(id); } } } new RoadFlow.Platform.Menu().ClearAllDataTableCache(); new RoadFlow.Platform.AppLibraryButtons1().ClearCache(); new RoadFlow.Platform.AppLibrarySubPages().ClearCache(); RoadFlow.Platform.Log.Add("删除了一批应用程序库", stringBuilder.ToString(), RoadFlow.Platform.Log.Types.菜单权限); transactionScope.Complete(); } return("删除成功!"); }
private void txtMargin_KeyPress(object sender, KeyPressEventArgs e) { if (!MyExtensions.isInt(e.KeyChar, (sender as TextBox).Text)) { e.Handled = true; } }
public void SaveChargeData(StreamWriter ioStream) { StreamWriter recordStream = ioStream; recordStream.WriteLine("Date time , SOC %, Charge Current , Charge Voltage, Pack mA, Pack mV, Min Cell mV, Max Cell mV, Min Cell Temp, Max Cell Temp, Balance +, Balance -, Charge Voltage Error, Discharge Voltage Error"); foreach (ChargeData chargeData in chargeDataSet) { string newLine = ""; newLine = newLine + MyExtensions.AlignLeft(chargeData.DateTime.ToString("HH:mm:ss"), 14, false); newLine = newLine + MyExtensions.AlignLeft(chargeData.SOCAsInt.ToString(), 7, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.ChargeCurrentmA.ToString(), 17, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.ChargeVoltagemV.ToString(), 16, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.PackmA.ToString(), 9, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.PackmV.ToString(), 9, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.MinCellmV.ToString(), 13, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.MaxCellmV.ToString(), 13, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.MinCellTemp.ToString(), 15, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.MaxCellTemp.ToString(), 15, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.BalanceVoltageThresholdRising.ToString(), 11, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.BalanceVoltageThresholdFalling.ToString(), 11, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.ChargeCellVoltageError.ToString(), 22, true); newLine = newLine + MyExtensions.AlignLeft(chargeData.DischargeCellVoltageError.ToString(), 12, true); recordStream.WriteLine(newLine); } ioStream.Close(); recordStream.Close(); }
// GET: Meetings public ActionResult Index(string pn, DateTime?md, int?page, int?rt) { var meetings = db.Meetings.Where(x => x.MeetingID > 0); if (rt != null) { ViewBag.RegisterTypeID = rt; meetings = db.Meetings.Where(x => x.RegisterTypeID == rt); } if (!string.IsNullOrEmpty(pn)) { meetings = meetings.Where(p => p.ProposerName.Contains(pn)); page = 1; } if (md != null) { meetings = meetings.Where(p => p.MeetingDate == md); page = 1; } if (md == null && pn?.Length == 0) { int FinYr = MyExtensions.GetFinYr(); meetings = meetings.Where(p => ((DateTime)p.MeetingDate).Year == FinYr); } ViewBag.PanchName = db.Configs.FirstOrDefault().VP; ViewBag.MeetingD = md?.ToString("dd/MMM/yyyy") ?? ""; int pageSize = db.Configs.FirstOrDefault().RowsPerPage ?? 5; int pageNumber = (page ?? 1); return(View(meetings.ToList().ToPagedList(pageNumber, pageSize))); }
public void TestAreaOfTriangle() { double a1 = 7.0; double b1 = 10.0; double c1 = 5.0; double expected_area1 = 16.25; double a2 = 5.0; double b2 = 12.0; double c2 = 18.0; double expected_area2 = -1.0; double a3 = -5.0; double b3 = -12.0; double c3 = -16.0; double expected_area3 = -1.0; //assert double actual1 = MyExtensions.AreaTriangle(a1, b1, c1); Assert.AreEqual(expected_area1, actual1, 0.001, "Area of the triangle is not calculated correctly"); double actual2 = MyExtensions.AreaTriangle(a2, b2, c2); Assert.AreEqual(expected_area2, actual2, "Triangle cant possible tested successfully"); double actual3 = MyExtensions.AreaTriangle(a3, b3, c3); Assert.AreEqual(expected_area3, actual3, "Negative sides are not allowed tested successfully"); }
/// <summary> /// Выполняет регистрацию пользователя на сайте /// </summary> /// <param name="userName">Имя пользователя</param> /// <param name="email">Эл. Адрес</param> /// <param name="password">Пароль пользователя</param> /// <returns>System.String.</returns> public static string Register(string userName, string email, string password) { var salt = MyExtensions.GetSalt(); Services.Users.Register(userName, email, password, salt); return(salt); }
public void TestFindMostCommon() { List <int> li = new List <int>() { 5, 4, 3, 2, 4, 5, 1, 6, 1, 2, 5, 4 }; List <int> li2 = new List <int>() { 1, 2, 3, 4, 5, 1, 6, 7 }; List <int> li3 = new List <int>() { 1, 2, 3, 4, 5, 6, 7 }; List <int> res = new List <int>() { 5, 4 }; List <int> res2 = new List <int>() { 1 }; List <int> res3 = new List <int>() { 1, 2, 3, 4, 5, 6, 7 }; CollectionAssert.AreEqual(res, MyExtensions.FindMostCommon(li), " Output tested successfully"); CollectionAssert.AreEqual(res2, MyExtensions.FindMostCommon(li2), "Output tested successfully"); CollectionAssert.AreEqual(res3, MyExtensions.FindMostCommon(li3), " Output tested successfully"); }
public ActionResult Form10Report(FormCollection dt) { if (dt["RptYear"] == null || dt["RptMonth"] == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } int RptYr = int.Parse(dt["RptYear"]); int RptMon = int.Parse(dt["RptMonth"]); string queryString = @"SELECT l.Ledger, sl.Ledger as SubLedger, l.IsIncome, COALESCE(SUM(Amount),0) as Amount FROM Ledgers l INNER JOIN SubLedgers sl ON l.LedgerID=sl.LedgerID LEFT JOIN Form3 f3 ON (sl.SubLedgerID=f3.SubLedgerID AND MONTH(f3.PayDate)=@RptMon AND YEAR(f3.PayDate)=@RptYr) GROUP BY l.IsIncome, l.Ledger, sl.Ledger" ; var parameters = new List <SqlParameter> { new SqlParameter("@RptMon", RptMon), new SqlParameter("@RptYr", RptYr) }; var Form10 = db.Database.SqlQuery <Form10rpt>(queryString, parameters.ToArray()); ViewBag.vpname = db.Configs.Find(1).VP; ViewBag.MonYr = MyExtensions.MonthFromInt(RptMon) + " " + RptYr; //Fetch Opening balance DateTime lastMonDate = DateTime.Parse($"01/{RptMon}/{RptYr}").AddDays(-1); var ob = db.CBRunnings.FirstOrDefault(r => r.EntryDate == lastMonDate); ViewBag.OpeningBalance = ob.CBTotal; return(View("Form10Report", Form10.ToList())); }
public ActionResult RptRq(int?page) { ViewBag.YearBox = MyExtensions.MakeYrRq(8, 1, DateTime.Today.Year); ViewBag.MonthBox = MyExtensions.MonthList(); ViewBag.ReturnAction = "OCbalance"; return(View()); }
public void UpdateExploration(Vector2 playerGridPos) { if (processedFullSizeMapDataForExploration == null) { return; } // If I flip all 1s to 0s it can make calculating unexplored regions easier.. int radius = 80; int centerX = (int)playerGridPos.X; int centerY = (int)playerGridPos.Y; //var cameraToGridAngle = 0.25 * Math.PI; int startX = MyExtensions.Clamp <int>(centerX - radius, 0, int.MaxValue); int startY = MyExtensions.Clamp <int>(centerY - radius, 0, int.MaxValue); int stopX = MyExtensions.Clamp <int>(centerX + radius, 0, processedFullSizeMapDataForExploration.GetLength(0)); int stopY = MyExtensions.Clamp <int>(centerY + radius, 0, processedFullSizeMapDataForExploration.GetLength(1)); try { GetSubMap(playerGridPos, initializeIfNotPresent: false)?.Exploration?.UpdateExploration(startX, startY, stopX - startX, stopY - startY); } catch { Console.WriteLine("Update exploration exception: start X: {0}, stopX: {1}, startY: {2}, stopY: {3}", startX, stopX, startY, stopY); } }
// GET: Inwards public ActionResult Index(int?page, DateTime?dr, DateTime?dl, int?rt) { var inwards = db.Inwards.Where(x => x.InwardID > 0); if (rt != null) { ViewBag.RegisterTypeID = rt; inwards = db.Inwards.Where(x => x.RegisterTypeID == rt); } if (dr != null) { inwards = inwards.Where(x => x.DateOfReciept == dr); page = 1; } if (dl != null) { inwards = db.Inwards.Where(x => x.DateOfLett == dl); } if (dr == null && dl == null) { int FinYr = MyExtensions.GetFinYr(); inwards = inwards.Where(x => ((DateTime)x.DateOfReciept).Year == FinYr); } int pageSize = db.Configs.FirstOrDefault().RowsPerPage ?? 5; int pageNumber = (page ?? 1); return(View(inwards.ToList().ToPagedList(pageNumber, pageSize))); }
// GET: Demands/Edit/5 public ActionResult Edit(int id, int SLid) { if (id == null || SLid == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Demand demand = db.Demands.Find(id); if (demand == null) { return(HttpNotFound()); } var Dmds = db.DemandDetails.FirstOrDefault(d => d.DemandID == id && d.SubLedgerID == SLid); int pd = GetCurrentPeriod(); var dp = db.DemandPeriods.FirstOrDefault(p => p.DDID == Dmds.DDID && p.PeriodID == pd); var DME = new DemandInitEdit { DemandID = demand.DemandID, DDID = Dmds.DDID, HouseNo = demand.HouseNo, Remarks = demand.Remarks, StopDate = demand.StopDate.Year, Amt = dp.Amount, DemandPeriodID = dp.PeriodID }; ViewBag.Citizen = demand.Citizen.Name; ViewBag.CitizenID = demand.CitizenID; ViewBag.SubLedger = $"For: {Dmds.SubLedger.Ledger1.Ledger1 } >> {Dmds.SubLedger.Ledger}"; ViewBag.YearBox = MyExtensions.MakeYrRq(1, 1, DateTime.Today.Year); return(View(DME)); }
public ActionResult Create(GuestImg GstImg) { if (ModelState.IsValid) { if (GstImg.UploadedFile != null) { string fn = GstImg.UploadedFile.FileName.Substring(GstImg.UploadedFile.FileName.LastIndexOf('\\') + 1); fn = GstImg.gst.Firstn1.Substring(0, 3) + "_" + fn; System.Drawing.Bitmap upimg = new System.Drawing.Bitmap(GstImg.UploadedFile.InputStream); System.Drawing.Bitmap svimg = MyExtensions.CropUnwantedBackground(upimg); svimg.Save(System.IO.Path.Combine(Server.MapPath("~/IdImgs"), fn)); Guest ed = GstImg.gst; ed.Path = fn; db.Guests.Add(ed); db.SaveChanges(); return(RedirectToAction("Details", new { Id = ed.Id })); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } return(View(GstImg)); }
/// <summary> /// Calls Prepare() on any MonoBehaviour with IPrepare interface. If Prepare() returns true, parent scene will be marked dirty /// </summary> public static void RunPrepare() { if (OnPrepare != null) { OnPrepare(); } var toPrepare = MyExtensions.FindObjectsOfInterfaceAsComponents <IPrepare>(); HashSet <Scene> modifiedScenes = null; foreach (var prepare in toPrepare) { bool changed = prepare.Interface.Prepare(); if (changed && prepare.Component != null) { if (modifiedScenes == null) { modifiedScenes = new HashSet <Scene>(); } modifiedScenes.Add(prepare.Component.gameObject.scene); EditorUtility.SetDirty(prepare.Component); Debug.Log(prepare.Component.name + "." + prepare.Component.GetType().Name + ": Changed on Prepare", prepare.Component); } } if (modifiedScenes != null) { EditorSceneManager.SaveScenes(modifiedScenes.ToArray()); } }
public string GetNames_SQL() { string text = base.Request.QueryString["dbconn"]; string text2 = base.Request.QueryString["sql"]; RoadFlow.Platform.DBConnection dBConnection = new RoadFlow.Platform.DBConnection(); RoadFlow.Data.Model.DBConnection dbconn = dBConnection.Get(MyExtensions.ToGuid(text)); DataTable dataTable = dBConnection.GetDataTable(dbconn, MyExtensions.ReplaceSelectSql(MyExtensions.UrlDecode(text2).FilterWildcard())); string obj = base.Request.QueryString["values"] ?? ""; StringBuilder stringBuilder = new StringBuilder(); string[] array = obj.Split(','); foreach (string a in array) { string empty = string.Empty; string value = string.Empty; foreach (DataRow row in dataTable.Rows) { empty = row[0].ToString(); if (a == empty) { value = ((dataTable.Columns.Count > 1) ? row[1].ToString() : empty); break; } } stringBuilder.Append(value); stringBuilder.Append(','); } return(stringBuilder.ToString().TrimEnd(',')); }