public CommodityGradeDTO Map(CommodityGrade commodityGrade, Guid commodityId)
 {
     if (commodityGrade == null) return null;
     var grade = Mapper.Map<CommodityGrade, CommodityGradeDTO>(commodityGrade);
     grade.CommodityId = commodityId;
     return grade;
 }
        void ClearViewModel()
        {

            DocumentReference = string.Empty;
            Notes = "";
            SelectedAccountName = "--Select Account---"; ;
            SelectedFarmerName = "--Select Farmer---";
            DocumentId = Guid.Empty;
            SelectedAccount = new CommoditySupplier(Guid.Empty) { AccountName = "--Select Account---" };
            SelectedFarmer = new CommodityOwner(Guid.Empty) { FirstName = "--Select Farmer---" };
            DocumentIssuerUser = null;
            DocumentParentId = Guid.Empty;
            SelectedCommodity = new Commodity(Guid.Empty) { Name = "--Select Commodity---" }; ;
            SelectedGrade = new CommodityGrade(Guid.Empty) { Name = "--Select Grade---" };
            DocumentIssuerCostCentre = null;
            DocumentRecipientCostCentre = null;
            DriverName = "";
            RegistrationNumber = "";
            Weight = decimal.Zero;
            LineItems.Clear();
            FarmersList.Clear();
            CommodityList.Clear();
            GradeList.Clear();
            FarmerVisibility = "Collapsed";
            WeighTypeProp = WeighType.Manual;
            // MakeWeightextBoxReadOnly = false;
        }
Esempio n. 3
0
        List<CommodityGrade> AddCommodityGrades(Commodity comm)
        {
            List<CommodityGrade> grades = new List<CommodityGrade>();
            CommodityGrade grade = new CommodityGrade(Guid.NewGuid())
                                       {
                                           Code = comm.Code + " A",
                                           Description = comm.Name + " Grade A",
                                           Name = comm.Name + " Grade A",
                                           Commodity = comm,
                                           UsageTypeId = 1,
                                           _Status = EntityStatus.Active,

                                       };
            grades.Add(grade);
            CommodityGrade grade2 = new CommodityGrade(Guid.NewGuid())
            {
                Code = comm.Code +" B",
                Description = comm.Name +" Grade B",
                Name = comm.Name + " Grade B",
                Commodity = comm,
                UsageTypeId = 1,
                _Status = EntityStatus.Active,

            };
            grades.Add(grade2);
            CommodityGrade grade3 = new CommodityGrade(Guid.NewGuid())
            {
                Code = comm.Code + " C",
                Description = comm.Name + " Grade C",
                Name = comm.Name + " Grade C",
                Commodity = comm,
                UsageTypeId = 1,
                _Status = EntityStatus.Active,

            };
            grades.Add(grade3);

            return grades;
        }
        private void SelectGrade()
        {
            if (SelectedCommodity.Name == "--Select Commodity---")
            {
                SelectedGrade = new CommodityGrade(Guid.Empty) { Name = "--Select Grade---" };
                MessageBox.Show("Please Select the Commodity first", "Agrimanagr", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            using (var container = NestedContainer)
            {
                var selected = Using<IAgriItemsLookUp>(container).SelectGrade(SelectedCommodity.Id);

                SelectedGrade = selected;
                if (selected == null)
                {
                    SelectedGrade = new CommodityGrade(Guid.Empty) { Name = "--Select Grade---" };
                }
            }
        }