Exemple #1
0
        private void btnAddNewProduct_Click(object sender, EventArgs e)
        {
            var inputDialoge = new dlgInput
            {
                inputLabel = "New TEXT Setting Name",
                inputId    = _vm.MaxFieldId(),
                //IntegrationServiceType = IntegrationServiceType
            };

            inputDialoge.ShowDialog();
            dfcProducts.DataSource = null;

            var newSetting = new IntegrationSettingType
            {
                Name          = inputDialoge.inputValue,
                Code          = inputDialoge.inputValue.ToUpper().Replace(" ", "_"),
                Descr         = inputDialoge.inputValue,
                DataEntryType = "TEXT",
                DefatulValue  = "",
                Restrictions  = "",
            };

            _vm.AddSettingType(newSetting);
            IntegrationSettingTypes.Add(newSetting);
            dfcProducts.DataSource    = IntegrationSettingTypes;
            dfcProducts.DisplayMember = "Name";
        }
        public int AddSettingType(IntegrationSettingType newSetting)
        {
            using (var dc = new VendorDataContext(_connectionString))
            {
                dc.IntegrationSettingTypes.InsertOnSubmit(newSetting);
                dc.SubmitChanges();
            }

            return(newSetting.IntegrationSettingTypeId);
        }
        public int AddTextIntegrationSettingType(IntegrationSettingType input)
        {
            using (var dc = new VendorDataContext(_connectionString))
            {
                var maxId = dc.IntegrationSettingTypes.Max(x => x.IntegrationSettingTypeId);
                input.IntegrationSettingTypeId = ++maxId;
                dc.SubmitChanges();
            }

            return(input.IntegrationSettingTypeId);
        }
 public void SaveSettingType(IntegrationSettingType vendorSettingType)
 {
     using (var dc = new VendorDataContext(_connectionString))
     {
         var dbVendorSetting = dc.IntegrationSettingTypes.FirstOrDefault(x =>
                                                                         x.IntegrationSettingTypeId == vendorSettingType.IntegrationSettingTypeId);
         if (dbVendorSetting != null)
         {
             dbVendorSetting.Name          = vendorSettingType.Name;
             dbVendorSetting.Code          = vendorSettingType.Code;
             dbVendorSetting.DataEntryType = vendorSettingType.DataEntryType;
             dbVendorSetting.DefatulValue  = vendorSettingType.DefatulValue;
             dbVendorSetting.Descr         = vendorSettingType.Descr;
             dbVendorSetting.Restrictions  = vendorSettingType.Restrictions;
         }
         dc.SubmitChanges();
     }
 }