// GET: PurchaseOrder public ActionResult Index() { List <PurchaseOrderViewModel> model = PurchaseOrderDAL.GetData(); ViewBag.ListStatus = new SelectList(PurchaseOrderDAL.GetStatus(), "ID", "StatusName"); return(View(model)); }
/// <summary> /// Gets all purchase order. /// </summary> /// <returns>Get All PurchaseOrder</returns> public List <PurchaseOrder> GetAllPurchaseOrder() { PurchaseOrderDAL purchaseOrderDAL = new PurchaseOrderDAL(); List <PurchaseOrder> result = purchaseOrderDAL.GetAllPurchaseOrder(); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.BindDataToDropdown(ddlPurchaseStatus, Utility.GetPurchaseStatusList()); Utility.BindDataToDropdown(ddlApplyPurchaseMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlApproveMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlMachMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlMachTableMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlPurchaseMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true)); PurchaseOrderDAL dal = new PurchaseOrderDAL(); var po = dal.GetPOByNo(PONo); txtPurchaseId.Text = po.Purchase_No; txtPurchaseCreatedDate.Text = po.CreatedDate.ToString("yyyy-MM-dd"); txtApplyPurchaseDate.Text = po.ApplyPurchaseDate.HasValue ? po.ApplyPurchaseDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtExpectedCompleteDate.Text = po.ExpectedCompleteDate.HasValue ? po.ExpectedCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty; ddlSalesMan.SelectedValue = po.EnqOrdMan; ddlMachMan.SelectedValue = po.MachiningCreateMan; ddlPurchaseMan.SelectedValue = po.PurchaseMan; ddlApplyPurchaseMan.SelectedValue = po.PurchaseApplyMan; ddlApproveMan.SelectedValue = po.ApproveMan; ddlMachTableMan.SelectedValue = po.MachTableCreateMan; txtPurchaseSummary.Text = po.PurchaseIntro; //purchase content BindControl(); //status ddlPurchaseStatus.SelectedValue = po.Status; //followup UIUtility.BindUserControl(followUpControl, SysConst.SourceTypePurchase, PONo); } }
public override void BindControl() { PurchaseOrderDAL dal = new PurchaseOrderDAL(); var result = dal.GetPOBySource(SourceType, SourceNo); Utility.BindDataToRepeater(rpPurchase, result); }
protected void btnSave_Click(object sender, EventArgs e) { PurchaseOrderDAL dal = new PurchaseOrderDAL(); var po = dal.GetPOByNo(PONo); if (!string.IsNullOrEmpty(txtApplyPurchaseDate.Text)) { po.ApplyPurchaseDate = DateTime.Parse(txtApplyPurchaseDate.Text); } if (!string.IsNullOrEmpty(txtExpectedCompleteDate.Text)) { po.ExpectedCompleteDate = DateTime.Parse(txtExpectedCompleteDate.Text); } po.EnqOrdMan = Utility.GetSelectedText(ddlSalesMan); po.MachiningCreateMan = Utility.GetSelectedText(ddlSalesMan); po.PurchaseMan = Utility.GetSelectedText(ddlPurchaseMan); po.PurchaseApplyMan = Utility.GetSelectedText(ddlApplyPurchaseMan); po.ApproveMan = Utility.GetSelectedText(ddlApproveMan); po.MachTableCreateMan = Utility.GetSelectedText(ddlMachTableMan); po.PurchaseIntro = txtPurchaseSummary.Text; AddFollowUp(followUpControl, po.Status, Utility.GetSelectedText(ddlPurchaseStatus)); po.Status = Utility.GetSelectedText(ddlPurchaseStatus); dal.Save(); SetFocus(sender); }
protected void btnChangeStatus_Click(object sender, EventArgs e) { PurchaseOrderDAL dal = new PurchaseOrderDAL(); var po = dal.GetPOByNo(PONo); AddFollowUp(followUpControl, po.Status, Utility.GetSelectedText(ddlPurchaseStatus)); po.Status = Utility.GetSelectedText(ddlPurchaseStatus); dal.Save(); SetFocus(sender); }
public ActionResult Edit(int Id) { var UserId = User.Identity.GetUserId(); ViewBag.ListOutlet = new SelectList(EmployeeOutletDAL.GetDataByID(int.Parse(UserId)), "OutletID", "OutletName"); ViewBag.ListSupplier = new SelectList(SuppliersDAL.GetData(), "ID", "Name"); ListPurchaseOrderViewModel model = PurchaseOrderDAL.GetDataByIdPO(Id); return(PartialView("Edit", model)); }
private List <PurchaseOrder> GetPOList() { PurchaseOrderDAL dal = new PurchaseOrderDAL(); var pos = dal.SearchPO(txtPurchaseId.Text, Utility.GetSelectedText(ddlPurchaseStatus), Utility.GetSelectedText(ddlOrdMan), Utility.GetSelectedText(ddlMachMan), Utility.GetSelectedText(ddlPurchaseMan), Utility.GetSelectedText(ddlApplyPurchaseMan), Utility.GetSelectedText(ddlMachTableMan), Utility.GetSelectedText(ddlApproveMan), !string.IsNullOrEmpty(txtBeginDate.Text) ? DateTime.Parse(txtBeginDate.Text) : DateTime.MinValue, !string.IsNullOrEmpty(txtEndDate.Text) ? DateTime.Parse(txtEndDate.Text) : DateTime.MaxValue); return(pos.ToList()); }
public static Int32 deleteAllTmpPurchaseOrder() { PurchaseOrderDAL objDal = new PurchaseOrderDAL(); try { return(objDal.deleteAllTmpPurchaseOrder()); } catch (Exception ex) { throw ex; } finally { objDal = null; } }
public static Int32 updateBasicDataByPo() { PurchaseOrderDAL objDal = new PurchaseOrderDAL(); try { return(objDal.updateBasicDataByPo()); } catch (Exception ex) { throw ex; } finally { objDal = null; } }
protected void btnCreate_Click(object sender, EventArgs e) { //get no SeedDAL sdal = new SeedDAL(); string no = sdal.GetNoByTableName(SysConst.TablePurchaseOrder, SysConst.SuffixPurchaseOrder); //if (string.Equals(SourceType, SysConst.SourceTypeSalesOrder, StringComparison.OrdinalIgnoreCase)) //{ // SalesOrderDAL soDAL = new SalesOrderDAL(); // var so = soDAL.GetOrderByNo(SourceNo); // enqOrdMan = so.OrderMan; // companyName = so.CustomerCompanyName; // contact = so.CustomerContactName; // address = so.CustomerAddress; // email = so.CustomerEmail; // qq = so.CustomerQQ; // phone1 = so.CustomerPhone1; // phone2 = so.CustomerPhone2; // other = so.CustomerOthers; //} //new po PurchaseOrderDAL dal = new PurchaseOrderDAL(); PurchaseOrder po = new PurchaseOrder() { Purchase_No = no, Status = FirstStatusConsts.Purchase, SourceType = string.Empty, SourceNo = string.Empty, CreatedDate = DateTime.Now, CreatedAt = DateTime.Now, CreatedBy = SMSContext.Current.User.UserName }; dal.AddPO(po); dal.Save(); int poid = po.Purchase_Id; string pono = po.Purchase_No; string url = Page.ResolveUrl(string.Format("~/PurchaseForm.aspx?poid={0}&pono={1}&sourcetype={2}&sourceno={3}", poid, pono, string.Empty, string.Empty)); string script = string.Format("<script>window.open('{0}')</script>", url); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createpo", script); }
public string GetCategoryContent(string catType) { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.GetCategoryContent(catType)); }
public int UpdationOrder(PurchaseOrderForm quotationData) { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.UpdationOrder(quotationData)); }
public PurchaseOrderForm GetPurchaseOrder(string poNo) { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.GetPurchaseOrder(poNo)); }
public int GetLatestOrderNo() { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.GetLastOrderNo()); }
public List <PurchaseOrderEntity> GetAllPurchaseOrders() { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.GetAllPurchaseOrders()); }
public bool DeleteOrder(int purchaseQuotID) { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.DeleteQuotatoin(purchaseQuotID)); }
public bool CanDeleteOrder(int poID) { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.CanDeleteOrder(poID)); }
protected void btnCreatePurchase_Click(object sender, EventArgs e) { //get no SeedDAL sdal = new SeedDAL(); string no = sdal.GetNoByTableName(SysConst.TablePurchaseOrder, SysConst.SuffixPurchaseOrder); //get enqordman string enqOrdMan = string.Empty; string companyName = string.Empty; string contact = string.Empty; string address = string.Empty; string email = string.Empty; string qq = string.Empty; string phone1 = string.Empty; string phone2 = string.Empty; string other = string.Empty; if (string.Equals(SourceType, SysConst.SourceTypeOrder, StringComparison.OrdinalIgnoreCase)) { OrderDAL soDAL = new OrderDAL(); var so = soDAL.GetOrderByNo(SourceNo); so.Status = "申请采购"; soDAL.Save(); enqOrdMan = so.OrderMan; companyName = so.CustomerCompanyName; contact = so.CustomerContactName; address = so.CustomerAddress; email = so.CustomerEmail; qq = so.CustomerQQ; phone1 = so.CustomerPhone1; phone2 = so.CustomerPhone2; other = so.CustomerOthers; } else if (string.Equals(SourceType, SysConst.SourceTypeMaching, StringComparison.OrdinalIgnoreCase)) { MachiningDAL mDAL = new MachiningDAL(); var mach = mDAL.GetMachByNo(SourceNo); companyName = mach.CustomerCompanyName; contact = mach.CustomerContactName; address = mach.CustomerAddress; email = mach.CustomerEmail; qq = mach.CustomerQQ; phone1 = mach.CustomerPhone1; phone2 = mach.CustomerPhone2; other = mach.CustomerOthers; } //new refine PurchaseOrderDAL dal = new PurchaseOrderDAL(); PurchaseOrder po = new PurchaseOrder() { Purchase_No = no, Status = FirstStatusConsts.Purchase, EnqOrdMan = enqOrdMan, SourceType = SourceType, SourceNo = SourceNo, CreatedDate = DateTime.Now, CreatedAt = DateTime.Now, CreatedBy = SMSContext.Current.User.UserName }; dal.AddPO(po); dal.Save(); int poid = po.Purchase_Id; string pono = po.Purchase_No; //poitem if (string.Equals(SourceType, SysConst.SourceTypeMaching, StringComparison.OrdinalIgnoreCase)) { MachiningDAL mDAL = new MachiningDAL(); var mach = mDAL.GetMachByNo(SourceNo); MachItemDAL miDAL = new MachItemDAL(); var machItems = miDAL.GetMachItemsByMachId(mach.Mach_Id); POItemDAL pDAL = new POItemDAL(); foreach (var item in machItems) { PurchaseOrderItem poItem = new PurchaseOrderItem() { Code = item.Code, Deepth = item.Deepth, Intro = item.Intro, Long = item.Long, PO_Id = poid, Product_Code = item.Product_Code, Quantity = item.Quantity, Square = item.Square, Width = item.Width }; pDAL.AddPOItem(poItem); } pDAL.Save(); } string url = Page.ResolveUrl(string.Format("~/PurchaseForm.aspx?poid={0}&pono={1}&sourcetype={2}&sourceno={3}", poid, pono, SourceType, SourceNo)); string script = string.Format("<script>window.open('{0}')</script>", url); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createpo", script); BindControl(); SetFocus(btnCreatePurchase); }
public ActionResult Edit(ListPurchaseOrderViewModel model) { if (ModelState.IsValid) { using (POSContext context = new POSContext()) { using (var dbTransaction = context.Database.BeginTransaction()) { int UserId = User.Identity.GetUserId <int>(); string OrderNo = PurchaseOrderDAL.OrderNo(); PurchaseOrder order = context.TPurchaseOrder.Where(m => m.ID == model.ID).FirstOrDefault(); if (order != null) { order.OutletID = model.OutletID; order.SupplierID = model.SupplierID; order.Notes = model.Notes; order.Total = model.Total; order.ModifiedBy = UserId; order.ModifiedOn = DateTime.Now; } context.SaveChanges(); int i = 0; foreach (var item in model.VariantID) { int POid = model.PODetailID[i]; PurchaseOrderDetail orderdetail = context.TPurchaseOrderDetail.Where(m => m.ID == POid).FirstOrDefault(); if (orderdetail != null) { orderdetail.HeaderID = order.ID; orderdetail.Quantity = model.Quantity[i]; orderdetail.SubTotal = model.SubTotal[i]; orderdetail.VariantID = item; orderdetail.UnitCost = model.UnitCost[i]; orderdetail.ModifiedBy = UserId; orderdetail.ModifiedOn = DateTime.Now; } else { PurchaseOrderDetail orderdetail2 = new PurchaseOrderDetail() { HeaderID = order.ID, Quantity = model.Quantity[i], SubTotal = model.SubTotal[i], VariantID = item, UnitCost = model.UnitCost[i], CreatedBy = UserId, CreatedOn = DateTime.Now, ModifiedBy = UserId, ModifiedOn = DateTime.Now }; context.TPurchaseOrderDetail.Add(orderdetail2); } i++; } context.SaveChanges(); try { dbTransaction.Commit(); return(RedirectToAction("Index")); } catch (Exception) { dbTransaction.Rollback(); } } } } return(PartialView("Edit", model)); }
public ActionResult Load() { List <PurchaseOrderViewModel> model = PurchaseOrderDAL.GetData(); return(PartialView("_Index", model)); }
public ActionResult GetDataByStatus(int id) { List <PurchaseOrderViewModel> model = PurchaseOrderDAL.GetDataByStatus(id); return(PartialView("_Index", model)); }
//public int ConvertToPurchaseOrder(PurchaseOrderForm poForm) //{ // IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); // return PODAL.ConvertToPurchaseOrder(poForm); //} public int ConvertToPurchaseInvoice(PurchaseOrderForm quotationData) { IPurchaseOrderDAL PODAL = new PurchaseOrderDAL(); return(PODAL.ConvertToPurchaseInvoice(quotationData)); }
public ActionResult GetDataSearch(string searchKey) { List <PurchaseOrderViewModel> model = PurchaseOrderDAL.GetDataBySearch(searchKey); return(PartialView("_Index", model)); }
public ActionResult Add(PurchaseOrderViewModel model) { if (ModelState.IsValid) { using (POSContext context = new POSContext()) { using (var dbTransaction = context.Database.BeginTransaction()) { int UserId = User.Identity.GetUserId <int>(); string OrderNo = PurchaseOrderDAL.OrderNo(); PurchaseOrder order = new PurchaseOrder() { OutletID = model.OutletID, OrderNo = OrderNo, StatusID = 1, SupplierID = model.SupplierID, Notes = model.Notes, Total = model.Total, CreatedBy = UserId, CreatedOn = DateTime.Now, ModifiedBy = UserId, ModifiedOn = DateTime.Now }; context.TPurchaseOrder.Add(order); context.SaveChanges(); PurchaseOrderHistory orderhis = new PurchaseOrderHistory() { HeaderID = order.ID, StatusID = 1, CreatedBy = UserId, CreatedOn = DateTime.Now, ModifiedBy = UserId, ModifiedOn = DateTime.Now }; context.TPurchaseOrderHistory.Add(orderhis); context.SaveChanges(); foreach (var item in model.VariantID) { PurchaseOrderDetail orderdetail = new PurchaseOrderDetail() { HeaderID = order.ID, Quantity = model.Quantity, SubTotal = model.SubTotal, VariantID = item, UnitCost = model.UnitCost, CreatedBy = UserId, CreatedOn = DateTime.Now, ModifiedBy = UserId, ModifiedOn = DateTime.Now }; context.TPurchaseOrderDetail.Add(orderdetail); } context.SaveChanges(); try { dbTransaction.Commit(); return(RedirectToAction("Index")); } catch (Exception) { dbTransaction.Rollback(); } } } } return(PartialView("Add", model)); }
public PurchaseOrderForm GetPrintPurchaseOrder(string piNo) { IPurchaseOrderDAL PIDAL = new PurchaseOrderDAL(); return(PIDAL.GetPrintPurchaseOrder(piNo)); }
public ActionResult Detail(int Id) { ListPurchaseOrderViewModel model = PurchaseOrderDAL.GetDataByIdPO(Id); return(PartialView("Detail", model)); }