public HttpResponseMessage RemoteNotification(User userinfo) { try { BusinessObjects.Customer customer = new BusinessObjects.Customer(); customer.firstname = userinfo.firstname; customer.lastname = userinfo.lastname; customer.address = userinfo.address; customer.city = userinfo.city; customer.state = userinfo.state; customer.country = userinfo.country; customer.PIN = userinfo.PIN; customer.DOB = userinfo.DOB; customer.mobile = userinfo.mobile; if (objNotiImp.notifyRemote(customer)) { return(Request.CreateResponse(HttpStatusCode.OK, "True")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "False")); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error Message : " + ex.ToString())); } }
public List <BusinessObjects.Customer> GetLList(string connString) { try { List <BusinessObjects.Customer> ProductList = new List <BusinessObjects.Customer>(); string query = "select Id, Name, Address,NIC, Contact from Customer"; SqlConnection conn = DBHelper.GetConnection(connString); conn.Open(); SqlDataReader reader = DBHelper.ReadData(query, conn); while (reader.Read()) { BusinessObjects.Customer pObj = new BusinessObjects.Customer(); pObj.Id = Convert.ToInt32(reader[0].ToString()); pObj.Name = reader[1].ToString(); pObj.Address = reader[2].ToString(); pObj.NIC = reader[3].ToString(); pObj.Contact = reader[4].ToString(); ProductList.Add(pObj); } conn.Close(); return(ProductList); } catch (Exception ex) { throw ex; } }
public Customer GetCustomerBySID(string connString, int sid) { try { string query = @"select Id, Name, Address,NIC, Contact from Customer where Id =(select customerID from _Sales where sales_id=" + sid + ")"; SqlConnection conn = DBHelper.GetConnection(connString); conn.Open(); SqlDataReader reader = DBHelper.ReadData(query, conn); BusinessObjects.Customer pObj = new BusinessObjects.Customer(); while (reader.Read()) { pObj.Id = Convert.ToInt32(reader[0].ToString()); pObj.Name = reader[1].ToString(); pObj.Address = reader[2].ToString(); pObj.NIC = reader[3].ToString(); pObj.Contact = reader[4].ToString(); } conn.Close(); return(pObj); } catch (Exception ex) { throw ex; } }
//ExStart:PopulateData /// <summary> /// This function initializes/populates the data. /// Initialize Customer information, product information and order information /// </summary> /// <returns>Returns customer's complete information</returns> public static IEnumerable <BusinessObjects.Customer> PopulateData() { BusinessObjects.Customer customer = new BusinessObjects.Customer { CustomerName = "Atir Tahir", CustomerContactNumber = "+9211874", ShippingAddress = "Flat # 1, Kiyani Plaza ISB", Barcode = "123456789qwertyu0025" }; customer.Order = new BusinessObjects.Order[] { new BusinessObjects.Order { Product = new BusinessObjects.Product { ProductName = "Lumia 525" }, Customer = customer, Price = 170, ProductQuantity = 5, OrderDate = new DateTime(2015, 1, 1) } }; yield return(customer); //yield return statement will return one data at a time customer = new BusinessObjects.Customer { CustomerName = "Usman Aziz", CustomerContactNumber = "+458789", ShippingAddress = "Quette House, Park Road, ISB", Barcode = "123456789qwertyu0025" }; customer.Order = new BusinessObjects.Order[] { new BusinessObjects.Order { Product = new BusinessObjects.Product { ProductName = "Lenovo G50" }, Customer = customer, Price = 480, ProductQuantity = 2, OrderDate = new DateTime(2015, 2, 1) }, new BusinessObjects.Order { Product = new BusinessObjects.Product { ProductName = "Pavilion G6" }, Customer = customer, Price = 400, ProductQuantity = 1, OrderDate = new DateTime(2015, 10, 1) }, new BusinessObjects.Order { Product = new BusinessObjects.Product { ProductName = "Nexus 5" }, Customer = customer, Price = 320, ProductQuantity = 3, OrderDate = new DateTime(2015, 6, 1) } }; yield return(customer); //yield return statement will return one data at a time }
public HttpResponseMessage RegisterUser(User userinfo) { try { BusinessObjects.Customer customer = new BusinessObjects.Customer(); customer.firstname = userinfo.firstname; customer.lastname = userinfo.lastname; customer.address = userinfo.address; customer.city = userinfo.city; customer.state = userinfo.state; customer.country = userinfo.country; customer.PIN = userinfo.PIN; customer.DOB = userinfo.DOB; customer.mobile = userinfo.mobile; if (objCustImp.saveUser(customer, userinfo.Pwd)) { return Request.CreateResponse(HttpStatusCode.OK, "True"); } else { return Request.CreateResponse(HttpStatusCode.OK, "False"); } } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error Message: " + ex.ToString()); } }