bool __isLogIn() { if (Session["_intCurrentID"] == null) { return(false); } else { MyWSContext ws = new MyWSContext(); try { using (DataTable _DTRecord = ws.AMSWebService.GetUserStatus(Session["_intCurrentID"].ToString(), Session["CustomerID"].ToString())) { foreach (DataRow DR in _DTRecord.Rows) { if (DR[1].ToString().ToUpper() != Session["_strCurrentIDCode"].ToString()) { Response.Cookies["AMSCookie"]["_intCurrentID"] = null; Session.Clear(); return(false); } } } } catch { Response.Cookies["AMSCookie"]["_intCurrentID"] = null; Session.Clear(); return(false); } } return(true); }
public JsonResult SaveAsset(string _strReceivedCode, string _strAssetCodes) { try { if (_strAssetCodes != "") { string[] listofCodes = _strAssetCodes.Split('+'); MyWSContext ws = new MyWSContext(); foreach (string subcode in listofCodes) { if (subcode != "") { string[] subcodewqty = subcode.Split('`'); string _strInput = _strReceivedCode + "`" + subcodewqty[0] + "`" + subcodewqty[1] + "`" + subcodewqty[2] + "`" + subcodewqty[3] + "`" + subcodewqty[4] + "`" + subcodewqty[5]; string[] _strOutput = ws.AMSWebService.SettingAssetReceiving_SaveRecordAssets(false, "", _strInput, Session["CustomerID"].ToString()).Split('`'); } } return(Json(new { Success = true, msg = "Successful" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Success = false, msg = "Please select at least one item." }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult UserUpdateProfile() { if (Session["_intCurrentID"] != null) { UserAccount usr = new UserAccount(); MyWSContext ws = new MyWSContext(); using (DataTable _tblusers = ws.AMSWebService.LoadUserInfo_PerUserID(int.Parse(Session["_intCurrentID"].ToString()), Session["CustomerID"].ToString())) { foreach (DataRow DR in _tblusers.Rows) { usr.CurrentID = DR[0].ToString(); usr.CurrentUserName = DR[14].ToString(); //ws.Decrypt(DR[17].ToString(), true); usr.Password = DR[15].ToString(); //ws.Decrypt(DR[18].ToString(), true); ViewBag.SystemError = ""; ViewBag.SystemSuccess = ""; } } return(View(usr)); } else { return(RedirectToAction("Login")); } }
public ActionResult Edit(AssetReceivedModel Data) { try { if (Session["_intCurrentID"] == null) { return(RedirectToAction("Login", "Account")); } try { if (bool.Parse(Session["AssetReceivedEditAccess"].ToString()) == false && bool.Parse(Session["AssetReceivedViewAccess"].ToString()) == false) { return(RedirectToAction("List", "AssetReceived")); } } catch { return(RedirectToAction("List", "AssetReceived")); } MyWSContext ws = new MyWSContext(); string _strWhereStatement = Session["CurrentID"] + "`````````````````````"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingReceivingfromSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString())) { foreach (DataRow DR in _DTRecord.Rows) { Data.cbCurrency = GetDropDownItem(false, "Currency"); Data.cbSupplier = GetDropDownItem(false, "Supplier"); Data.cbWarehouse = GetDropDownItem(false, "Warehouse"); Data.cbTransactionBy = GetDropDownItem(false, "Employees"); Data.cbReceviedBy = GetDropDownItem(false, "Employees"); Data.CurrentID = DR[0].ToString(); Data.fldDateEncoded = DateTime.Parse(DR[1].ToString()); Data.fldCode = DR[2].ToString(); Data.fldSupplierCode = DR[3].ToString(); Data.fldPONo = DR[4].ToString(); Data.fldDRNo = DR[5].ToString(); Data.fldDRDate = DateTime.Parse(DR[6].ToString()); Data.fldCurrency = DR[7].ToString(); Data.fldWarehouseCode = DR[8].ToString(); Data.fldRemarks = DR[9].ToString(); Data.fldTransactionByCode = DR[10].ToString(); Data.fldReceivedByCode = DR[11].ToString(); Session["fldAuthorizedStatus"] = DR[16].ToString(); } } return(View(Data)); } catch { } return(View(Data)); }
public PartialViewResult ViewAssetsSelection(string _strFilter) { DataTable dt = new DataTable(); AssetReceivedModel Data = new AssetReceivedModel(); try { _strFilter = _strFilter.Replace("undefined", ""); Data.fldPageLimit = 8; try { Data.fldSearchText = _strFilter.Split('`')[6]; Data.fldPageNo = int.Parse(_strFilter.Split('`')[5]); } catch { Data.fldPageNo = 1; } MyWSContext ws = new MyWSContext(); using (DataTable _DTRecord = ws.AMSWebService.LoadSettingAssetWOAsset_Where(_strFilter, Session["CustomerID"].ToString())) { ViewBag.RecordCount = _DTRecord.Rows.Count; try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } _DTRecord.DefaultView.Sort = "fldAssetLevel,fldName"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["AssetWOAssetRecordData"] = dt; Data.cbPageLimit = GetDropDownPageLimit(); Data.cbPurchasingUOM = GetDropDownItem(false, "UOM"); Data.cbCostCenter = GetDropDownItem(true, "CostCenter"); ViewBag.fldPageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } } catch { ViewData["AssetWOAssetRecordData"] = dt; } return(PartialView(Data)); }
//// //Warehouse public PartialViewResult ViewWarehouseSearch(string _strFilter) { DataTable dt = new DataTable(); AssetReceivedModel Data = new AssetReceivedModel(); try { _strFilter = _strFilter.Replace("undefined", ""); Data.fldPageLimit = 10; try { Data.fldSearchTextWarehouse = _strFilter.Split('`')[1]; Data.fldPageNo = int.Parse(_strFilter.Split('`')[0]); } catch { Data.fldPageNo = 1; } MyWSContext ws = new MyWSContext(); string _strWhereStatement = "```" + Data.fldSearchTextWarehouse + "`"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingWarehouse_Where(_strWhereStatement, Session["CustomerID"].ToString())) { ViewBag.RecordCount = _DTRecord.Rows.Count; try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } _DTRecord.DefaultView.Sort = "fldName"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["AssetWarehouseRecordData"] = dt; Data.cbPageLimit = GetDropDownPageLimit(); ViewBag.PageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } } catch { ViewData["AssetWarehouseRecordData"] = dt; } return(PartialView(Data)); }
public ActionResult UserUpdateProfile(UserAccount Data) { if (Session["_intCurrentID"] != null) { MyWSContext ws = new MyWSContext(); try { if (Data.Password == Data.ConfirmPassword && Data.Password != null) { string _strInputValidation = Data.CurrentUserName + "`" + Data.CurrentPassword; string _strInput = Data.CurrentID + "`" + "`" + Data.UserName + "`" + Data.Password; byte[] tempPic = { 1, 2 }; string[] _strOutput = ws.AMSWebService.UserChangePassword_SaveRecord(true, _strInputValidation, _strInput, tempPic, Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ViewBag.SystemError = ""; ViewBag.SystemSuccess = _strOutput[1]; ModelState.AddModelError("", _strOutput[1]); Response.Cookies["AMSCookie"]["_intCurrentID"] = null; Session.Clear(); return(RedirectToAction("Index", "Home")); } else { ViewBag.SystemSuccess = ""; ViewBag.SystemError = _strOutput[1]; ModelState.AddModelError("", _strOutput[1]); } } else { ViewBag.SystemSuccess = ""; ViewBag.SystemError = "Please correct these errors:"; ModelState.AddModelError("", "Please correct these errors:"); } } catch (Exception ex) { ViewBag.SystemError = ex.Message; ModelState.AddModelError("", ex.Message); } return(View()); } else { return(RedirectToAction("Login")); } }
public ActionResult Index() { if (!__isLogIn()) { return(RedirectToAction("Login", "Account")); } if (Session["_intCurrentID"] != null) { MyWSContext ws = new MyWSContext(); try { ViewBag.StaffRegistered = 0; ViewBag.StaffPresenttoday = 0; Session["CurrentMenu"] = "Dashboard"; } catch { } List <string> listofModules = new List <string>(); try { string _strError = ""; using (DataTable _DTRecord = ws.AMSWebService.LoadSetupModules("COMPLETE", Session["_strAccessName"].ToString(), Session["CustomerID"].ToString(), out _strError)) { foreach (System.Data.DataRow dr in _DTRecord.Rows) { listofModules.Add(dr[2].ToString() + " - " + dr[4].ToString()); } } Session["listofModules"] = listofModules; } catch { Session["listofModules"] = listofModules; } ViewBag.AccountRegistered = ws.AMSWebService.CountCommuterAccounts_Where(Session["CustomerID"].ToString()); ViewBag.TodayActiveCommuters = ws.AMSWebService.CountCommuterAccounts_Today(Session["CustomerID"].ToString()); ViewBag.RewardsTotal = ws.AMSWebService.RewardsTotal(Session["CustomerID"].ToString()); ViewBag.ScannedAdsCount = ws.AMSWebService.ScannedAdsCount(Session["CustomerID"].ToString()); ViewBag.PassengerCountsToday = ws.AMSWebService.PassengerCounts_Today(Session["CustomerID"].ToString()); //ViewBag.DaysLeft = ws.AMSWebService.LoadDaysLeft_Where(Session["CustomerID"].ToString()); return(View()); } else { return(RedirectToAction("Login", "Account")); } }
// //ASSETS public PartialViewResult ViewAssets(string _strReceivedCode) { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = _strReceivedCode + "``````"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingAssetAsset_Where(_strWhereStatement, Session["CustomerID"].ToString())) { ViewData["AssetRecordData"] = _DTRecord; } } catch (Exception ex) { DataTable dt = new DataTable(); ViewData["AssetRecordData"] = dt; } return(PartialView()); }
// public PartialViewResult ViewAssetMainSubInfo(string _strCode, string _isMain) { try { MyWSContext ws = new MyWSContext(); using (DataTable _DTRecord = ws.AMSWebService.LoadAssetMainSubInfo_Where(_strCode, bool.Parse(_isMain), Session["CustomerID"].ToString())) { ViewData["AssetMainSubRecordData"] = _DTRecord; } } catch { DataTable dt = new DataTable(); ViewData["AssetMainSubRecordData"] = dt; } return(PartialView()); }
public ActionResult Edit(UserAccess Data) { try { if (Session["_intCurrentID"] == null) { return(RedirectToAction("Login", "Account")); } try { if (bool.Parse(Session["UserAccessEditAccess"].ToString()) == false && bool.Parse(Session["UserAccessViewAccess"].ToString()) == false) { return(RedirectToAction("List", "UserAccess")); } } catch { return(RedirectToAction("List", "UserAccess")); } MyWSContext ws = new MyWSContext(); List <string> listofModules = new List <string>(); string _strError = ""; Data.fldAccessName = Session["fldAccessName"].ToString(); using (DataTable _DTRecord = ws.AMSWebService.LoadSetupModules("COMPLETE", Data.fldAccessName, Session["CustomerID"].ToString(), out _strError)) { foreach (System.Data.DataRow dr in _DTRecord.Rows) { listofModules.Add(dr[2].ToString() + "-" + dr[3].ToString() + "-" + dr[4].ToString()); } } Session["EditAccessModules"] = listofModules; return(View(Data)); } catch { } return(View(Data)); }
public JsonResult GetDashBoardValue() { try { MyWSContext ws = new MyWSContext(); ViewBag.AccountRegistered = ws.AMSWebService.CountCommuterAccounts_Where(Session["CustomerID"].ToString()); ViewBag.TodayActiveCommuters = ws.AMSWebService.CountCommuterAccounts_Today(Session["CustomerID"].ToString()); ViewBag.RewardsTotal = ws.AMSWebService.RewardsTotal(Session["CustomerID"].ToString()); ViewBag.ScannedAdsCount = ws.AMSWebService.ScannedAdsCount(Session["CustomerID"].ToString()); ViewBag.PassengerCountsToday = ws.AMSWebService.PassengerCounts_Today(Session["CustomerID"].ToString()); return(Json(new { Success = true, AccountRegistered = ViewBag.AccountRegistered, TodayActiveCommuters = ViewBag.TodayActiveCommuters, RewardsTotal = ViewBag.RewardsTotal, ScannedAdsCount = ViewBag.ScannedAdsCount, PassengerCountsToday = ViewBag.PassengerCountsToday }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult SaveLock(string _strInput) { try { MyWSContext ws = new MyWSContext(); string[] _strOutput = ws.AMSWebService.SettingReceivingfromSupplierLOCK_SaveRecord(true, "", _strInput + "`" + Session["_strCurrentUserCode"].ToString(), Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } else { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult Update(AssetReceivedModel Data) { try { MyWSContext ws = new MyWSContext(); string _strInput = Data.CurrentID + "`" + String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Now) + "`" + Data.fldCode + "`" + Data.fldSupplierCode + "`" + Data.fldPONo + "`" + Data.fldDRNo + "`" + Data.fldDRDate + "`" + Data.fldCurrency + "`" + Data.fldWarehouseCode + "`" + Data.fldRemarks + "`" + Data.fldTransactionByCode + "`" + Data.fldReceivedByCode + "`" + String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Now) + "`" + Data.fldAuthorizedByCode + "`" + Data.fldAuthorizedDateTime + "`" + Data.fldAuthorizedComment + "`" + Data.fldAuthorizedStatus; string[] _strOutput = ws.AMSWebService.SettingReceivingfromSupplier_SaveRecord(true, "", _strInput, Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } else { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult Delete(UserAccess Data) { try { MyWSContext ws = new MyWSContext(); string[] _strOutput = ws.AMSWebService.DELETESettingUserAccess_WHERE(Data.fldAccessName, Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } else { ViewBag.SystemError = _strOutput[1]; } } catch { } return(Json(new { Success = false, msg = ViewBag.SystemError }, JsonRequestBehavior.AllowGet)); }
public JsonResult Update(RfidSettingModel Data) { try { MyWSContext ws = new MyWSContext(); string _strInput = "`" + Data.fldPCSerialNo + "`" + Data.fldRFIDIPaddress + "`" + Data.fldRFIDPortNo + "`" + Data.fldCurrentStatus + "`" + Data.fldLastCommand + "`````"; string[] _strOutput = ws.AMSWebService.RFIDSetting_SaveRecord(_strInput, Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } else { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult CheckCode(AssetReceivedModel Data) { try { MyWSContext ws = new MyWSContext(); string _strInput = Data.fldCode; string[] _strOutput = ws.AMSWebService.ReceivingfromSupplier_CheckCode(false, "", _strInput, Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } else { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult Save(UserAccess Data, string _strModuleButton, bool _isEdit) { try { MyWSContext ws = new MyWSContext(); string _strInput = "`" + Data.fldAccessName + "`" + _strModuleButton; string[] _strOutput = ws.AMSWebService.SettingUserAccess_SaveRecord(_isEdit, "", _strInput, Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } else { ModelState.AddModelError("", _strOutput[1]); return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult Delete(RfidSettingModel Data) { try { MyWSContext ws = new MyWSContext(); string[] _strOutput = ws.AMSWebService.DeleteRecord_RecordID(Data.CurrentID, "TYPES", Session["CustomerID"].ToString()).Split('`'); if (_strOutput[0] == "true") { ViewBag.SystemError = ""; ViewBag.SystemSuccess = _strOutput[1]; return(Json(new { Success = true, msg = ViewBag.SystemSuccess }, JsonRequestBehavior.AllowGet)); } else { ViewBag.SystemError = _strOutput[1]; ViewBag.SystemSuccess = ""; return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { Success = false, msg = "" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult List() { Session["CurrentMenu"] = "Setting"; RfidSettingModel Data = new RfidSettingModel(); if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0) { Data.fldPageLimit = 10; } else { Data.fldPageLimit = int.Parse(Session["fldPageLimit"].ToString()); } Data.fldSearchText = ViewBag.Search; try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "`" + (Data.fldSearchText == null ? "" : Data.fldSearchText) + "`"; using (DataTable _DTRecord = ws.AMSWebService.LoadRFIDSetting_Where(_strWhereStatement, Session["CustomerID"].ToString())) { ViewBag.SystemError = ""; ViewBag.SystemSuccess = ""; ViewBag.RecordCount = _DTRecord.Rows.Count; DataTable dt = new DataTable(); try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } if (Session["fldPageNo"] == null || int.Parse(Session["fldPageNo"].ToString()) == 0 || ViewBag.Pagging == 1) { Session["fldPageNo"] = 1; Data.fldPageNo = 1; } else { Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString()); } _DTRecord.DefaultView.Sort = "fldPCSerialNo"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["RecordData"] = dt; ViewBag.PageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } Data.cbPageLimit = GetDropDownPageLimit(); } catch { } return(View(Data)); }
public ActionResult List() { if (!__isLogIn()) { return(RedirectToAction("Login", "Account")); } try { if (bool.Parse(Session["UserAccess"].ToString()) == false) { return(RedirectToAction("Index", "Home")); } } catch { return(RedirectToAction("Index", "Home")); } Session["CurrentMenu"] = "Settings"; UserAccess Data = new UserAccess(); if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0) { Data.fldPageLimit = 10; } else { Data.fldPageLimit = int.Parse(Session["fldPageLimit"].ToString()); } ViewBag.Search = Session["fldSearchText"]; Data.fldSearchText = ViewBag.Search; try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "`" + (Data.fldSearchText == null ? "" : Data.fldSearchText) + "`"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingUserAccess_Where(_strWhereStatement, Session["CustomerID"].ToString())) { ViewBag.RecordCount = _DTRecord.Rows.Count; DataTable dt = new DataTable(); try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } if (Session["fldPageNo"] == null || int.Parse(Session["fldPageNo"].ToString()) == 0 || ViewBag.Pagging == 1) { Session["fldPageNo"] = 1; Data.fldPageNo = 1; } else { Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString()); } _DTRecord.DefaultView.Sort = "fldAccessName desc"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["RecordData"] = dt; ViewBag.PageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } Data.cbPageLimit = GetDropDownPageLimit(); } catch { } return(View(Data)); }
public ActionResult List(RfidSettingModel Data) { try { if (Session["_intCurrentID"] == null) { return(RedirectToAction("Login", "Account")); } if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0) { Data.fldPageLimit = 10; } MyWSContext ws = new MyWSContext(); string _strWhereStatement = "`" + (Data.fldSearchText == null?"":Data.fldSearchText); using (DataTable _DTRecord = ws.AMSWebService.LoadRFIDSetting_Where(_strWhereStatement, Session["CustomerID"].ToString())) { Session["fldSearchText"] = Data.fldSearchText; Session["fldPageLimit"] = Data.fldPageLimit; ViewBag.RecordCount = _DTRecord.Rows.Count; DataTable dt = new DataTable(); try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } if (Data.fldPageCommand != null) { if (Session["fldPageNo"] == null) { Session["fldPageNo"] = 1; } else { Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString()); } if (Data.fldPageCommand.Contains(">>")) { if (ViewBag.Pagging > Data.fldPageNo) { Data.fldPageNo++; } } else { Data.fldPageNo--; } if (Data.fldPageNo < 1) { Data.fldPageNo = 1; } } else { Data.fldPageNo = 1; } _DTRecord.DefaultView.Sort = "fldPCSerialNo"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["RecordData"] = dt; ViewBag.PageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } Data.cbPageLimit = GetDropDownPageLimit(); } catch { } return(View("List", Data)); }
public ActionResult Login(UserAccount Data) { MyWSContext ws = new MyWSContext(); string _strOutput = ""; using (DataTable _tblusers = ws.AMSWebService.ValidateUser(Data.UserName, Data.Password, Data.AccountID, out _strOutput)) { if (_tblusers == null) { if (_strOutput != "") { ViewBag.SystemError = _strOutput; ModelState.AddModelError("", _strOutput); } else { ViewBag.SystemError = "(Invalid Account ID) Please contact your system administrator"; ModelState.AddModelError("", "(Invalid Account ID) Please contact your system administrator"); } } else { foreach (DataRow DR in _tblusers.Rows) { //TimeSpan timespan = (DateTime.Parse(DR[1].ToString()).AddMonths(int.Parse(DR[16].ToString())) - DateTime.Now); Response.Cookies["AMSCookie"]["_intCurrentID"] = DR[0].ToString(); Response.Cookies["AMSCookie"]["_strCurrentUserCode"] = DR[2].ToString(); Response.Cookies["AMSCookie"]["_strCurrentFullName"] = DR[3].ToString().ToUpper(); Response.Cookies["AMSCookie"]["_intCurrentUserName"] = DR[14].ToString();//ws.Decrypt(DR[14].ToString(), true); Response.Cookies["AMSCookie"]["_strAccessName"] = DR[13].ToString().ToUpper(); Response.Cookies["AMSCookieCustomerID"]["CustomerID"] = Data.AccountID; Response.Cookies["AMSCookie"].Expires = DateTime.Now.AddDays(30); Response.Cookies["AMSCookieCustomerID"].Expires = DateTime.Now.AddDays(30); //Response.Cookies["CustomerID"].Expires = DateTime.Now.AddDays(30); Session["_intCurrentID"] = DR[0].ToString(); Session["_strCurrentUserCode"] = DR[2].ToString(); Session["_strCurrentFullName"] = DR[3].ToString().ToUpper(); Session["_intCurrentUserName"] = DR[14].ToString();//ws.Decrypt(DR[14].ToString(), true); Session["_strAccessName"] = DR[13].ToString(); Session["CustomerID"] = Data.AccountID; try { string _strCurrentIDCode = String.Format("{0:MM/dd/yyyy hh:mm:ss}", DateTime.Now); Session["_strCurrentIDCode"] = _strCurrentIDCode; Response.Cookies["AMSCookie"]["CurrentIDCode"] = Session["_strCurrentIDCode"].ToString(); bool _isSet = ws.AMSWebService.SetUserStatus(Data.AccountID, _strCurrentIDCode, Session["_intCurrentID"].ToString(), Data.AccountID); } catch { } } if (_strOutput != "") { ViewBag.SystemError = _strOutput; ModelState.AddModelError("", _strOutput); if (_strOutput.Contains("You only have")) { Session["ProfilePic"] = GetProfilePicServerPath(Session["_strCurrentUserCode"].ToString()); Session["SystemMessage"] = _strOutput; return(RedirectToAction("Index", "Home")); } else { Session["_intCurrentID"] = null; Session["SystemMessage"] = null; } } else { Session["ProfilePic"] = GetProfilePicServerPath(Session["_strCurrentUserCode"].ToString()); return(RedirectToAction("Index", "Home")); } } return(View()); } }
public ActionResult List(AssetReceivedModel Data) { try { if (Session["_intCurrentID"] == null) { return(RedirectToAction("Login", "Account")); } if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0) { Data.fldPageLimit = 10; } MyWSContext ws = new MyWSContext(); string _strFromDate = Data.fldFromDate == null ? "" : String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Parse(Data.fldFromDate.ToString())); string _strToDate = Data.fldToDate == null ? "" : String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Parse(Data.fldToDate.ToString())); string _strWhereStatement = "`" + _strFromDate + "`" + _strToDate + "`" + (Data.fldSearchText == null ? "" : Data.fldSearchText) + "`" + Data.fldSupplierCode + "`" + Data.fldWarehouseCode; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingReceivingfromSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString())) { Session["_strFromDate"] = _strFromDate; Session["_strToDate"] = _strToDate; Session["fldSearchText"] = Data.fldSearchText; Session["fldPageLimit"] = Data.fldPageLimit; Session["fldSupplierCode"] = Data.fldSupplierCode; Session["fldWarehouseCode"] = Data.fldWarehouseCode; ViewBag.RecordCount = _DTRecord.Rows.Count; DataTable dt = new DataTable(); try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } if (Data.fldPageCommand != null) { if (Session["fldPageNo"] == null) { Session["fldPageNo"] = 1; } else { Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString()); } if (Data.fldPageCommand.Contains(">>")) { if (ViewBag.Pagging > Data.fldPageNo) { Data.fldPageNo++; } } else { Data.fldPageNo--; } if (Data.fldPageNo < 1) { Data.fldPageNo = 1; } } else { Data.fldPageNo = 1; } _DTRecord.DefaultView.Sort = "fldDRDate desc"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["RecordData"] = dt; ViewBag.PageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } Data.cbPageLimit = GetDropDownPageLimit(); Data.cbSupplier = GetDropDownItem(true, "Supplier"); Data.cbWarehouse = GetDropDownItem(true, "Warehouse"); if (Session["fldSupplierCode"] != null) { if (Session["fldSupplierCode"].ToString() != "") { Data.fldSupplierCode = Session["fldSupplierCode"].ToString(); } } if (Session["fldWarehouseCode"] != null) { if (Session["fldWarehouseCode"].ToString() != "") { Data.fldWarehouseCode = Session["fldWarehouseCode"].ToString(); } } } catch { } return(View("List", Data)); }
public List <DropDown> GetDropDownItem(bool _isWithAll, string _strName) { List <DropDown> items = new List <DropDown>(); if (_strName == "Currency") { try { if (_isWithAll) { items.Add(new DropDown { Name = "All (Currencies)", Id = "-1" }); } items.Add(new DropDown { Name = "PHP Philippines Piso", Id = "PHP" }); items.Add(new DropDown { Name = "USD United States Dollar", Id = "USD" }); items.Add(new DropDown { Name = "SGD Singapore Dollar", Id = "SGD" }); items.Add(new DropDown { Name = "MYR Malaysia Ringgit", Id = "MYR" }); } catch { } } if (_strName == "Employees") { try { MyWSContext ws = new MyWSContext(); using (DataTable _DTRecord = ws.AMSWebService.LoadEmployeesTransSelection_Where("ReceivingfromSupplier", Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Employees)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[1].ToString(), Id = DR[0].ToString() }); } } } catch { } } if (_strName == "Supplier") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1``"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Supplier)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Warehouse") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingWarehouse_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Warehouse)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Classification") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingClassification_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Classification)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Category") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingCategory_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Category)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Type") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingType_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Type)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Brand") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingBrand_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Brand)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Model") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingModel_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (Model)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "UOM") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingUOM_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (UOM)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } if (_strName == "Method") { try { items.Add(new DropDown { Name = "Straight", Id = "Straight" }); } catch { } } if (_strName == "NATURES") { try { MyWSContext ws = new MyWSContext(); using (DataTable _DTRecord = ws.AMSWebService.LoadSettingSupplierNature_Where(Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "All (NATURE)", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[0].ToString(), Id = DR[0].ToString() }); } } } catch { } } if (_strName == "CostCenter") { try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "````1"; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingCostCenter_Where(_strWhereStatement, Session["CustomerID"].ToString())) { if (_isWithAll) { items.Add(new DropDown { Name = "", Id = "-1" }); } foreach (DataRow DR in _DTRecord.Rows) { items.Add(new DropDown { Name = DR[3].ToString(), Id = DR[2].ToString() }); } } } catch { } } return(items); }
public ActionResult List() { if (!__isLogIn()) { return(RedirectToAction("Login", "Account")); } try { if (bool.Parse(Session["AssetReceived"].ToString()) == false) { return(RedirectToAction("Index", "Home")); } } catch { return(RedirectToAction("Index", "Home")); } Session["CurrentMenu"] = "InventoryManagement"; AssetReceivedModel Data = new AssetReceivedModel(); if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0) { Data.fldPageLimit = 10; } else { Data.fldPageLimit = int.Parse(Session["fldPageLimit"].ToString()); } ViewBag.From = Session["_strFromDate"]; ViewBag.To = Session["_strToDate"]; ViewBag.Search = Session["fldSearchText"]; ViewBag.fldSupplierCode = Session["fldSupplierCode"]; ViewBag.fldWarehouseCode = Session["fldWarehouseCode"]; Data.fldFromDate = ViewBag.From == "" | ViewBag.From == null? null:String.Format("{0:yyyy-MM-dd}", DateTime.Parse(ViewBag.From)); Data.fldToDate = ViewBag.To == "" | ViewBag.To == null ? null : String.Format("{0:yyyy-MM-dd}", DateTime.Parse(ViewBag.To)); Data.fldSearchText = ViewBag.Search; Data.fldSupplierCode = ViewBag.fldSupplierCode; Data.fldWarehouseCode = ViewBag.fldWarehouseCode; try { MyWSContext ws = new MyWSContext(); string _strWhereStatement = "`" + ViewBag.From + "`" + ViewBag.To + "`" + (Data.fldSearchText == null ? "" : Data.fldSearchText) + "`" + Data.fldSupplierCode + "`" + Data.fldWarehouseCode; using (DataTable _DTRecord = ws.AMSWebService.LoadSettingReceivingfromSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString())) { ViewBag.SystemError = ""; ViewBag.SystemSuccess = ""; ViewBag.RecordCount = _DTRecord.Rows.Count; DataTable dt = new DataTable(); try { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit; if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0) { ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1; } if (Session["fldPageNo"] == null || int.Parse(Session["fldPageNo"].ToString()) == 0 || ViewBag.Pagging == 1) { Session["fldPageNo"] = 1; Data.fldPageNo = 1; } else { Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString()); } _DTRecord.DefaultView.Sort = "fldDRDate desc"; dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable(); } catch { } ViewData["RecordData"] = dt; ViewBag.PageNo = Data.fldPageNo; Session["fldPageNo"] = Data.fldPageNo; } Data.cbPageLimit = GetDropDownPageLimit(); Data.cbSupplier = GetDropDownItem(true, "Supplier"); Data.cbWarehouse = GetDropDownItem(true, "Warehouse"); if (Session["fldSupplierCode"] != null) { if (Session["fldSupplierCode"].ToString() != "") { Data.fldSupplierCode = Session["fldSupplierCode"].ToString(); } } if (Session["fldWarehouseCode"] != null) { if (Session["fldWarehouseCode"].ToString() != "") { Data.fldWarehouseCode = Session["fldWarehouseCode"].ToString(); } } } catch { } return(View(Data)); }