public void UpdateUnitPaymentOrderPosition(List <string> unitPaymentOrders, ExpeditionPosition position, string username)
        {
            //foreach(var item in unitPaymentOrders)
            //{
            //    var upo = dbContext.UnitPaymentOrders.FirstOrDefault(x => x.UPONo == item);
            //    if(upo != null)
            //    {

            //        upo.Position = (int) position;
            //        EntityExtension.FlagForUpdate(upo, username, "Facade");
            //    }
            //}

            //dbContext.SaveChanges();
            string unitPaymentOrderUri = "unit-payment-orders/update/position";

            var data = new
            {
                position          = position,
                unitPaymentOrders = unitPaymentOrders
            };

            IHttpClientService httpClient = (IHttpClientService)this.serviceProvider.GetService(typeof(IHttpClientService));
            var response = httpClient.PutAsync($"{APIEndpoint.Purchasing}{unitPaymentOrderUri}", new StringContent(JsonConvert.SerializeObject(data).ToString(), Encoding.UTF8, General.JsonMediaType)).Result;

            response.EnsureSuccessStatusCode();
        }
Ejemplo n.º 2
0
        string GetFormattedPosition(ExpeditionPosition position)
        {
            string name;

            return(name = position == ExpeditionPosition.PURCHASING_DIVISION ? "Bag. Pembelian": position == ExpeditionPosition.SEND_TO_VERIFICATION_DIVISION ? "Di Kirim ke Bag. Verifikasi":
                          position == ExpeditionPosition.VERIFICATION_DIVISION ? "Bag. Verifikasi": position == ExpeditionPosition.SEND_TO_CASHIER_DIVISION ? "Di Kirim ke Bag. Keuangan":
                          position == ExpeditionPosition.SEND_TO_ACCOUNTING_DIVISION ? "Di Kirim ke Bag. Accounting":position == ExpeditionPosition.SEND_TO_PURCHASING_DIVISION ? "Di Kirim ke Bag. Pembelian" :
                          position == ExpeditionPosition.CASHIER_DIVISION ? "Bag. Kasir": position == ExpeditionPosition.FINANCE_DIVISION ? "Bag. Keuangan"
                          : "-");
        }
        public static string ToDescriptionString(this ExpeditionPosition me)
        {
            Type enumType = me.GetType();

            MemberInfo[] memberInfo = enumType.GetMember(me.ToString());
            if (memberInfo != null && memberInfo.Length > 0)
            {
                var _attr = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
                if (_attr != null && _attr.Count() > 0)
                {
                    return(((DescriptionAttribute)_attr.ElementAt(0)).Description);
                }
            }
            return(me.ToString());
        }
        public void UpdateUnitPaymentOrderPosition(List <string> unitPaymentOrders, ExpeditionPosition position)
        {
            string unitPaymentOrderUri = "unit-payment-orders/update/position";

            var data = new
            {
                position          = position,
                unitPaymentOrders = unitPaymentOrders
            };

            IHttpClientService httpClient = (IHttpClientService)this.serviceProvider.GetService(typeof(IHttpClientService));
            var response = httpClient.PutAsync($"{APIEndpoint.Purchasing}{unitPaymentOrderUri}", new StringContent(JsonConvert.SerializeObject(data).ToString(), Encoding.UTF8, General.JsonMediaType)).Result;

            response.EnsureSuccessStatusCode();
        }
        private void UpdateDispositionPosition(List <string> dispositions, ExpeditionPosition position)
        {
            string dispositionUri = "purchasing-dispositions/update/position";

            var data = new
            {
                Position = position,
                PurchasingDispositionNoes = dispositions
            };

            IHttpClientService httpClient = (IHttpClientService)this.ServiceProvider.GetService(typeof(IHttpClientService));
            var response = httpClient.PutAsync($"{APIEndpoint.Purchasing}{dispositionUri}", new StringContent(JsonConvert.SerializeObject(data).ToString(), Encoding.UTF8, General.JsonMediaType)).Result;

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception(string.Format("{0}, {1}, {2}", response.StatusCode, response.Content, APIEndpoint.Purchasing));
            }
        }