コード例 #1
0
		private void detach_CustomerModules(CustomerModule entity)
		{
			this.SendPropertyChanging();
			entity.Customer = null;
		}
コード例 #2
0
 partial void DeleteCustomerModule(CustomerModule instance);
コード例 #3
0
 partial void UpdateCustomerModule(CustomerModule instance);
コード例 #4
0
 partial void InsertCustomerModule(CustomerModule instance);
コード例 #5
0
        public void SaveModulesByCustomer(Int32 id, Int32[] modulesIds) {
            try {
                using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
                    CustomerModule customerModule = new CustomerModule();
                    customerModule.CustomerId = id;

                    foreach (Int32 priceId in modulesIds) {
                        customerModule.ModulePriceId = priceId;
                        db.CustomerModules.InsertOnSubmit(customerModule);
                    }
                    db.SubmitChanges();
                }
            }
            catch (Exception ex) {
                throw ex;
            }
        }
コード例 #6
0
        public void UpdateModules(Int32 id, Int32 moduleId) {
            CustomerModule query;
            try {
                using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
                    // Negative - stops service by ending it as of today
                    if (moduleId < 0) {
                        query = db.CustomerModules.Where(m => m.CustomerId == id && m.ModulePriceId == Math.Abs(moduleId) && m.EndDate == null).FirstOrDefault();
                        if (query != default(CustomerModule)) {
                            query.EndDate = DateTime.Now.Date;
                        }
                    }
                    // Positive - inserts
                    else if (moduleId > 0) {
                        query = new CustomerModule();
                        query.CustomerId = id;
                        query.ModulePriceId = moduleId;
                        db.CustomerModules.InsertOnSubmit(query);
                    }
                    else if (moduleId == 0) { }
                    db.SubmitChanges();
                }
            }
            catch (Exception ex) {
                throw ex;
            }

            return;
        }