public IActionResult Grabar(int idCliente, string nombres, string apellidos, string pais, string ciudad, string telefono) { Customer customer = new Customer(); customer.FirstName = nombres; customer.LastName = apellidos; customer.City = ciudad; customer.Country = pais; customer.Phone = telefono; bool exito = true; if (idCliente == -1) //Es un nuevo registro { exito = DACustomer.Insertar(customer); } else { //Es una actualización customer.Id = idCliente; exito = DACustomer.Actualizar(customer); } return(Json(exito)); }
private DACustomer CreateObjectFromPage() { // check DACustomer daCustomer = new DACustomer(); // daCustomer.fCustomerName = fCustomerName.Value.Trim(); daCustomer.fCustomerGroupID = Convert.ToInt32(fCustomerGroupID.Value.Trim()); daCustomer.fCompany = fCompany.Value.Trim(); daCustomer.fEmail = fEmail.Value.Trim(); daCustomer.fPhone = fPhone.Value.Trim(); daCustomer.fAddress = fAddress.Value.Trim(); daCustomer.fProvinceID = Convert.ToInt32(fProvinceID.Value.Trim()); daCustomer.fBirthday = fBirthday.Value.Trim(); daCustomer.fSex = Convert.ToByte(fSex.Value.Trim()); daCustomer.fSocialNetwork = fSocialNetwork.Value.Trim(); daCustomer.fUsername = fUsername.Value.Trim(); daCustomer.fPassword = fPassword.Value.Trim(); daCustomer.fNote = fNote.Value.Trim(); daCustomer.fOperator = "";// MySession.UserName; // return(daCustomer); }
public int BADeleteCustomer(customentity objCustomerdetails) { DACustomer objCustomerDA = new DACustomer(); int returnValue = objCustomerDA.DADeleteCustomer(objCustomerdetails); return(returnValue); }
public int BAAddCustomerDetails(customentity objcustomerDetails) { DACustomer objCustomerDA = new DACustomer(); int returnValue = objCustomerDA.DAAddcustomerDetails(objcustomerDetails); return(returnValue); }
override protected Boolean GetDataComboBox() { try { DAOrderStatus daOrderStatus = new DAOrderStatus(); fOrderStatusID.DataSource = daOrderStatus.USP_OrderStatus_GetDataForComboBox(); fOrderStatusID.DataBind(); DAPayment daPayment = new DAPayment(); fPaymentID.DataSource = daPayment.USP_Payment_GetDataForComboBox(); fPaymentID.DataBind(); DAShipping daShipping = new DAShipping(); fShippingID.DataSource = daShipping.USP_Shipping_GetDataForComboBox(); fShippingID.DataBind(); DAProvince daProvinceBilling = new DAProvince(); fBillProvinceID.DataSource = daProvinceBilling.USP_Province_GetDataForComboBox(); fBillProvinceID.DataBind(); DADistrict daDistrictBilling = new DADistrict(); fBillDistrictID.DataSource = daDistrictBilling.USP_District_GetDataForComboBox_ByProvinceID(int.Parse(fBillProvinceID.SelectedValue)); fBillDistrictID.DataBind(); DAProvince daProvinceShipping = new DAProvince(); fShipProvinceID.DataSource = daProvinceShipping.USP_Province_GetDataForComboBox(); fShipProvinceID.DataBind(); DADistrict daDistrictShipping = new DADistrict(); fShipDistrictID.DataSource = daDistrictShipping.USP_District_GetDataForComboBox_ByProvinceID(int.Parse(fShipProvinceID.SelectedValue)); fShipDistrictID.DataBind(); DACustomer daCustomer = new DACustomer(); fCustomerID.DataSource = daCustomer.USP_Customer_GetDataForComboBox(); fCustomerID.DataBind(); DAProvince daProvince = new DAProvince(); fProvinceID.DataSource = daProvince.USP_Province_GetDataForComboBox(); fProvinceID.DataBind(); DACustomerGroup daCustomerGroup = new DACustomerGroup(); fCustomerGroupID.DataSource = daCustomerGroup.USP_CustomerGroup_GetDataForComboBox(); fCustomerGroupID.DataBind(); //LoadCategory(); return(true); } catch (Exception ex) { ShowErrorMes("Lỗi hệ thống: " + ex.Message); return(false); } }
override protected int DeleteByID(int pID) { try { DACustomer DACustomer = new DACustomer(); DACustomer.USP_Customer_Delete(pID); return(1); } catch { return(0); } }
private Boolean CreateOrUpdateCustomer() { int CustomerID = int.Parse(fCustomerID.SelectedValue); if (CheckInputCustomerInfo()) { try { DACustomer daCustomer = new DACustomer(); daCustomer.fID = CustomerID; daCustomer.fCustomerName = fCustomer.Value; daCustomer.fCustomerGroupID = int.Parse(fCustomerGroupID.Value); daCustomer.fEmail = fEmail.Value; daCustomer.fProvinceID = int.Parse(fProvinceID.Value); daCustomer.fPhone = fPhone.Value; daCustomer.fOperator = MySession.UserName; daCustomer.fAddress = ""; daCustomer.fBirthday = ""; daCustomer.fCompany = ""; daCustomer.fNote = ""; daCustomer.fPassword = ""; daCustomer.fSex = 0; daCustomer.fSocialNetwork = ""; daCustomer.fUsername = fEmail.Value; if (CustomerID == 0) { daCustomer.fID = daCustomer.USP_GetKey(); daCustomer.USP_Customer_Insert(); DACustomer daCustomer1 = new DACustomer(); fCustomerID.DataSource = daCustomer1.USP_Customer_GetDataForComboBox(); fCustomerID.DataBind(); fCustomerID.SelectedValue = daCustomer.fID.ToString(); } else { daCustomer.USP_Customer_Update(); } return(true); } catch (Exception ex) { ShowErrorMes("Lỗi hệ thống: " + ex.ToString()); return(false); } } else { return(false); } }
override protected int ExecUpdate() { // Update with ID = this.ID try { DACustomer DACustomer = CreateObjectFromPage(); DACustomer.fID = this.KeyID; DACustomer.USP_Customer_Update(); return(1); } catch { return(0); } }
public IActionResult ReporteCSV() { var builder = new StringBuilder(); builder.AppendLine("Id,FirstName,LastName"); List <Customer> listado = DACustomer.Listado(); foreach (var item in listado) { builder.AppendLine($"{item.Id},{item.FirstName},{item.LastName}"); } return(File(Encoding.UTF8.GetBytes(builder.ToString()), "text/csv", "Customers.csv")); }
public IActionResult ReporteXLS() { string WebRootPah = _hostingEnvironment.WebRootPath; string fileName = @"ReporteClientes.xlsx"; string URL = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, fileName); FileInfo file = new FileInfo(Path.Combine(WebRootPah, fileName)); var memoryStream = new MemoryStream(); using (var fs = new FileStream(Path.Combine(WebRootPah, fileName), FileMode.Create, FileAccess.Write)) { IWorkbook workBook = new XSSFWorkbook(); ISheet excelSheet = workBook.CreateSheet("Reportes"); IRow row = excelSheet.CreateRow(0); row.CreateCell(0).SetCellValue("CustomerId"); row.CreateCell(1).SetCellValue("FirstName"); row.CreateCell(2).SetCellValue("LastName"); row.CreateCell(3).SetCellValue("City"); List <Customer> listado = DACustomer.Listado(); int contador = 1; string firstName = string.Empty; foreach (var item in listado) { if (item.FirstName.Length > 100) { firstName = item.FirstName.Substring(0, 100); } else { firstName = item.FirstName; } row = excelSheet.CreateRow(contador); row.CreateCell(0).SetCellValue(item.Id); row.CreateCell(1).SetCellValue(firstName); row.CreateCell(2).SetCellValue(item.LastName); row.CreateCell(3).SetCellValue(item.City); contador++; } workBook.Write(fs); } using (var fs = new FileStream(Path.Combine(WebRootPah, fileName), FileMode.Open)) { fs.CopyTo(memoryStream); } memoryStream.Position = 0; return(File(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName)); }
override protected Boolean GetDataComboBox() { DACustomer daCustomer = new DACustomer(); sCustomerID.DataSource = daCustomer.USP_Customer_GetDataForComboBox(); sCustomerID.DataBind(); DAOrderStatus daOrderStatus = new DAOrderStatus(); sOrderStatus.DataSource = daOrderStatus.USP_OrderStatus_GetDataForComboBox(); sOrderStatus.DataBind(); return(true); }
public DataTable ViewProfile(string userid) { DataTable dt; DAUser DA = new DAUser(); dt = DA.GetUserTypeById(userid); if (dt.Rows.Count > 0) { if (Convert.ToInt32(dt.Rows[0]["USER_TYPE_ID"]) == (int)Enumaration.UserType.Student) { DACustomer DAC = new DACustomer(); DataTable customer = DAC.GetCustomer(dt.Rows[0]["ID"].ToString(), dt.Rows[0]["REFERENCE_TYPE_ID"].ToString()); dt = customer; } } return(dt); }
override protected Boolean LoadData() { try { // Load Data For Page. DACustomer daCustomer = new DACustomer(); daCustomer.USP_Customer_GetFullID(this.KeyID); // fCustomerName.Value = daCustomer.fCustomerName.ToString(); fCustomerGroupID.Value = daCustomer.fCustomerGroupID.ToString(); fCompany.Value = daCustomer.fCompany.ToString(); fEmail.Value = daCustomer.fEmail.ToString(); fPhone.Value = daCustomer.fPhone.ToString(); fAddress.Value = daCustomer.fAddress.ToString(); fProvinceID.Value = daCustomer.fProvinceID.ToString(); fBirthday.Value = daCustomer.fBirthday.ToString(); fSex.Value = daCustomer.fSex.ToString(); fSocialNetwork.Value = daCustomer.fSocialNetwork.ToString(); fUsername.Value = daCustomer.fUsername.ToString(); fPassword.Value = daCustomer.fPassword.ToString(); fNote.Value = daCustomer.fNote.ToString(); fSysDate.SelectedDate = daCustomer.fSysDate; // Load WishList LoadWishList(this.KeyID); LoadOrders(this.KeyID); // Khi cần enabled cột nào //if (this.KeyID > 0) //{ // if (mode != Act.Clone) // fUserName.Enabled = false; // else // fUserName.Text = ""; //} } catch (Exception e) { ShowErrorMes("Lỗi hệ thống: " + e.ToString()); return(false); } return(true); }
override protected int ExecInsert() { try { DACustomer DACustomer = CreateObjectFromPage(); if (this.mode == ActParam.New) { DACustomer.fID = DACustomer.USP_GetKey(); this.KeyID = DACustomer.fID; // --> Update new SessionID for continue edit. } else { DACustomer.fID = 0; } DACustomer.USP_Customer_Insert(); return(1); } catch { return(0); } }
public async Task <IActionResult> Index() { ViewBag.ListadoCliente = DACustomer.Listado(); ViewBag.ListadoProducto = DAProduct.Listado(); string tcEuro = String.Empty; using (var httpClient = new HttpClient()) { using (var respuesta = await httpClient.GetAsync("https://api.exchangeratesapi.io/latest?base=USD")) { string apiRespuesta = await respuesta.Content.ReadAsStringAsync(); tcEuro = (string )JObject.Parse(apiRespuesta)["rates"]["EUR"]; } } ViewBag.TipoCambioEUR = tcEuro; return(View()); }
/// <summary> /// creates a new invoice /// </summary> /// <returns> the new invoice</returns> public static Invoice NewInvoice() { //create a new invoice try { sConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= " + Directory.GetCurrentDirectory() + "\\ISystem.mdb"; using (OleDbConnection conn = new OleDbConnection(sConnectionString)) { using (OleDbDataAdapter adapter = new OleDbDataAdapter()) { conn.Open(); //create a UNK customer Customer tmpC = DACustomer.NewCustomer(); OleDbCommand command = new OleDbCommand("INSERT INTO INVOICE(CustomerNumber, InvoiceDate) " + "VALUES( ?, ?)", conn); command.Parameters.AddWithValue("CustomerNumber", tmpC.CUSTOMERNUMBER); command.Parameters.AddWithValue("InvoiceDate", DateTime.Today.ToShortDateString()); command.ExecuteNonQuery(); OleDbDataReader reader = null; command = new OleDbCommand("SELECT * FROM INVOICE " + "WHERE CustomerNumber = ? ", conn); command.Parameters.AddWithValue("CustomerNumber", tmpC.CUSTOMERNUMBER); reader = command.ExecuteReader(); reader.Read(); return(GetInvoice(reader[0].ToString())); } } } catch (Exception ex) { Exceptions.Spool(ex); return(null); } }
public IActionResult Grabar(int idCliente, string nombres, string apellidos, string pais, string ciudad, string telefono) { var customer = new Customer() { FirstName = nombres, LastName = apellidos, Country = pais, City = ciudad, Phone = telefono }; bool exito = true; if (idCliente == -1) { exito = DACustomer.Insertar(customer); } else { customer.Id = idCliente; exito = DACustomer.Actualizar(customer); } return(Json(exito)); }
private void LoadCustomerInfo(int CustomerID) { if (CustomerID == 0) { fCustomer.Value = ""; fEmail.Value = ""; fCustomerGroupID.Value = "0"; fPhone.Value = ""; fProvinceID.Value = "0"; } else { DACustomer daCustomer = new DACustomer(); daCustomer.USP_Customer_GetFullID(CustomerID); fCustomer.Value = daCustomer.fCustomerName; fEmail.Value = daCustomer.fEmail; fCustomerGroupID.Value = daCustomer.fCustomerGroupID.ToString(); fPhone.Value = daCustomer.fPhone; fProvinceID.Value = daCustomer.fProvinceID.ToString(); } // Control Input ControlCustomerInfo(CustomerID); }
public IActionResult Obtener(int idCliente) { var customer = DACustomer.Obtener(idCliente); return(Json(customer)); }
public IActionResult Eliminar(int idCliente) { bool exito = DACustomer.Eliminar(idCliente); return(Json(exito)); }
public async Task <IActionResult> Listado() { ViewBag.ListadoCliente = await DACustomer.ListadoAsync(); return(PartialView()); }
// AVANZA\jawwad.ahmed - 05/04/2017 11:21:59 public string GetNextServiceRegistrationNo() { string regNo = new DACustomer().GetNextServiceRegistrationNo(); return(regNo.PadLeft(8, '0')); }
public bool CheckIfUniqueRegistrationNo(string RegistrationNo) { DACustomer obj = new DACustomer(); return(obj.CheckIfUniqueRegistrationNo(RegistrationNo)); }
public DataSet GetCustomerDetails(string customerId, string customerServContrId) { DACustomer obj = new DACustomer(); return(obj.GetCustomerDetails(customerId, customerServContrId)); }
// Added by avanza\MUHAMMADUZAIR on 21/08/2017 14:39:50 public DataSet GetUserDataByUserId(string userId) { DACustomer obj = new DACustomer(); return(obj.GetUserDataByUserId(userId)); }
public Customer() { daCustomer = new DACustomer(); logger = Logger.getInstance(); }
public IActionResult Index() { ViewBag.ListadoCliente = DACustomer.Listado(); ViewBag.ListadoProducto = DAProduct.Listado(); return(View()); }
/// <summary> /// Create customer /// </summary> /// <param name="customer"></param> /// <returns>Message</returns> public string AddCustomer(Customer customer) { DACustomer daCustomer = new DACustomer(); return(daCustomer.AddCustomer(customer)); }
public IActionResult Listado() { ViewBag.ListadoClientes = DACustomer.Listado(); return(PartialView()); }
public IActionResult ListadoBusqueda(string city) { ViewBag.ListadoClientes = DACustomer.Listado(city); return(PartialView("Listado")); }