Exemplo n.º 1
0
 public static bool AddInputBill(InputBill inputBill)
 {
     if (inputBill == null)
     {
         return false;
     }
     try
     {
         db.InputBills.Add(inputBill);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         string s = e.ToString();
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
        public int AddInputBill(string supplierIdString, string inputBillAmountString, string inputTaxAmountString,
            string importDate, string fileName, string formNo, string serial)
        {
            try
            {
                User staffUser = Session["User"] as User;
                if (staffUser == null || Session["UserRole"] == null || (int)Session["UserRole"] != 2)
                {
                    return -7;
                }
                else
                {
                    InputBill inputBill = new InputBill();
                    try
                    {
                        inputBill.SupplierId = Convert.ToInt32(supplierIdString);
                        inputBill.InputBillAmount = Convert.ToInt32(inputBillAmountString);
                        inputBill.InputTaxAmount = Convert.ToInt32(inputTaxAmountString);
                        inputBill.ImportDate = DateTime.ParseExact(importDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        String inputBillCode = supplierIdString + importDate;
                        inputBill.InputBillCode = inputBillCode.Replace("/", "");
                        inputBill.InputRawImage = fileName;
                    }
                    catch (Exception)
                    {
                        return 0;

                    }

                    bool result = InputBillBusiness.AddInputBill(inputBill);
                    if (result)
                    {
                        return 2;
                    }
                    else
                    {
                        return 0;
                    }
                }
            }
            catch (Exception)
            {
                return 0;
            }
        }