public int InsertCustomerRequest(CustomerRequestVM _obj) { int result = 0; using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("isp_InternetCustomerRequest", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@cid", _obj.cid); cmd.Parameters.AddWithValue("@requestTypeId", _obj.requestTypeId); cmd.Parameters.AddWithValue("@requestCharge", _obj.requestCharge); cmd.Parameters.AddWithValue("@updatedMontlyBill", _obj.updatedMontlyBill); cmd.Parameters.AddWithValue("@requiredNet", _obj.requiredNet); cmd.Parameters.AddWithValue("@hostId", _obj.hostId); cmd.Parameters.AddWithValue("@zoneId", _obj.zoneId); cmd.Parameters.AddWithValue("@customerAddress", _obj.customerAddress); cmd.Parameters.AddWithValue("@assignedUserId", _obj.assignedUserId); cmd.Parameters.AddWithValue("@remarks", _obj.remarks); cmd.Parameters.AddWithValue("@requestMonth", _obj.requestMonth); cmd.Parameters.AddWithValue("@requestYear", _obj.requestYear); cmd.Parameters.AddWithValue("@createdBy", _obj.createdBy); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); result = 1; con.Close(); } return(result); }
public bool CreateCustomer(CustomerRequestVM request) { try { var customerRequest = new CustomerRequest { Id = request.Id, LastName = request.LastName, FirstName = request.FirstName, CustomerCode = request.CustomerCode, DateOfBirth = request.DateOfBirth, }; foreach (var customerAdd in request.CustomerAddress) { customerRequest.CustomerAddress.Add(new CustomerAddressRequest { Id = customerAdd.Id, AddressId = customerAdd.AddressId, IsPrimary = customerAdd.IsPrimary, CustomerId = customerAdd.CustomerId, Address = new AddressRequest { Id = customerAdd.Address.Id, Street = customerAdd.Address.Street, Suburb = customerAdd.Address.Suburb, Country = customerAdd.Address.Country, Street2 = customerAdd.Address.Street2, StateId = customerAdd.Address.StateId, AddressTypeId = customerAdd.Address.AddressTypeId } }); } foreach (var customerCon in request.CustomerContacts) { customerRequest.CustomerContacts.Add(new CustomerContactsRequest { Id = customerCon.Id, ContactId = customerCon.ContactId, IsPrimary = customerCon.IsPrimary, CustomerId = customerCon.CustomerId, Contact = new ContactRequest { Id = customerCon.Contact.Id, Contact = customerCon.Contact.Contact, ContactTypeId = customerCon.Contact.ContactTypeId } }); } var response = _customerServiceClient.CreateCustomer(customerRequest); return(response.Successful); } catch (Exception e) { throw e; } }
public JsonResult InsertCustomerRequest(CustomerRequestVM _obj) { try { _obj.createdBy = Convert.ToInt32(Session["userId"]); int result = _dishCustomerRequestDA.InsertCustomerRequest(_obj); return(Json(new { success = true, message = "Data Saved" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public bool CreateCustomer([FromBody] CustomerRequestVM request) { return(_requester.CreateCustomer(request)); }