You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.5 KiB
86 lines
2.5 KiB
1 year ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data.Entity.Migrations;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
using CK.SCP.Models;
|
||
|
using CK.SCP.Models.ScpEntity;
|
||
|
|
||
|
|
||
|
namespace CK.SCP.Controller
|
||
|
{
|
||
|
public class InvoiceController
|
||
|
{
|
||
|
public static List<V_BillInvoice> GetDataByBillInvoice( string billnum)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
return db.V_BillInvoice.Where(p => p.BillNum == billnum).ToList();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public static V_BillInvoice GetDataByBillInvoiceDetailModel(string billnum)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
return db.V_BillInvoice.SingleOrDefault(p => p.BillNum == billnum);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static bool UpdateData(int state, TB_INVOICE model)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
model.State = state;
|
||
|
|
||
|
db.TB_INVOICE.AddOrUpdate(p => p.UID, model);
|
||
|
EntitiesFactory.SaveDb(db);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
public static bool UpdateDataRemark(string remark, TB_INVOICE model)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
|
||
|
model.Remark = remark;
|
||
|
|
||
|
db.TB_INVOICE.AddOrUpdate(p => p.UID, model);
|
||
|
EntitiesFactory.SaveDb(db);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static bool UpdateDataReason(string remark, string billnum)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
TB_INVOICE model = new TB_INVOICE
|
||
|
{
|
||
|
Remark = remark,
|
||
|
BillNum = billnum
|
||
|
};
|
||
|
db.TB_INVOICE.AddOrUpdate(p => p.BillNum, model);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
public static TB_INVOICE GetDataByBillInvoiceBillNum(string id)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
return db.TB_INVOICE.SingleOrDefault(p => p.BillNum == id);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static V_BillInvoice GetBillInvoiceByBillNum(string id)
|
||
|
{
|
||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||
|
{
|
||
|
return db.V_BillInvoice.SingleOrDefault(p => p.BillNum == id);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|