public ActionResult CreateInvoice() { TCCGDataContext dbcontext = new TCCGDataContext(); clsInvoiceSetup invoice_setup = new clsInvoiceSetup(); List <dropdown> cust = new List <dropdown>(); invoice_setup.Invoice_num = "[SYSTEM GENERATED]"; invoice_setup.InvoiceDte = DateTime.Now.Date.ToShortDateString(); var q_tccg_customer = from aa in dbcontext.TCCG_CUSTOMERs where aa.cust_status == "SID005" select new { aa.CUSTOMER_CODE, aa.CUSTOMER_NAME }; cust.Add(new dropdown { displayvalue = "=Select=", valuemember = "=Select=" }); foreach (var row in q_tccg_customer) { cust.Add(new dropdown { displayvalue = row.CUSTOMER_NAME, valuemember = row.CUSTOMER_CODE }); } invoice_setup.customerlist = cust; return(View(invoice_setup)); }
public ActionResult ModifyInvoice(string id) { TCCGDataContext dbcontext = new TCCGDataContext(); clsInvoiceSetup invoice_setup = new clsInvoiceSetup(); List <dropdown> cust = new List <dropdown>(); var q_invoice_dtl = (from aa in dbcontext.TCCG_INVOICE_MSTRs where aa.DR_num == id select aa).First(); invoice_setup.Invoice_num = q_invoice_dtl.DR_num; invoice_setup.InvoiceDte = DateTime.Parse(q_invoice_dtl.DR_date.ToString()).ToShortDateString(); invoice_setup.Ship = q_invoice_dtl.DR_Ship; invoice_setup.Via = q_invoice_dtl.DR_via; ViewBag.customercode = q_invoice_dtl.DR_customer; var q_tccg_customer = from aa in dbcontext.TCCG_CUSTOMERs where aa.cust_status == "SID005" select new { aa.CUSTOMER_CODE, aa.CUSTOMER_NAME }; cust.Add(new dropdown { displayvalue = "=Select=", valuemember = "=Select=" }); foreach (var row in q_tccg_customer) { cust.Add(new dropdown { displayvalue = row.CUSTOMER_NAME, valuemember = row.CUSTOMER_CODE }); } invoice_setup.customerlist = cust; return(View(invoice_setup)); }