/// <summary> /// 菜单列表分页显示 /// </summary> /// <param name="input"></param> /// <returns></returns> public ActionResult FindWithPager(MenuInput input) { //获取用户的角色信息 var userId = GetLoginInfo().User.Id; //请求的参数 var postParas = new Dictionary <string, string>() { { "userId", userId.ToString() } }; postParas.Add("PageIndex", input.PageIndex.ToString()); postParas.Add("PageSize", input.PageSize.ToString()); if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var result = RestSharpHelper.PostWithApplicationJson <ResponseResult <List <T_MENU> > >(GetCurrentUrl(this), postParas, GetCertificationFilePath(), GetCertificationPwd()); var resultm = new { total = result.TotalNums, rows = result.Entity }; return(Json(resultm, JsonRequestBehavior.AllowGet)); }
public Produk GetByKode(string kodeProduk) { Produk obj = null; try { var api = string.Format("get_by_kode?kodeProduk={0}", kodeProduk); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Produk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { obj = response.Results[0]; } } catch (Exception ex) { _log.Error("Error:", ex); } return(obj); }
public IList <ItemPembayaranHutangProduk> GetHistoriPembayaran(string beliId) { IList <ItemPembayaranHutangProduk> oList = new List <ItemPembayaranHutangProduk>(); try { var api = string.Format("get_histori_pembayaran?beliId={0}", beliId); var response = RestSharpHelper <OpenRetailWebApiGetResponse <ItemPembayaranHutangProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <Produk> GetInfoMinimalStok() { IList <Produk> oList = new List <Produk>(); try { var api = "get_info_minimal_stok"; var response = RestSharpHelper <OpenRetailWebApiGetResponse <Produk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <Customer> GetAll(bool isReseller) { IList <Customer> oList = new List <Customer>(); try { var api = string.Format("get_by_jenis_customer?isReseller={0}", isReseller); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Customer> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <Produk> GetAll(string sortBy) { IList <Produk> oList = new List <Produk>(); try { var api = string.Format("get_all_sort_by?sortBy={0}", sortBy); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Produk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public string GetLastNota() { var result = string.Empty; try { var api = "get_last_nota"; var response = RestSharpHelper <OpenRetailWebApiGetResponse <string> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { result = response.Results[0]; } } catch (Exception ex) { _log.Error("Error:", ex); } return(result); }
public IList <PembayaranHutangProduk> GetByName(string name) { IList <PembayaranHutangProduk> oList = new List <PembayaranHutangProduk>(); try { var api = string.Format("get_by_name?name={0}", name); var response = RestSharpHelper <OpenRetailWebApiGetResponse <PembayaranHutangProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <PembayaranHutangProduk> GetByTanggal(DateTime tanggalMulai, DateTime tanggalSelesai) { IList <PembayaranHutangProduk> oList = new List <PembayaranHutangProduk>(); try { var api = string.Format("get_by_tanggal?tanggalMulai={0}&tanggalSelesai={1}", tanggalMulai, tanggalSelesai); var response = RestSharpHelper <OpenRetailWebApiGetResponse <PembayaranHutangProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public Kasbon GetByID(string id) { Kasbon obj = null; try { var api = string.Format("get_by_id?id={0}", id); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Kasbon> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { obj = response.Results[0]; } } catch (Exception ex) { _log.Error("Error:", ex); } return(obj); }
public IList <Kasbon> GetByKaryawanId(string karyawanId) { IList <Kasbon> oList = new List <Kasbon>(); try { var api = string.Format("get_by_karyawan_id?karyawan_id={0}", karyawanId); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Kasbon> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <BeliProduk> GetNotaKreditByNota(string id, string nota) { IList <BeliProduk> oList = new List <BeliProduk>(); try { var api = string.Format("get_nota_kredit_supplier_by_nota?id={0}¬a={1}", id, nota); var response = RestSharpHelper <OpenRetailWebApiGetResponse <BeliProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <Kasbon> GetByStatus(bool isLunas) { IList <Kasbon> oList = new List <Kasbon>(); try { var api = string.Format("get_by_status?is_lunas={0}", isLunas); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Kasbon> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public JualProduk GetListItemNotaTerakhir(string penggunaId, string mesinId) { JualProduk obj = null; try { var api = string.Format("get_list_item_nota_terakhir?penggunaId={0}&mesinId={1}", penggunaId, mesinId); var response = RestSharpHelper <OpenRetailWebApiGetResponse <JualProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { obj = response.Results[0]; } } catch (Exception ex) { _log.Error("Error:", ex); } return(obj); }
public IList <ItemJualProduk> GetItemJual(string jualId) { IList <ItemJualProduk> oList = new List <ItemJualProduk>(); try { var api = string.Format("get_item_jual?jualId={0}", jualId); var response = RestSharpHelper <OpenRetailWebApiGetResponse <ItemJualProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <JualProduk> GetNotaKreditByCustomer(string id, bool isLunas) { IList <JualProduk> oList = new List <JualProduk>(); try { var api = string.Format("get_nota_kredit_customer_by_status?id={0}&isLunas={1}", id, isLunas); var response = RestSharpHelper <OpenRetailWebApiGetResponse <JualProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <PengeluaranBiaya> GetAll() { IList <PengeluaranBiaya> oList = new List <PengeluaranBiaya>(); try { var api = "get_all"; var response = RestSharpHelper <OpenRetailWebApiGetResponse <PengeluaranBiaya> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public ItemPembayaranHutangProduk GetByBeliID(string id) { ItemPembayaranHutangProduk obj = null; try { var api = string.Format("get_by_beli_id?id={0}", id); var response = RestSharpHelper <OpenRetailWebApiGetResponse <ItemPembayaranHutangProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { obj = response.Results[0]; } } catch (Exception ex) { _log.Error("Error:", ex); } return(obj); }
public int Update(BeliProduk obj) { var result = 0; try { obj.tanggal = obj.tanggal.ToUtc(); var api = "update"; var response = RestSharpHelper <OpenRetailWebApiPostResponse> .PostRequest(_apiUrl, api, obj); result = Convert.ToInt32(response.Results); if (result > 0) { obj.total_nota = GetTotalNota(obj); // jika terjadi perubahan status nota dari tunai ke kredit if (obj.tanggal_tempo_old.IsNull() && !obj.tanggal_tempo.IsNull()) { obj.total_pelunasan = 0; } else if (obj.tanggal_tempo.IsNull()) // jika penjualan tunai, langsung update ke pembayaran piutang { obj.total_pelunasan = obj.grand_total; } foreach (var item in obj.item_beli.Where(f => f.Produk != null)) { item.entity_state = EntityState.Unchanged; } } } catch (Exception ex) { _log.Error("Error:", ex); } return(result); }
public IList <JualProduk> GetByName(string name, bool isCekKeteranganItemJual, int pageNumber, int pageSize, ref int pagesCount) { IList <JualProduk> oList = new List <JualProduk>(); try { var api = string.Format("get_by_name_with_paging?name={0}&isCekKeteranganItemJual={1}&pageNumber={2}&pageSize={3}", name, isCekKeteranganItemJual, pageNumber, pageSize); var response = RestSharpHelper <OpenRetailWebApiGetResponse <JualProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { pagesCount = response.Status.PagesCount; oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <BeliProduk> GetByTanggal(DateTime tanggalMulai, DateTime tanggalSelesai, int pageNumber, int pageSize, ref int pagesCount) { IList <BeliProduk> oList = new List <BeliProduk>(); try { var api = string.Format("get_by_tanggal_with_paging?tanggalMulai={0}&tanggalSelesai={1}&pageNumber={2}&pageSize={3}", tanggalMulai, tanggalSelesai, pageNumber, pageSize); var response = RestSharpHelper <OpenRetailWebApiGetResponse <BeliProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { pagesCount = response.Status.PagesCount; oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <JualProduk> GetAll(int pageNumber, int pageSize, ref int pagesCount) { IList <JualProduk> oList = new List <JualProduk>(); try { var api = string.Format("get_all_with_paging?pageNumber={0}&pageSize={1}", pageNumber, pageSize); var response = RestSharpHelper <OpenRetailWebApiGetResponse <JualProduk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { pagesCount = response.Status.PagesCount; oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <Produk> GetByGolongan(string golonganId, string sortBy, int pageNumber, int pageSize, ref int pagesCount) { IList <Produk> oList = new List <Produk>(); try { var api = string.Format("get_by_golongan_with_paging?golonganId={0}&sortBy={1}&pageNumber={2}&pageSize={3}", golonganId, sortBy, pageNumber, pageSize); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Produk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { pagesCount = response.Status.PagesCount; oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public IList <Produk> GetByName(string name, string sortBy, int pageNumber, int pageSize, ref int pagesCount, bool isLoadHargaGrosir = true) { IList <Produk> oList = new List <Produk>(); try { var api = string.Format("get_by_name_with_paging?name={0}&sortBy={1}&pageNumber={2}&pageSize={3}&isLoadHargaGrosir={4}", name, sortBy, pageNumber, pageSize, isLoadHargaGrosir); var response = RestSharpHelper <OpenRetailWebApiGetResponse <Produk> > .GetRequest(_apiUrl, api).Data; if (response.Results.Count > 0) { pagesCount = response.Status.PagesCount; oList = response.Results; } } catch (Exception ex) { _log.Error("Error:", ex); } return(oList); }
public ActionResult Reject(long verificationId, RoleType roleType) { var auditUser = GetLoginInfo(); if (auditUser == null) { return(null); } long auditUserId = auditUser.User.Id; var postParas = new Dictionary <string, string>() { { "verificationId", verificationId.ToString() }, { "roleType", roleType.ToString() }, { "UserId", auditUserId.ToString() } }; //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var responseResult = RestSharpHelper.PostWithStandard <ResponseResult <RoleStateViewModel> >(GetCurrentUrl(this), postParas, GetCertificationFilePath(), GetCertificationPwd()); if (responseResult != null && responseResult.IsSuccess) { TempData["Message"] = responseResult.Message; return(RedirectToAction("List")); } else { TempData["Error"] = responseResult.Message; return(RedirectToAction("Detail", new { responseResult.Entity.verificationId, roleId = (RoleType)responseResult.Entity.roleId })); } }
public IRestResponse executeRequest(RestClient restClient, RestRequest request) { IRestResponse response = null; var stopWatch = new Stopwatch(); try { stopWatch.Start(); response = restClient.Execute(request); stopWatch.Stop(); } catch (Exception e) { Console.WriteLine("Exception : \n" + e.Message); } finally { // Logging raw request and response RestSharpHelper restSharpHelper = new RestSharpHelper(); restSharpHelper.LogRequest(restClient, request, response, stopWatch.ElapsedMilliseconds); } return(response); }
public void HttpPostTest() { string s; bool b = false; //测试用例1 s = RestSharpHelper.HttpPost((string)null, (string)null, (Dictionary <string, object>)null, out b, (Dictionary <string, object>)null, (Dictionary <string, string>)null, (object)null); Assert.AreEqual <bool>(false, b); //测试用例2 s = RestSharpHelper.HttpPost("", (string)null, (Dictionary <string, object>)null, out b, (Dictionary <string, object>)null, (Dictionary <string, string>)null, (object)null); Assert.AreEqual <bool>(false, b); //测试用例3 s = RestSharpHelper.HttpPost(":xn--%\0\0", (string)null, (Dictionary <string, object>)null, out b, (Dictionary <string, object>)null, (Dictionary <string, string>)null, (object)null); Assert.AreEqual <bool>(false, b); //测试用例4 s = RestSharpHelper.HttpPost("/\\/", (string)null, (Dictionary <string, object>)null, out b, (Dictionary <string, object>)null, (Dictionary <string, string>)null, (object)null); Assert.AreEqual <bool>(false, b); //测试用例5 s = RestSharpHelper.HttpPost("\0\0:", (string)null, (Dictionary <string, object>)null, out b, (Dictionary <string, object>)null, (Dictionary <string, string>)null, (object)null); Assert.AreEqual <bool>(false, b); //测试用例6 s = RestSharpHelper.HttpPost("x0: ", (string)null, (Dictionary <string, object>)null, out b, (Dictionary <string, object>)null, (Dictionary <string, string>)null, (object)null); Assert.AreEqual <bool>(true, b); }
public ActionResult ApproveForFarmer(long verificationId, byte star = 1) { var auditUser = GetLoginInfo(); if (auditUser == null) { return(null); } long auditUserId = auditUser.User.Id; var postParas = new Dictionary <string, string>() { { "verificationId", verificationId.ToString() }, { "star", star.ToString() }, { "UserId", auditUserId.ToString() } }; if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var responseResult = RestSharpHelper.PostWithStandard <ResponseResult <RoleStateViewModel> >(GetPostUrl("ApproveForFarmer"), postParas, GetCertificationFilePath(), GetCertificationPwd()); if (responseResult == null) { return(RedirectToAction("List")); } if (!responseResult.IsSuccess) { TempData["Error"] = responseResult.Message; return(RedirectToAction("Detail", new { verificationId, roleId = RoleType.Farmer })); } else { TempData["Message"] = responseResult.Message; } return(RedirectToAction("List")); }
public int Save(BeliProduk obj) { var result = 0; try { obj.tanggal = obj.tanggal.ToUtc(); var api = "save"; var response = RestSharpHelper <OpenRetailWebApiPostResponse> .PostRequest(_apiUrl, api, obj); result = Convert.ToInt32(response.Results); if (result > 0) { obj.total_nota = GetTotalNota(obj); // jika pembelian tunai, langsung insert ke pembayaran hutang if (obj.tanggal_tempo.IsNull()) { obj.total_pelunasan = obj.grand_total; } foreach (var item in obj.item_beli.Where(f => f.Produk != null)) { item.entity_state = EntityState.Unchanged; } } } catch (Exception ex) { _log.Error("Error:", ex); } return(result); }
public async Task <string> GetPage1(string url) { IHttpClientHelper client1 = new RestSharpHelper(); var res = client1.GetHttp(url, true, user_agent); if (res.Success) { return(res.Content); } else { LogDTO log = new LogDTO() { DateTime = DateTime.Now, Description = res.ExeptionErrorMessage, ProjectId = (int)ProjectNames.HttpHelper, Url = url, MethodName = "Digikala - GetPage", Title = "Get HTML Error" }; Logger.AddLog(log); return(string.Empty); } }