public ActionResult ExportPDF(string searchString) { var list = new List <RETRIVAL_INVALID>(); string footer = "--footer-right \"Date: [date] [time]\" " + "--footer-center \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\""; var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); if (!String.IsNullOrEmpty(searchString)) { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/FindRetrivalInvalid?searchString={0}", searchString)).Result; list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } else { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/GetAllRetrivalInvalid")).Result; list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } return(new Rotativa.PartialViewAsPdf("RetrivalError", list) { //RetrivalInvalid FileName = "RetrivalInvalid.pdf", CustomSwitches = footer }); }
public ActionResult ViewMessage(string id) { var user = GetUserName(); MESSAGE message = new MESSAGE(); HttpClient client = new AccessAPI().Access(); StringContent content = new StringContent(""); HttpResponseMessage response = client.GetAsync(string.Format("api/MESSAGE/GetMESSAGE/{0}", id)).Result; if (response.IsSuccessStatusCode) { message = response.Content.ReadAsAsync <MESSAGE>().Result; if (message.Receiver != "ALL" && message.Receiver != "all" && user.UserName != message.Sender) { HttpResponseMessage response1 = client.PostAsync(string.Format("api/MESSAGE/UpdateIsRead?ID={0}", id), content).Result; bool check = response1.IsSuccessStatusCode; } } HttpResponseMessage response2 = client.GetAsync(string.Format("api/MESSAGETYPE/CountUnreadMessage?MaCode={0}&UserType={1}", user.UserName, user.UserType)).Result; if (response2.IsSuccessStatusCode) { int number = response2.Content.ReadAsAsync <int>().Result; Session.Add(CommonConstants.NUMBER_UNREAD_MESSAGE, number); } return(View(message)); }
public ActionResult Login(LoginModel model) { if (model.UserName == null || model.Password == null) { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu còn trống. Vui lòng nhập lại !!!"); return(View("Index")); //khong nhat thiet phai co model } List <USER_INFORMATION> list = new List <USER_INFORMATION>(); HttpClient client = new AccessAPI().Access(); StringContent content = new StringContent(""); HttpResponseMessage response = client.PostAsync(string.Format("api/USER_INFORMATION/Search?username={0}&password={1}", model.UserName, Encryptor.MD5Hash(model.Password)), content).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <USER_INFORMATION> >().Result; } if (list.Count == 1) { var userSession = new USER_INFORMATION(); userSession = list[0]; Session.Add(CommonConstants.USER_SESSION, userSession); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu không chính xác. Vui lòng xem lại !!!"); return(View("Index")); //khong nhat thiet phai co model } }
// GET: RetrivalInvalid public ActionResult Index(string searchString, int page = 1, int size = 10) { List <RETRIVAL_INVALID> list = new List <RETRIVAL_INVALID>(); HttpClient client = new AccessAPI().Access(); if (String.IsNullOrEmpty(searchString)) { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/GetAllRetrivalInvalid")).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } var listRetrival = list.ToPagedList(page, size); return(View(listRetrival)); } else { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/FindRetrivalInvalid?searchString={0}", searchString)).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } @ViewBag.searchString = searchString; var listRetrival = list.ToPagedList(page, size); return(View(listRetrival)); } }
public ActionResult Edit() { var model = Session[CommonConstants.USER_SESSION]; //khai báo 1 session bên common giống như bên Cart var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); var user = (USER_INFORMATION)Session[CommonConstants.USER_SESSION]; var pass = Session[CommonConstants.HASH_PASSWORD]; StringContent content = new StringContent("username="******"&password="******"&grant_type=password"); HttpResponseMessage res = client.PostAsync(string.Format("api/security/token"), content).Result; TokenModel token = res.Content.ReadAsAsync <TokenModel>().Result; client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + token.access_token); HttpResponseMessage response = client.GetAsync(string.Format("api/AGENT/FindAgent?agentCode={0}", temp.UserName)).Result; var agent = new AGENT(); if (response.IsSuccessStatusCode) { agent = response.Content.ReadAsAsync <AGENT>().Result; //return RedirectToAction("Index", "Home"); } return(View(agent)); }
// GET: RetrivalInvalid public ActionResult Index(string searchString, int page = 1, int size = 10) { List <RETRIVAL_INVALID> list = new List <RETRIVAL_INVALID>(); HttpClient client = new AccessAPI().Access(); int totalPage = 0; int maxPage = 4; int totalRetrival = 0; //HttpClient client = new HttpClient(); //client.BaseAddress = new Uri("http://localhost:21212/"); HttpResponseMessage response1 = client.GetAsync(string.Format("api/RETRIVAL_INVALID/CountRetrivalInvalid")).Result; if (response1.IsSuccessStatusCode) { totalRetrival = response1.Content.ReadAsAsync <int>().Result; } //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); if (String.IsNullOrEmpty(searchString)) { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/FindAllRetrivalInvalid?pageIndex={0}&pageSize={1}", page - 1, size)).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; totalPage = (int)Math.Ceiling((double)totalRetrival / size); ViewBag.Total = totalRetrival; ViewBag.Page = page; ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Last = totalPage; } return(View(list.ToList())); } else { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/FindRetrivalInvalidElement?searchString={0}&pageIndex={1}&pageSize={2}", searchString, page - 1, size)).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; HttpResponseMessage response2 = client.GetAsync(string.Format("api/RETRIVAL_INVALID/CountRetrivalInvalidElement?searchString={0}", searchString)).Result; if (response2.IsSuccessStatusCode) { totalRetrival = response2.Content.ReadAsAsync <int>().Result; } totalPage = (int)Math.Ceiling((double)totalRetrival / size); ViewBag.Total = totalRetrival; ViewBag.Page = page; ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Last = totalPage; } @ViewBag.searchString = searchString; return(View(list.ToList())); } }
private async void SetCollection() { await AccessAPI.GetAllData();//remember await Collections = new ObservableCollection <FoodPoco>(); foreach (var item in AccessFoodAPI.DataList) { Collections.Add(item); } }
public ActionResult ViewDetail_Retrival() { RETRIVAL list = new RETRIVAL(); HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL/FindRetrival?RetrivalCode={0}", Request.QueryString["Retrivalcode"])).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync<RETRIVAL>().Result; } return View(list); }
public ActionResult ExportCSV(string searchString) { List <RETRIVAL> list = new List <RETRIVAL>(); HttpClient client = new AccessAPI().Access(); var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } else { return(View("Index")); } if (!String.IsNullOrEmpty(searchString)) { HttpResponseMessage response = client.GetAsync(string.Format("api/Retrival/FindRetrivalElement_Print?searchString={0}", searchString)).Result; list = response.Content.ReadAsAsync <List <RETRIVAL> >().Result; } else { HttpResponseMessage response = client.GetAsync(string.Format("api/Retrival/FindAllRetrival_Print")).Result; list = response.Content.ReadAsAsync <List <RETRIVAL> >().Result; } StringWriter sw = new StringWriter(); sw.WriteLine("Retrival Code,Account Number,Merchant Code,Transaction Code,Transaction Date,Report Date,Amount"); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=RETRIVAL.csv"); Response.ContentType = "text/csv"; //var csv = new CsvWriter(sw); foreach (var item in list) { sw.WriteLine(String.Format("{0},{1},{2},{3},{4},{5},{6}", item.RetrivalCode.ToString(), item.AccountNumber.ToString(), item.MerchantCode.ToString(), item.TransactionCode.ToString(), item.TransactionDate.ToString(), item.ReportDate.ToString(), item.Amout.ToString())); } Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); return(View("Index")); }
// Use this for initialization private void Awake() { //Destruir cualquier objeto que sea copia de este. if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public ActionResult ExportExcel(string searchString) { List <RETRIVAL> list = new List <RETRIVAL>(); HttpClient client = new AccessAPI().Access(); var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } else { return(View("Index")); } if (!String.IsNullOrEmpty(searchString)) { HttpResponseMessage response = client.GetAsync(string.Format("api/Retrival/FindRetrivalElement_Print?searchString={0}", searchString)).Result; list = response.Content.ReadAsAsync <List <RETRIVAL> >().Result; } else { HttpResponseMessage response = client.GetAsync(string.Format("api/Retrival/FindAllRetrival_Print")).Result; list = response.Content.ReadAsAsync <List <RETRIVAL> >().Result; } var gv = new GridView(); gv.DataSource = list; gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=RETRIVAL.xls"); Response.ContentType = "appliation/ms-excel"; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(sw); gv.RenderControl(tw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); return(View("Index")); }
public async Task <ActionResult> Login(SigninViewModel model) { //var result = AccessAPI<SigninViewModel, SigninViewModel>.AuthenticateUser(model,"AuthorizeUser").Result; //if (result != null) //{ var apiToken = AccessAPI <SigninViewModel, UserToken> .GetApiToken(model, "token", HttpContentTypes.ConvertToEncodedUrl); await Task.WhenAll(apiToken); await AuthenticateUser(model, apiToken.Result); return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "User", action = "Dashboard" }))); //} ViewBag.LoginError = "Invalid username or password"; return(View(model)); }
private List <RETRIVAL_INVALID> getAllRetrivalInvalid() { var RetrivalInvalid = new List <RETRIVAL_INVALID>(); string domain = ""; string url = domain + "api/RETRIVAL_INVALID/GetAllRetrivalInvalid"; HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { RetrivalInvalid = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } return(RetrivalInvalid); }
private List <Models.MerchantSummaryDailyTiny> getAllSumDaily() { var merchantSummary = new List <Models.MerchantSummaryDailyTiny>(); string domain = ""; string url = domain + "/api/MERCHANT_SUMMARY_DAILY/GetMerchantSummaryDefault"; HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { merchantSummary = response.Content.ReadAsAsync <List <Models.MerchantSummaryDailyTiny> >().Result; } return(merchantSummary); }
// GET: Message public ActionResult Index(int page = 1, int size = 10) { var user = GetUserName(); List <MESSAGE> ListMs = new List <MESSAGE>(); HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(string.Format("api/MESSAGE/GetMessage?MaCode={0}&UserType={1}", user.UserName, user.UserType)).Result; if (response.IsSuccessStatusCode) { ListMs = response.Content.ReadAsAsync <List <MESSAGE> >().Result; //return RedirectToAction("Index", "Home"); } var ListMessage = ListMs.ToPagedList(page, size); return(View(ListMessage)); }
public void PostToAPI() { isExecute = false; if (foodVmObj != null) { Task.Run(() => { AccessAPI.Post(foodVmObj); SetCollection(); MessageBox.Show($"{foodVmObj.Name} Was Posted Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Exclamation); }); } else { MessageBox.Show("Operation Failed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } isExecute = true; }
// GET: Home public ActionResult Index() { //Lay so luong tin nhan chua doc var model = Session[CommonConstants.USER_SESSION]; var user = new USER_INFORMATION(); if (model != null) { user = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(string.Format("api/MESSAGETYPE/CountUnreadMessage?MaCode={0}&UserType={1}", user.UserName, user.UserType)).Result; if (response.IsSuccessStatusCode) { int number = response.Content.ReadAsAsync <int>().Result; Session.Add(CommonConstants.NUMBER_UNREAD_MESSAGE, number); } return(View()); }
public ActionResult CreateMessage(MESSAGE Ms) { if (Ms.Receiver != null && Ms.ReceiverType != null && Ms.Message != null) { var user = GetUserName(); Ms.Sender = user.UserName; Ms.SenderType = user.UserType; Ms.DateSend = DateTime.Now; HttpClient client = new AccessAPI().Access(); StringContent content = new StringContent(""); HttpResponseMessage response = client.PostAsJsonAsync("api/MESSAGE/InsertMassage", Ms).Result; response.EnsureSuccessStatusCode(); TempData["AlertMessage"] = "Tin nhắn đã gửi đi thành công"; TempData["AlertType"] = "alert-success"; return(RedirectToAction("MessageSent", "Message")); } TempData["AlertMessage"] = "Tin nhắn gửi không thành công vui lòng kiểm tra lại"; TempData["AlertType"] = "alert-danger"; return(View()); }
public ActionResult ChangePassword_Action(string currentPassword, string newPassword, string confirmPassword) { if (String.IsNullOrEmpty(currentPassword) || String.IsNullOrEmpty(newPassword) || String.IsNullOrEmpty(confirmPassword) || newPassword != confirmPassword) { TempData["AlertMessage"] = "Vui lòng nhập đầy đủ thông tin!!!"; TempData["AlertType"] = "alert-warning"; return(View("ChangePassword")); //khong nhat thiet phai co model } List <USER_INFORMATION> list = new List <USER_INFORMATION>(); //HttpClient client = new HttpClient(); //client.BaseAddress = new Uri("http://localhost:21212/"); //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var result = (USER_INFORMATION)Session[CommonConstants.USER_SESSION]; HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(string.Format("api/USER_INFORMATION/Change?username={0}&password={1}&newpassword={2}", result.UserName.ToString(), Encryptor.MD5Hash(currentPassword), Encryptor.MD5Hash(newPassword))).Result; if (response.IsSuccessStatusCode) { var check = response.Content.ReadAsAsync <bool>().Result; if (check == true) { TempData["AlertMessage"] = "Đổi mật khẩu thành công !!!"; TempData["AlertType"] = "alert-success"; } else { TempData["AlertMessage"] = "Vui lòng nhập đúng mật khẩu hiện tại!!!"; TempData["AlertType"] = "alert-warning"; } return(View("ChangePassword")); } else { TempData["AlertMessage"] = "Vui lòng nhập đúng mật khẩu hiện tại!!!"; TempData["AlertType"] = "alert-warning"; return(View("Index")); //khong nhat thiet phai co model } }
public ActionResult Edit() { var model = Session[CommonConstants.USER_SESSION]; //khai báo 1 session bên common giống như bên Cart var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(string.Format("api/AGENT/FindAgent?agentCode={0}", temp.UserName)).Result; var agent = new AGENT(); if (response.IsSuccessStatusCode) { agent = response.Content.ReadAsAsync <AGENT>().Result; //return RedirectToAction("Index", "Home"); } return(View(agent)); }
public ActionResult ExportCSV(string searchString) { var list = getAllRetrivalInvalid().ToList(); HttpClient client = new AccessAPI().Access(); var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (!String.IsNullOrEmpty(searchString)) { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/FindRetrivalInvalid?searchString={0}", searchString)).Result; list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } else { HttpResponseMessage response = client.GetAsync(string.Format("api/RETRIVAL_INVALID/GetAllRetrivalInvalid")).Result; list = response.Content.ReadAsAsync <List <RETRIVAL_INVALID> >().Result; } StringWriter sw = new StringWriter(); sw.WriteLine("Retrival Code,Account Number,Merchant Code,Transaction Code,Tracsaction Date,Report Date,Amount, Error Message"); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=Retrival_Invalid.csv"); Response.ContentType = "text/csv"; var csv = new CsvWriter(sw); foreach (var item in list) { csv.WriteRecord(item); } Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); return(View("Index")); }
public ActionResult ViewDetailDay(string MerchantCode) { //Tâm code var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } else { return(View()); } List <MerchantSummaryDailyTiny> list = new List <MerchantSummaryDailyTiny>(); HttpClient client = new AccessAPI().Access(); HttpResponseMessage response; if (temp.UserType == "A") { response = client.GetAsync(string.Format("api/MERCHANT_SUMMARY_DAILY/GetMerchantSummaryForAgentDefaultMerchantCode?AgentCode={0}&&MerchantCode={1}&&ReportDate={2}", temp.UserName, Request.QueryString["MerchantCode"], Request.QueryString["ReportDate"])).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <Models.MerchantSummaryDailyTiny> >().Result; } } if (temp.UserType == "M") { response = client.GetAsync(string.Format("api/MERCHANT_SUMMARY_DAILY/GetMerchantSummaryForMerchantCode?MerchantCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <Models.MerchantSummaryDailyTiny> >().Result; } } return(View(list)); }
public ActionResult FindTransactionDetailInvalidElement(string search, int page = 1, int size = 10) { List <Models.TransInvalidTiny> listTransInvalid = new List <Models.TransInvalidTiny>(); var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); if (temp.UserType == "T") { if (search == "") { return(RedirectToAction("Index")); } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement?searchString={0}", search)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @TempData["search"] = search; @ViewBag.search = search; } var list = listTransInvalid.ToPagedList(page, size); return(View("Index", list)); } else { if (temp.UserType == "A") { if (search == "") { return(RedirectToAction("Index")); } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Agent?searchString={0}&agentCode={1}", search, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @TempData["search"] = search; @ViewBag.agentCode = temp.UserName; } var list = listTransInvalid.ToPagedList(page, size); return(View("Index", list)); } else { if (search == "") { return(RedirectToAction("Index")); } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Merchant?searchString={0}&merchantCode={1}", search, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @TempData["search"] = search; @ViewBag.search = search; @ViewBag.agentCode = temp.UserName; } var list = listTransInvalid.ToPagedList(page, size); return(View("Index", list)); } } }
public ActionResult ExportToExcel(string searchString, int page = 1, int size = 10) { List <Models.TransInvalidTiny> listTransInvalid = new List <Models.TransInvalidTiny>(); var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); if (temp.UserType == "T") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindAllTransaction_Detail_Invalid")).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement?searchString={0}", searchString)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } else { if (temp.UserType == "A") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Agent?AgentCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Agent?searchString={0}&agentCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } // @ViewBag.search = search; } else { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Merchant?MerchantCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Merchant?searchString={0}&merchantCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } //@ViewBag.search = search; } } var gv = new GridView(); gv.DataSource = listTransInvalid; gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename= Transaction_Detail_Invalid.xls"); Response.ContentType = "application/ms-excel"; //Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(sw); gv.RenderControl(tw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); var list = listTransInvalid.ToPagedList(page, size); return(View("Index", list)); }
public UserTasksController(UserManager <ApplicationUser> userManager) { _userManager = userManager; _webAPI = new AccessAPI("http://localhost:50282/api/userTasks"); }
public ActionResult Index(string searchString, int page = 1, int size = 10) { List <Models.TransInvalidTiny> transInvalid = new List <Models.TransInvalidTiny>(); var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); if (temp.UserType == "T") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindAllTransaction_Detail_Invalid")).Result; if (response.IsSuccessStatusCode) { transInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement?searchString={0}", searchString)).Result; if (response.IsSuccessStatusCode) { transInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } else { if (temp.UserType == "A") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Agent?AgentCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { transInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Agent?searchString={0}&agentCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { transInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } // @ViewBag.search = search; } else { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Merchant?MerchantCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { transInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Merchant?searchString={0}&merchantCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { transInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } } var listTransInvalid = transInvalid.ToPagedList(page, size); return(View(listTransInvalid)); }
public async Task <ActionResult> Registration(SignupViewModel model) { var signup = await AccessAPI <SignupViewModel, SignupViewModel> .RegisterUser(model, "anonymous/signup"); return(View(model)); }
private ActionResult viewReport(string UserCode, string defaultView = "Index") { string reportType = "Day"; string reportStartDate = DateTime.Now.ToString("yyyyMM") + "01"; string reportEndDate = DateTime.Now.ToString("yyyyMMdd"); string reportStartMonth = String.Empty; string reportEndMonth = String.Empty; string reportStartYear = String.Empty; string reportEndYear = String.Empty; string reportStartQuarter = String.Empty; string reportEndQuarter = String.Empty; string reportDataDayFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDataGenerality?startDate={0}&endDate={1}"; string reportDateDayForLineFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDateForLineChartGenerality?startDate={0}&endDate={1}"; string reportDataMonthFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDataMonthly?startMonth={0}&startYear={1}&endMonth={2}&endYear={3}"; string reportDateMonthForLineFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDateForLineChartMonthly?startMonth={0}&startYear={1}&endMonth={2}&endYear={3}"; string reportDataQuarterFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDataQuarterly?startQuarter={0}&startYear={1}&endQuarter={2}&endYear={3}"; string reportDateQuarterForLineFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDateForLineChartQuarterly?startQuarter={0}&startYear={1}&endQuarter={2}&endYear={3}"; string reportDataYearFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDataYearly?startYear={0}&endYear={1}"; string reportDateYearForLineFormat = "api/MERCHANT_SUMMARY_DAILY/GetReportDateForLineChartYearly?startYear={0}&endYear={1}"; string reportDataAPI = String.Format(reportDataDayFormat, reportStartDate, reportEndDate); string reportDateForLineAPI = String.Format(reportDateDayForLineFormat, reportStartDate, reportEndDate); string userCode = UserCode; ViewBag.UserCode = userCode; handleNullVal(ViewBag.SummaryReport); if (HttpContext.Request.HttpMethod == "POST") { reportType = Request["reportType"]; reportStartDate = Request["reportStartDate"]; reportEndDate = Request["reportEndDate"]; reportStartMonth = Request["reportStartMonth"]; reportEndMonth = Request["reportEndMonth"]; reportStartYear = Request["reportStartYear"]; reportEndYear = Request["reportEndYear"]; reportStartQuarter = Request["reportStartQuarter"]; reportEndQuarter = Request["reportEndQuarter"]; switch (reportType.ToLower()) { case "day": reportDataAPI = String.Format(reportDataDayFormat, reportStartDate, reportEndDate); reportDateForLineAPI = String.Format(reportDateDayForLineFormat, reportStartDate, reportEndDate); break; case "month": reportDataAPI = String.Format(reportDataMonthFormat, reportStartMonth, reportStartYear, reportEndMonth, reportEndYear); reportDateForLineAPI = String.Format(reportDateMonthForLineFormat, reportStartMonth, reportStartYear, reportEndMonth, reportEndYear); break; case "quarter": reportDataAPI = String.Format(reportDataQuarterFormat, reportStartQuarter, reportStartYear, reportEndQuarter, reportEndYear); reportDateForLineAPI = String.Format(reportDateQuarterForLineFormat, reportStartQuarter, reportStartYear, reportEndQuarter, reportEndYear); break; case "year": reportDataAPI = String.Format(reportDataYearFormat, reportStartYear, reportEndYear); reportDateForLineAPI = String.Format(reportDateYearForLineFormat, reportStartYear, reportEndYear); break; default: break; } } var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } else { return(View()); } if (!String.IsNullOrEmpty(userCode)) { reportDataAPI += ("&code=" + userCode); reportDateForLineAPI += ("&code=" + userCode); } else { if (temp.UserType != "T") { reportDataAPI += ("&code=" + temp.UserName); reportDateForLineAPI += ("&code=" + temp.UserName); } } List <MERCHANT_SUMMARY> list = new List <MERCHANT_SUMMARY>(); HttpClient client = new AccessAPI().Access(); HttpResponseMessage response = client.GetAsync(reportDataAPI).Result; if (response.IsSuccessStatusCode) { list = response.Content.ReadAsAsync <List <MERCHANT_SUMMARY> >().Result; } else { return(View(defaultView)); } response = client.GetAsync(reportDateForLineAPI).Result; List <Models.Statistic> lineChartData = new List <Models.Statistic>(); if (response.IsSuccessStatusCode) { lineChartData = response.Content.ReadAsAsync <List <Models.Statistic> >().Result; } else { return(View(defaultView)); } HttpResponseMessage responseMerchantType = client.GetAsync(string.Format("api/Merchant_Type/SelectAllMerchantType")).Result; HttpResponseMessage responseCity = client.GetAsync(string.Format("api/Region/FindAllRegion")).Result; if (responseCity.IsSuccessStatusCode && responseMerchantType.IsSuccessStatusCode) { List <MERCHANT_TYPE> lookupType = responseMerchantType.Content.ReadAsAsync <List <MERCHANT_TYPE> >().Result; List <REGION> lookupRegion = responseCity.Content.ReadAsAsync <List <REGION> >().Result; var listMerchantType = getListMerchantType(list); var listRegion = getListRegion(list); var cardTypeReport = getCardTypeReport(list); foreach (var item in lookupRegion) { var region = listRegion.Find(x => x.RegionCode == item.RegionCode); if (region == null) { listRegion.Add(new MERCHANT_SUMMARY() { RegionName = item.RegionName, NetAmount = 0, TransactionCount = 0, SaleAmount = 0, SaleCount = 0, ReturnCount = 0 }); } else { region.RegionName = item.RegionName; } } foreach (var item in lookupType) { var type = listMerchantType.Find(x => x.MerchantType == item.MerchantType); if (type == null) { listMerchantType.Add(new MERCHANT_SUMMARY() { MerchantTypeName = item.Description, NetAmount = 0, TransactionCount = 0, SaleAmount = 0, SaleCount = 0, ReturnCount = 0 }); } else { type.MerchantTypeName = item.Description; } } ViewBag.SummaryReport = handleNullVal(getCardTypeReport(list).FirstOrDefault()); ViewBag.Regions = listRegion; ViewBag.MerchantTypes = listMerchantType; ViewBag.listRegion = listRegion; ViewBag.listMerchantType = listMerchantType; ViewBag.listSummary = list; ViewBag.cardTypeReport = cardTypeReport; ViewBag.lineChartData = lineChartData; getDataForCharts(); return(View()); } else { return(View(defaultView)); } }
public ActionResult ExportToPDF(string searchString) { var listTransInvalid = new List <Models.TransInvalidTiny>(); string footer = "--footer-right \"Date: [date] [time]\" " + "--footer-center \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\""; var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); if (temp.UserType == "T") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindAllTransaction_Detail_Invalid")).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement?searchString={0}", searchString)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } else { if (temp.UserType == "A") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Agent?AgentCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Agent?searchString={0}&agentCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } else { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Merchant?MerchantCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Merchant?searchString={0}&merchantCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } } return(new Rotativa.PartialViewAsPdf("TransInvalidPDF", listTransInvalid) { //MerchantSumaryDailyStatistical FileName = "Transaction_Detail_Invalid.pdf", CustomSwitches = footer }); }
public ActionResult ExportToCSV(string searchString, int page = 1, int size = 10) { List <Models.TransInvalidTiny> listTransInvalid = new List <Models.TransInvalidTiny>(); string footer = "--footer-right \"Date: [date] [time]\" " + "--footer-center \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\""; var model = Session[CommonConstants.USER_SESSION]; var temp = new USER_INFORMATION(); if (model != null) { temp = (USER_INFORMATION)model; } HttpClient client = new AccessAPI().Access(); if (temp.UserType == "T") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindAllTransaction_Detail_Invalid")).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement?searchString={0}", searchString)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } else { if (temp.UserType == "A") { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Agent?AgentCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Agent?searchString={0}&agentCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } else { if (searchString == null) { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalid_Merchant?MerchantCode={0}", temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } } else { HttpResponseMessage response = client.GetAsync(string.Format("api/TRANSACTION_DETAIL_INVALID/FindTransInvalidElement_Merchant?searchString={0}&merchantCode={1}", searchString, temp.UserName)).Result; if (response.IsSuccessStatusCode) { listTransInvalid = response.Content.ReadAsAsync <List <Models.TransInvalidTiny> >().Result; } @ViewBag.search = searchString; } } } StringWriter sw = new StringWriter(); sw.WriteLine("TransactionCode,ReportDate,MerchantCode,CardtypeCode ,TransactionAmount ,TransactionDate,AccountNumber,TransactionTypeCode,AgentCode,ErrorMessage"); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=Transaction_Detail_Invalid.csv"); Response.ContentType = "text/csv"; var csv = new CsvWriter(sw); foreach (var item in listTransInvalid) { csv.WriteRecord(item); } Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); var list = listTransInvalid.ToPagedList(page, size); return(View("Index", list)); }