Ejemplo n.º 1
0
        public async Task <IActionResult> GetDue(CustomerDue request)
        {
            try
            {
                acc.REST_KeepLogRequest("", func.JsonSerialize(request));
                dt = new DataTable();
                dt = await acc.CheckExistingRegister(request.IDCard);

                if (dt.Rows.Count == 0)
                {
                    return(BadRequest(func.ResponseWithUnAuthorize("Not Register")));
                }
                PaymentDue data = new PaymentDue();
                data = cus.REST_GetPaymentCurrentDue(request.IDCard, request.BirthDay, request.AgreementNo);
                if (data.DueDate == null)
                {
                    return(NotFound(data));
                }
                return(Ok(data));
            }
            catch (Exception e)
            {
                acc.REST_KeepLogRequest(e.Message, func.JsonSerialize(request));
                return(BadRequest(e.Message));
            }
        }
 private void ResetButton_Click(object sender, EventArgs e)
 {
     PaymentDue.Clear();
     VATAmount.Clear();
     SubTotal.Clear();
     HoursText.ResetText();
     DevelopmentOptions.SelectedIndex = -1;
 }
Ejemplo n.º 3
0
    public void InsertIntoDB()
    {
        foreach (DatagramTransactionPaymentSalesTax tax in SalesTax)
        {
            tax.InsertIntoDB();
        }
        foreach (DatagramTransactionPaymentVAT vAT in VAT)
        {
            vAT.InsertIntoDB();
        }
        foreach (DatagramTransactionPaymentPrepayment prepayment in Prepayment)
        {
            prepayment.InsertIntoDB();
        }
        PaymentDue.InsertIntoDB();

        string connectionString = @"Data Source=LOCALHOST\SQLEXPRESS;Initial Catalog=TLGPizza;Integrated Security=True";

        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            string insertStmt = "INSERT INTO [TLGPizza].[Payment] (PurchaseTotal, Notes) VALUES(@purchaseTotal, @notes);";
            using (SqlCommand cmd = new SqlCommand(insertStmt, connection))
            {
                cmd.CommandText = insertStmt;

                cmd.Parameters.Add("@purchaseTotal", SqlDbType.Decimal);
                cmd.Parameters.Add("@notes", SqlDbType.VarChar);

                cmd.Parameters["@purchaseTotal"].Value = PurchaseTotal.Amount;
                cmd.Parameters["@notes"].Value         = Notes;

                connection.Open();
                cmd.ExecuteNonQuery();
                connection.Close();
            }
        }
    }
Ejemplo n.º 4
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (string.IsNullOrEmpty(InvoiceNo))
            {
                yield return(new ValidationResult("InvoiceNo harus diisi", new List <string> {
                    "InvoiceNo"
                }));
            }
            if (string.IsNullOrEmpty(From))
            {
                yield return(new ValidationResult("From harus diisi", new List <string> {
                    "From"
                }));
            }

            if (string.IsNullOrEmpty(To))
            {
                yield return(new ValidationResult("To harus diisi", new List <string> {
                    "To"
                }));
            }

            if (SailingDate == default(DateTimeOffset))
            {
                yield return(new ValidationResult("SailingDate harus diisi", new List <string> {
                    "SailingDate"
                }));
            }


            if (string.IsNullOrEmpty(Consignee))
            {
                yield return(new ValidationResult("Consignee harus diisi", new List <string> {
                    "Consignee"
                }));
            }
            if (string.IsNullOrEmpty(ShippingPer))
            {
                yield return(new ValidationResult("ShippingPer harus diisi", new List <string> {
                    "ShippingPer"
                }));
            }

            //if (string.IsNullOrEmpty(ConfirmationOfOrderNo))
            //	yield return new ValidationResult("ConfirmationOfOrderNo harus diisi", new List<string> { "ConfirmationOfOrderNo" });

            if (string.IsNullOrEmpty(ShippingStaff))
            {
                yield return(new ValidationResult("ShippingStaff harus diisi", new List <string> {
                    "ShippingStaff"
                }));
            }

            if (string.IsNullOrEmpty(FabricType))
            {
                yield return(new ValidationResult("FabricType harus diisi", new List <string> {
                    "FabricType"
                }));
            }

            //if (string.IsNullOrEmpty(BankAccount))
            //	yield return new ValidationResult("BankDetail harus diisi", new List<string> { "BankAccount" });

            if (PaymentDue.Equals(0))
            {
                yield return(new ValidationResult("PaymentDue harus diisi", new List <string> {
                    "PaymentDue"
                }));
            }

            if (string.IsNullOrEmpty(CPrice))
            {
                yield return(new ValidationResult("CPrice harus diisi", new List <string> {
                    "CPrice"
                }));
            }

            if (string.IsNullOrEmpty(ConsigneeAddress))
            {
                yield return(new ValidationResult("ConsigneeAddress harus diisi", new List <string> {
                    "ConsigneeAddress"
                }));
            }


            if (Items.Count == 0)
            {
                yield return(new ValidationResult("Detail  harus Diisi", new List <string> {
                    "ItemsCount"
                }));
            }
            else
            {
                int errorItemsCount = 0;
                List <Dictionary <string, object> > errorItems = new List <Dictionary <string, object> >();

                foreach (var item in Items)
                {
                    Dictionary <string, object> errorItem = new Dictionary <string, object>();

                    if (string.IsNullOrWhiteSpace(item.RONo))
                    {
                        errorItem["RONo"] = "RONo tidak boleh kosong";
                        errorItemsCount++;
                    }

                    if (item.Quantity == 0)
                    {
                        errorItem["Quantity"] = "Quantity tidak boleh 0";
                        errorItemsCount++;
                    }

                    if (item.Price == 0)
                    {
                        errorItem["Price"] = "Price tidak boleh 0";
                        errorItemsCount++;
                    }


                    errorItems.Add(errorItem);
                }
                if (errorItemsCount > 0)
                {
                    yield return(new ValidationResult(JsonConvert.SerializeObject(errorItems), new List <string> {
                        "Items"
                    }));
                }
            }
            if (GarmentShippingInvoiceAdjustments.Count > 0)
            {
                int errorAdjustmentCount = 0;
                List <Dictionary <string, object> > errorAdjustments = new List <Dictionary <string, object> >();


                foreach (var item in GarmentShippingInvoiceAdjustments)
                {
                    Dictionary <string, object> errorItem = new Dictionary <string, object>();


                    if (string.IsNullOrEmpty(item.AdjustmentDescription) && item.AdjustmentValue > 0)
                    {
                        errorItem["AdjustmentDescription"] = "AdjustmentDescription tidak boleh kosong";
                        errorAdjustmentCount++;
                    }
                    if (item.AdjustmentValue == 0 && item.AdjustmentDescription != "")
                    {
                        errorItem["AdjustmentValue"] = "AdjustmentValue tidak boleh 0";
                        errorAdjustmentCount++;
                    }
                    errorAdjustments.Add(errorItem);
                }
                if (errorAdjustmentCount > 0)
                {
                    yield return(new ValidationResult(JsonConvert.SerializeObject(errorAdjustments), new List <string> {
                        "GarmentShippingInvoiceAdjustments"
                    }));
                }
            }
        }