public int DeleteGroup(CustomerGroupMaster customerGroupObj) { using (var command = _dataBaseRepository.db.GetStoredProcCommand(DnD.Common.Constants.UspDeleteGroup)) { command.Parameters.Add(_dataBaseRepository.CreateParameter(command, DnD.Common.Constants.CustomerGroupMasterId, customerGroupObj.CustomerGroupMasterId, DbType.Int32)); command.Parameters.Add(_dataBaseRepository.CreateParameter(command, DnD.Common.Constants.UpdatedBy, customerGroupObj.CustomerGroupMasterId, DbType.Int32)); var groupID = Convert.ToInt32(_dataBaseRepository.db.ExecuteScalar(command)); return(groupID); } }
public int SaveGroup(CustomerGroupMaster customerGroupObj) { using (var command = _dataBaseRepository.db.GetStoredProcCommand(DnD.Common.Constants.UspInsertGroup)) { command.Parameters.Add(_dataBaseRepository.CreateParameter(command, DnD.Common.Constants.GroupName, customerGroupObj.GroupName, DbType.String)); command.Parameters.Add(_dataBaseRepository.CreateParameter(command, DnD.Common.Constants.DiscountPercentage, customerGroupObj.DiscountPercentage, DbType.Int32)); command.Parameters.Add(_dataBaseRepository.CreateParameter(command, DnD.Common.Constants.CreateddBy, 1, DbType.Int32)); var groupID = Convert.ToInt32(_dataBaseRepository.db.ExecuteScalar(command)); return(groupID); } }
public IHttpActionResult DeleteGroup(CustomerGroupMaster customerGroupObj) { try { return(Ok(_customeManager.DeleteGroup(customerGroupObj))); } catch (Exception ex) { //LoggerEx.HandleException(LoggingBoundaries.DomainLayer, ex, false); return(BadRequest()); } }
public List <CustomerGroupMaster> GetAllGroups() { List <CustomerGroupMaster> Groups = new List <CustomerGroupMaster>(); using (var command = _dataBaseRepository.db.GetStoredProcCommand(DnD.Common.Constants.UspGetAllGroups)) { using (var objDataReader = _dataBaseRepository.db.ExecuteReader(command)) { while (objDataReader.Read()) { CustomerGroupMaster Group = new CustomerGroupMaster(); Group.CustomerGroupMasterId = HelperMethods.GetDataValue <int>(objDataReader, DnD.Common.Constants.CustomerGroupMasterId); Group.GroupName = HelperMethods.GetDataValue <string>(objDataReader, DnD.Common.Constants.GroupName);; Group.DiscountPercentage = HelperMethods.GetDataValue <int>(objDataReader, DnD.Common.Constants.DiscountPercentage);; Group.IsActive = HelperMethods.GetDataValue <bool>(objDataReader, DnD.Common.Constants.IsActive); Group.CreatedOn = HelperMethods.GetDataValue <DateTime>(objDataReader, DnD.Common.Constants.CreatedOn); Groups.Add(Group); } } return(Groups); } }
/// <summary> /// /// </summary> /// <returns></returns> public AddEditCustomerMasterViewModel GetAllMasterDataForCreateOrEditCustomer() { AddEditCustomerMasterViewModel addEditCustomerMasterViewModel = new AddEditCustomerMasterViewModel(); List <Country> countryList = new List <Country>(); List <CustomerGroupMaster> customerGroupMaster = new List <CustomerGroupMaster>(); using (var command = _dataBaseRepository.db.GetStoredProcCommand(Constants.UspGetAllMasterDataForCreateOrEditCustomer)) { using (var dataReader = _dataBaseRepository.db.ExecuteReader(command)) { // Get Product Tags while (dataReader.Read()) { Country country = new Country(); country.CountryId = HelperMethods.GetDataValue <int>(dataReader, "CountryId"); country.Name = HelperMethods.GetDataValue <string>(dataReader, "CountryName"); countryList.Add(country); } // Get product types if (dataReader.NextResult()) { while (dataReader.Read()) { CustomerGroupMaster group = new CustomerGroupMaster(); group.CustomerGroupMasterId = HelperMethods.GetDataValue <int>(dataReader, "CustomerGroupMasterId"); group.GroupName = HelperMethods.GetDataValue <string>(dataReader, "GroupName"); customerGroupMaster.Add(group); } } } } addEditCustomerMasterViewModel.Country = countryList; addEditCustomerMasterViewModel.CustomerGroup = customerGroupMaster; return(addEditCustomerMasterViewModel); }
/// <summary> /// Delete Group /// </summary> /// <param name="customerGroupObj"></param> /// <returns></returns> public int DeleteGroup(CustomerGroupMaster customerGroupObj) { return(_customerRepository.DeleteGroup(customerGroupObj)); }
/// <summary> /// Update Group /// </summary> /// <param name="customerGroupObj"></param> /// <returns></returns> public int UpdateGroup(CustomerGroupMaster customerGroupObj) { customerGroupObj.UpdatedOn = DateTime.Now; return(_customerRepository.UpdateGroup(customerGroupObj)); }
/// <summary> /// Save Group /// </summary> /// <param name="customerGroupObj"></param> /// <returns></returns> public int SaveGroup(CustomerGroupMaster customerGroupObj) { customerGroupObj.CreatedOn = DateTime.Now; return(_customerRepository.SaveGroup(customerGroupObj)); }