public ActionResult GetCommodityView() { CommodityModel model = new CommodityModel(); var CommodityId = Request.QueryString["commodityid"]; try { CommodityClient = new CommodityServiceClient(); CommodityDto cmdto = CommodityClient.GetById(CommodityId != null ? Convert.ToInt32(CommodityId) : 0); model.CommodityId = cmdto.CommodityId; model.CommoditiesInCommodityClass = cmdto.CommoditiesInCommodityClass; model.Name = cmdto.Name; model.BotanicalName = cmdto.BotanicalName; model.IsActive = cmdto.IsActive; model.Image = (((!String.IsNullOrEmpty(cmdto.Image)) ? Constants.IMAGEUPLOADPATHCOMMODITY + cmdto.Image : Constants.BLANKIMAGEPATH)).Replace("~/", "../../"); model.CommodityClassList = GetCommodityClassList(); } catch (Exception ex) { return(View("ErrorPage")); } finally { if (CommodityClient != null) { CommodityClient.Close(); } } return(View("CommodityView", model)); }
public List <CommodityDto> GetCommodityList() { CommodityClient = new CommodityServiceClient(); var CommodityDtos = CommodityClient.FindAll(); CommodityClient.Close(); return(CommodityDtos.Entities.ToList()); }
public ActionResult AddCommodityIndex() { CommodityModel model = new CommodityModel(); string mode = Request.QueryString["mode"] != null ? Request.QueryString["mode"].ToString() : string.Empty; var CommodityId = Request.QueryString["commodityid"] != null ? Request.QueryString["commodityid"] : null; try { if (mode == "edit") { FormMode = mode; CommodityClient = new CommodityServiceClient(); CommodityDto cmdto = CommodityClient.GetById(CommodityId != null ? Convert.ToInt32(CommodityId) : 0); Id = cmdto.CommodityId; model.CommoditiesInCommodityClass = cmdto.CommoditiesInCommodityClass; model.CommodityClassId = cmdto.CommoditiesInCommodityClass.CommodityClassId; model.Name = cmdto.Name; model.BotanicalName = cmdto.BotanicalName; model.IsActive = cmdto.IsActive; model.Image = (((!String.IsNullOrEmpty(cmdto.Image)) ? Constants.IMAGEUPLOADPATHCOMMODITY + (Session["UploadedImageFileName"] = cmdto.Image).ToString() : Constants.BLANKIMAGEPATH)).Replace("~/", "../../"); model.CommodityClassList = GetCommodityClassList(); } else { model.Image = Constants.BLANKIMAGEPATH.Replace("~/", "../../"); model.CommodityClassList = GetCommodityClassList(); } } catch (Exception ex) { return(View("ErrorPage")); } finally { if (CommodityClient != null) { CommodityClient.Close(); } } return(View("AddCommodity", model)); }
public CommodityDto GetCommodityByClassId(CommodityDto CommoditymasterDto) { CommodityClient = new CommodityServiceClient(); Query query = new Query(); Criterion criteriaClassID = new Criterion("commodityclass.CommodityClassId", CommoditymasterDto.CommoditiesInCommodityClass.CommodityClassId, CriteriaOperator.Equal); query.Add(criteriaClassID); query.AddAlias(new Alias("commodityclass", "CommoditiesInCommodityClass")); var commoditydtos = CommodityClient.FindByQuery(query); CommodityClient.Close(); return(commoditydtos.Entities.FirstOrDefault()); }