コード例 #1
0
        private void UpdateContract(EditableContract editContract)
        {
            var dataContract = Db.new_contract_plan_productBase.FirstOrDefault(it => it.new_contract_plan_productId == editContract.ContrGuid);

            if (dataContract != null)
            {
                /*mapping from viewmodel to dataModel*/
                dataContract.new_d_product_groupsBase.new_name  = editContract.ProductGroupProduct ?? ""; //null check
                dataContract.new_d_product_catalogBase.new_name = editContract.Product ?? "";             // null check
                dataContract.new_service_1_quarter    = editContract.Service1Quarter;
                dataContract.new_consulting_1_quarter = editContract.Consult1Quarter;
            }
        }
コード例 #2
0
        private void InsertContract(EditableContract editContract, IList <new_contract_plan_productBase> dataContextModelContracts)
        {
            var dataContextModelContract = new new_contract_plan_productBase();

            //initialize childs for null reference errors
            dataContextModelContract.new_d_product_groupsBase  = new new_d_product_groupsBase();
            dataContextModelContract.new_d_product_catalogBase = new new_d_product_catalogBase();

            dataContextModelContract.new_contract_plan_productId        = Guid.NewGuid(); //todo check if EF or db add guid automatically
            dataContextModelContract.new_d_product_groupsBase.new_name  = editContract.ProductGroupProduct;
            dataContextModelContract.new_d_product_catalogBase.new_name = editContract.Product;
            dataContextModelContract.new_service_1_quarter    = editContract.Service1Quarter;
            dataContextModelContract.new_consulting_1_quarter = editContract.Consult1Quarter;
            //dataContextModelContracts.Add(dataContextModelContract);
            Db.new_contract_plan_productBase.ToList().Add(dataContextModelContract);
        }
コード例 #3
0
        internal static void InsertContract(EditableContract contract)
        {
            var editContract = new EditableContract()
            {
                ContrGuid              = contract.ContrGuid,
                ProductGroupProduct    = contract.ProductGroupProduct,
                Product                = contract.Product,
                Service1Quarter        = contract.Service1Quarter,
                Service2Quarter        = contract.Service2Quarter,
                Service3Quarter        = contract.Service3Quarter,
                Service4Quarter        = contract.Service4Quarter,
                Consult1Quarter        = contract.Consult1Quarter,
                Consult2Quarter        = contract.Consult2Quarter,
                Consult3Quarter        = contract.Consult3Quarter,
                Consult4Quarter        = contract.Consult4Quarter,
                NewServiceYear         = contract.NewServiceYear,
                NewConsultYear         = contract.NewConsultYear,
                NewProductTotalConsult = contract.NewProductTotalConsult,
                NewProductTotalService = contract.NewProductTotalService,
                NewYearTotal           = contract.NewYearTotal
            };

            GetEditableContracts().Add(editContract);
        }
コード例 #4
0
 public static void UpdateProduct(EditableContract contract)
 {
     EditableContract editProduct = GetEditableContract(contract.ContrGuid);
 }