public static List <QuotationItemDTO> GetQuotationItems() { try { var result = db.Manali_Quotation_GetQuotationItemPriceList(); List <QuotationItemDTO> lstQuotationItems = new List <QuotationItemDTO>(); foreach (var item in result) { QuotationItemDTO quotationItem = new QuotationItemDTO { ItemID = item.ItemID, ItemName = item.ItemName, Price = item.Price.Value, IsUpwards = item.isUpwards.Value }; lstQuotationItems.Add(quotationItem); } return(lstQuotationItems); } catch (Exception) { throw; } }
public static QuotationDTO GetQuotaionDetails(int QuotationID) { try { var QuotationResult = db.Manali_Quotation_SelectAQuotation(QuotationID).SingleOrDefault(); var SelectedItems = db.Manali_Quotation_SelectQuotationSelectedItems(QuotationID); WorkerDTO marketer = new WorkerDTO { WorkerID = QuotationResult.WorkerID, Name = QuotationResult.Name, NIC = QuotationResult.NIC, Mobile = QuotationResult.Mobile, Address = QuotationResult.Address, Designation = QuotationResult.Designation, Image = QuotationResult.Image }; QuotationDTO Quotation = new QuotationDTO { QuotationID = QuotationResult.QuotationID, DateOfWedding = QuotationResult.DateOfWedding.Value, NameOfBride = QuotationResult.Bride, BrideAddress = QuotationResult.BrideAddress, BrideEmail = QuotationResult.BrideEmail, BrideContactNo = QuotationResult.BrideContactNo, DateOfHomecoming = QuotationResult.DateOfHomecoming.Value, NameOfGroom = QuotationResult.Groom, GroomAddress = QuotationResult.GroomAddress, GroomContactNo = QuotationResult.GroomContactNo, marketedBy = marketer }; List <QuotationItemDTO> lstQuotationItems = new List <QuotationItemDTO>(); foreach (var item in SelectedItems) { QuotationItemDTO quotationItem = new QuotationItemDTO { ItemID = item.ItemID.Value }; lstQuotationItems.Add(quotationItem); } Quotation.SelectedItem = lstQuotationItems; return(Quotation); } catch (Exception) { throw; } }
public JsonResult SaveQuotation(QuotationDTO quotation, string selectedItems) { bool result = true; string[] selectedItemIDs = selectedItems.Split(','); List <QuotationItemDTO> lstQuotationItems = new List <QuotationItemDTO>(); foreach (string item in selectedItemIDs) { int ItemID = 0; if (int.TryParse(item, out ItemID)) { QuotationItemDTO QuotationItem = new QuotationItemDTO { ItemID = ItemID }; lstQuotationItems.Add(QuotationItem); } } quotation.SelectedItem = lstQuotationItems; quotation.createdBy = new UserDTO { userID = 10 }; result = BusinessLayer.BusinessStore.Quotation.SaveQuotationDetails(ref quotation); ActionDetailsDTO actionDetails = new ActionDetailsDTO { Status = result == true ? 1 : 0, Content = quotation.QuotationID.ToString() }; return(Json(actionDetails, JsonRequestBehavior.AllowGet)); }