public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; try { DARManager objDARDetailsList = new DARManager(); eTracLoginModel ObjLoginModel = null; System.Collections.Specialized.NameValueCollection forms = context.Request.Form; long?locationId = null; long?userId = null; long loginUserId = 0; if (Convert.ToInt64(request["empId"]) != 0) { userId = Convert.ToInt64(request["empId"]); } else { userId = null; } int?taskType = null; if (Convert.ToInt32(request["taskType"]) != 0) { taskType = Convert.ToInt32(request["taskType"]); } else { taskType = null; } //(Convert.ToInt64(request["empId"])!=0) ? Convert.ToInt64(request["empId"]) : null; string _search = request["_search"]; string textSearch = request["txtSearch"] ?? ""; int numberOfRows = Convert.ToInt32(request["rows"]); int pageIndex = Convert.ToInt32(request["page"]); string sortColumnName = request["sidx"]; string sortOrderBy = request["sord"]; //Getting client date time. var clientdt = DateTime.UtcNow.GetClientDateTimeNow(); //flag status for if user filter record in time span so to date is till midnight. bool isUTCDay = true; //Fetching record like 2017-06-11T00:00:00-04:00 to 2017-06-12T00:0000-04:00 string fromDate = (request["fromDate"] == null || request["fromDate"] == " " || request["fromDate"] == "") ? clientdt.Date.ToString(): request["fromDate"]; string toDate = (request["toDate"] == null || request["toDate"] == " " || request["toDate"] == "") ? clientdt.AddDays(1).Date.ToString(): request["toDate"]; //maintaining flag if interval date come then need to fetch record till midnight of todate day if (request["toDate"] != null && request["toDate"] != "" && request["fromDate"] != "null") { DateTime tt = Convert.ToDateTime(toDate); if (tt.ToLongTimeString() == "12:00:00 AM") { isUTCDay = false; } } if (fromDate != null && toDate != null) { DateTime frmd = Convert.ToDateTime(fromDate); DateTime tod = Convert.ToDateTime(toDate); ////if interval date come then need to fetch record till midnight of todate day if ((frmd.Date != tod.Date) && (tod.ToLongTimeString() == "12:00:00 AM") && isUTCDay == false) { tod = tod.AddDays(1).Date; toDate = tod.ToString(); } if ((frmd.Date == tod.Date) && (tod.ToLongTimeString() == "12:00:00 AM")) { tod = tod.AddDays(1).Date; toDate = tod.ToString(); } } if (context.Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(context.Session["eTrac"]); locationId = ObjLoginModel.LocationID; loginUserId = ObjLoginModel.UserId; //Added by Bhushan due to useid is null in Sp. It will not return created on due joinon the basis of userid. } //Converting datetime from userTZ to UTC fromDate = Convert.ToDateTime(fromDate).ConvertClientTZtoUTC().ToString(); toDate = Convert.ToDateTime(toDate).ConvertClientTZtoUTC().ToString(); ObjectParameter totalRecords = new ObjectParameter("TotalRecords", typeof(int)); var darDetailsList = objDARDetailsList.GetDARDetails(loginUserId, locationId, userId, taskType, pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, totalRecords, fromDate, toDate); if (darDetailsList.Count() > 0) { string output = BuildJQGridResults(darDetailsList, numberOfRows, pageIndex, Convert.ToInt32(totalRecords.Value)); response.Write(output); } else { JQGridResults result = new JQGridResults(); List <JQGridRow> rows = new List <JQGridRow>(); result.rows = rows.ToArray(); result.page = 0; result.total = 0; result.records = 0; response.Write(new JavaScriptSerializer().Serialize(result)); } } catch (Exception ex) { Exception_B.exceptionHandel_Runtime(ex, "public void ProcessRequest(HttpContext context)-DARDetails.ashx", "context", context.ToString()); JQGridResults result = new JQGridResults(); List <JQGridRow> rows = new List <JQGridRow>(); result.rows = rows.ToArray(); result.page = 0; result.total = 0; result.records = 0; response.Write(new JavaScriptSerializer().Serialize(result)); } }
public ActionResult Index(eTracLoginModel eTracLogin) { try { //TimeZoneInfo nyTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); //DateTime nyTime = GetLocalDateTime(DateTime.UtcNow, nyTimeZone); //if (nyTimeZone.IsDaylightSavingTime(nyTime)) string loginMessage = ""; if (ModelState.IsValid) { eTracLoginModel result = _ILogin.AuthenticateUser(eTracLogin); //result.RememberMe = eTracLogin.RememberMe; if (result.UserId > 0) { this.CreateAuthenticateFormsTicket(result); Common_B obj_Common_B = new Common_B(); Session["eTrac_SelectedDasboardLocationID"] = result.LocationID; Session["eTrac_UserRoles"] = this.Get_UserAssignedRoles(); Session["eTrac_DashboardWidget"] = this.GetUserDashboardWidget(); Session["eTrac_LocationServices"] = obj_Common_B.GetLocationServicesByLocationID(result.LocationID, result.UserRoleId); Session["eTrac_ProfileImage"] = result.ProfileImage; CallbackController.UserRoleId = result.UserRoleId; CallbackController.UserId = result.UserId; HomeController.UserRoleId = result.UserRoleId; HomeController.UserId = result.UserId; switch (result.UserRoleId) { case ((Int64)(UserType.GlobalAdmin)): Session["eTrac_UserLocations"] = _ILogin.GetUserAssignedLocations(result.UserRoleId, result.UserId); Session["eTrac_UserRoles"] = Session["eTrac_LocationServices"]; // this line has been added by vijay bcz if usetype is GAdmin or ITAdmin then this type of users will be able too see all services which is assigned to this current location. // QuickBookIndex(); return(RedirectToAction("Index", "GlobalAdmin")); break; case ((Int64)(UserType.ITAdministrator)): Session["eTrac_UserLocations"] = _ILogin.GetUserAssignedLocations(result.UserRoleId, result.UserId); Session["eTrac_UserRoles"] = Session["eTrac_LocationServices"]; //QuickBookIndex(); return(RedirectToAction("Index", "ITAdministrator")); break; case ((Int64)(UserType.Administrator)): Session["eTrac_UserLocations"] = _ILogin.GetAdminAssignedLocation(result.UserId); // QuickBookIndex(); return(RedirectToAction("Index", "Administrator")); break; case ((Int64)(UserType.Manager)): Session["eTrac_UserLocations"] = _ILogin.GetManagerAssignedLocation(result.UserId); #region this code will execute only when manager declined vendor from vendor email verification page. try { if (Request.Cookies["eTrack_VendorIdForEditAfterDeclinedByManager"] != null) { string isVendorIDExists = Request.Cookies["eTrack_VendorIdForEditAfterDeclinedByManager"]["VendorID"]; if (isVendorIDExists != null) { var abc = Cryptography.GetDecryptedData(isVendorIDExists, true); if (Convert.ToInt32(abc) > 0) { //string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"], System.Globalization.CultureInfo.InvariantCulture); //var adfadsf = HostingPrefix + "/Manager/EditRegisterVendor/?vdr=" + isVendorIDExists; //Response.Redirect(adfadsf); // QuickBookIndex(); return(RedirectToAction("EditRegisterVendor", "Manager", new { vdr = isVendorIDExists })); } } } } catch { } #endregion // by vijay sahu on 2 july 2015 #region This Code Will Execute if Vehicle Declined by Manager and after login redirect to edit vehicle try { if (Request.Cookies["eTrac_VehicleIdForEditAfterDeclinedByManager"] != null) { string isVehicleIDExists = Request.Cookies["eTrac_VehicleIdForEditAfterDeclinedByManager"]["QRCID"]; if (isVehicleIDExists != null) { var abc = Cryptography.GetDecryptedData(isVehicleIDExists, true); if (Convert.ToInt32(abc) > 0) { //string HostingPrefix = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["hostingPrefix"], System.Globalization.CultureInfo.InvariantCulture); var redirectURL = HostingPrefix + "QRCSetup/VehicleRegistration/?qr=" + isVehicleIDExists; Response.Redirect(redirectURL); //return RedirectToAction("VehicleRegistration", "QRCSetup", new { qr = isVehicleIDExists }); } } } } catch { } #endregion // by Bhushan Dod on 22 September 2015 //QuickBookIndex(); return(RedirectToAction("Dashboard", "Manager")); break; case ((Int64)(UserType.Employee)): Session["eTrac_UserLocations"] = _ILogin.GetEmployeeAssignedLocation(result.UserId); //QuickBookIndex(); return(RedirectToAction("Index", "Employee")); break; case ((Int64)(UserType.Client)): //Session["eTrac_UserLocations"] = _ILogin.GetEmployeeAssignedLocation(result.UserId); //QuickBookIndex(); return(RedirectToAction("Index", "Client")); break; } }//else { ModelState.AddModelError("", "User not found. Please check UserName or Password"); } else { loginMessage = "User not found. Please check Username or Password"; } }//else { ModelState.AddModelError("", "Invalid UserName or Password"); } else { loginMessage = "Invalid Username or Password"; } ViewBag.Message = loginMessage; ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger; } catch (Exception ex) { Exception_B.exceptionHandel_Runtime(ex, "public ActionResult Index(eTracLoginModel eTracLogin)", "from loginController", eTracLogin); ViewBag.Error = ex.Message; ViewBag.Message = "Something went wrong. Please contact support team."; ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger; }//ModelState.AddModelError("", ex.Message); return(View("Index", eTracLogin)); }
public JsonResult GetFuelingList(int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string frmDate = null, string todate = null, string sidx = null, string statusType = null) { eTracLoginModel ObjLoginModel = null; if (Session != null) { if (Session["eTrac"] != null) { ObjLoginModel = (eTracLoginModel)(Session["eTrac"]); if (Convert.ToInt64(Session["eTrac_SelectedDasboardLocationID"]) == 0) { (Session["eTrac_SelectedDasboardLocationID"]) = ObjLoginModel.LocationID; } } } //Getting client date time. var clientdt = DateTime.UtcNow.GetClientDateTimeNow(); //flag status for if user filter record in time span so to date is till midnight. bool isUTCDay = true; //Fetching record like 2017-06-11T00:00:00-04:00 to 2017-06-12T00:0000-04:00 string fromDate = (frmDate == null || frmDate == " " || frmDate == "") ? clientdt.Date.ToString() : frmDate; string toDate = (todate == null || todate == " " || todate == "") ? clientdt.AddDays(1).Date.ToString() : todate; //maintaining flag if interval date come then need to fetch record till midnight of todate day if (todate != null && todate != "" && frmDate != null && frmDate != "") { DateTime tt = Convert.ToDateTime(toDate); if (tt.ToLongTimeString() == "12:00:00 AM") { isUTCDay = false; } } if (fromDate != null && toDate != null) { DateTime frmd = Convert.ToDateTime(fromDate); DateTime tod = Convert.ToDateTime(toDate); ////if interval date come then need to fetch record till midnight of todate day if ((frmd.Date != tod.Date) && (tod.ToLongTimeString() == "12:00:00 AM") && isUTCDay == false) { tod = tod.AddDays(1).Date; toDate = tod.ToString(); } if ((frmd.Date == tod.Date) && (tod.ToLongTimeString() == "12:00:00 AM")) { tod = tod.AddDays(1).Date; toDate = tod.ToString(); } } //Converting datetime from userTZ to UTC DateTime fDate = Convert.ToDateTime(fromDate).ConvertClientTZtoUTC(); DateTime tDate = Convert.ToDateTime(toDate).ConvertClientTZtoUTC(); var objeFleetFuelingModelForService = new eFleetFuelingModelForService(); JQGridResults result = new JQGridResults(); List <JQGridRow> rowss = new List <JQGridRow>(); sord = string.IsNullOrEmpty(sord) ? "desc" : sord; sidx = string.IsNullOrEmpty(sidx) ? "FuelingDate" : sidx; txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator); try { var eFleetFuelingList = _IeFleetFuelingManager.GetListeFleetFuelingForJQGridDetails(ObjLoginModel.LocationID, rows, TotalRecords, sidx, sord, txtSearch, Convert.ToInt64(statusType), fDate, tDate); foreach (var eFleetFuel in eFleetFuelingList.rows) { JQGridRow row = new JQGridRow(); row.id = Cryptography.GetEncryptedData(Convert.ToString(eFleetFuel.FuelID), true); row.cell = new string[11]; row.cell[0] = eFleetFuel.VehicleNumber; row.cell[1] = eFleetFuel.QRCodeID; row.cell[2] = eFleetFuel.Mileage; //row.cell[3] = eFleetFuel.CurrentFuel; row.cell[3] = eFleetFuel.FuelTypeName; //row.cell[5] = eFleetFuel.ReceiptNo; row.cell[4] = eFleetFuel.FuelingDate.ToString("MM'/'dd'/'yyyy hh:mm tt"); row.cell[5] = Convert.ToString(eFleetFuel.Gallons); row.cell[6] = ("$" + Convert.ToString(eFleetFuel.PricePerGallon)); row.cell[7] = ("$" + Convert.ToString(eFleetFuel.Total)); row.cell[8] = eFleetFuel.GasStatioName; //row.cell[11] = eFleetFuel.CardNo; row.cell[9] = eFleetFuel.DriverName; row.cell[10] = eFleetFuel.FuelReceiptImage; rowss.Add(row); } result.rows = rowss.ToArray(); result.page = Convert.ToInt32(page); result.total = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value); result.records = Convert.ToInt32(TotalRecords.Value); } catch (Exception ex) { Exception_B.exceptionHandel_Runtime(ex, "JsonResult GetFuelingList(string _search, int? rows = 20, int? page = 1, int? TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string statusType = null)", "eFleetFuelingController", null); List <JQGridRow> rowsss = new List <JQGridRow>(); result.rows = rowsss.ToArray(); result.page = 0; result.total = 0; result.records = 0; return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); }