private void showData() { var customers = CustomerBLL.Search(pageIndex, pageSize, customerorderBy, sortOrder); dgCustomer.ItemsSource = customers.Items; pageCount = customers.PageCount; }
protected void Page_Load(object sender, EventArgs e) { if (Session["isLogin"] == null) { Response.Redirect("Login.aspx"); } UserAccount user = (UserAccount)Session["UserAccountObj"]; OrdersBLL odbll = new OrdersBLL(); txtTransactionID.Text = Request.QueryString["transactionid"].ToString(); Orders od = new Orders(); od = odbll.DoRetrieveOrderByTransactionId(txtTransactionID.Text); CustomerBLL cbll = new CustomerBLL(); Customer cust = cbll.DoRetrieveCustomerByID(od.CId); txtCustName.Text = cust.CName; txtDeliverAddress.Text = od.DeliverAddress; txtOrderStatus.Text = od.Status; txtCustContact.Text = od.ContactNo; txtTotalPayment.Text = (od.TotalCost + od.DeliveryFee).ToString(); DataTable dt = new DataTable(); OrderItemListBLL obll = new OrderItemListBLL(); dt = obll.DoRetrieveCustomerOrderItemByTransactionId(txtTransactionID.Text); if (dt != null) { gv_orderlist.DataSource = dt; gv_orderlist.DataBind(); } }
public ActionResult FetchCustomer(int id) { var customerBLL = new CustomerBLL(); Customer customerDetails = customerBLL.fetchCustomer(id); return(View(customerDetails)); }
protected void btnUpdate_Click(object sender, EventArgs e) { if (txtCName.Text.Length <= 0) { lblCNameMsg.Text = "Name cannot be blank"; } if (txtCName.Text.Length > 0) { UserAccount user = (UserAccount)Session["UserAccountObj"]; int custId = user.UserId; CustomerBLL cBLL = new CustomerBLL(); int result = cBLL.DoUpdateCustomer(custId, txtCName.Text); if (result > 0) { alertSuccess.Visible = true; } else { alertFailure.Visible = true; lblAlertMsg.Text = "Error in updating user profile"; } } }
protected void btnsubmit_Click(object sender, EventArgs e) { Customer cu = new Customer(); CustomerBLL cul = new CustomerBLL(); cu.Password = txtPassword.Text; cu.Name = txtName.Text; cu.Date_of_birth = DateTime.ParseExact(txtDob.Text, "yyyy-MM-dd", null); cu.Address = txtAddress.Text; cu.Contact_no = long.Parse(txtContactno.Text); cu.Email = txtEmail.Text; cu.City = DropDownList1.SelectedItem.Text; cu.State = DropDownList2.SelectedItem.Text; cu.Date_of_join = DateTime.ParseExact(txtDoj.Text, "yyyy-MM-dd", null); cu.Zipcode = long.Parse(txtZipCode.Text); if (cul.Save(cu)) { lbMessage.Text = "Successfully!!"; txtCustomerRegid.Text = cul.getMaxLoginid().ToString(); } else { lbMessage.Text = "Fail!!"; } }
public dynamic Login() { string name = Fun.Query("name"); string password = Fun.Query("password"); LoginBLL bll = new LoginBLL(); S_UserInfo user = bll.Login(name, password); if (user == null) { return("失败"); } UserInfo u = new UserInfo(); u.id = user.user_id; u.name = user.user_name.Trim(); ManagerBLL m = new ManagerBLL(); S_ManagerInfo manager = m.GetManagerByLoginId(user.user_id); if (manager != null) { return(new { data = u, manager = manager }); } else { CustomerBLL c = new CustomerBLL(); C_CustomerInfo customer = c.GetCustomerByLoginId(user.user_id); return(new { data = u, customer = customer }); } }
public void showData() { var customers = CustomerBLL.Search(pageIndex, pageSize, sortBy, sortOrder, keyword); dgCustomers.ItemsSource = customers.Items; pageCount = customers.PageCount; }
public CustomerBLL CustomerIdentity(PointsBLL id) { CustomerBLL cb = new CustomerBLL(); SqlConnection con = new SqlConnection(myconnstring); string sql = "SELECT cust_id from Customers WHERE id='" + id + "' "; try { con.Open(); SqlDataAdapter da = new SqlDataAdapter(sql, con); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { cb.cust_id = int.Parse(dt.Rows[0]["cust_id"].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } return(cb); }
public string CustomerIDandPointsAvailable(string customerID, string value) { CustomerBLL cb = new CustomerBLL(); SqlConnection con = new SqlConnection(myconnstring); string sql = "SELECT * from Customers WHERE CustomerID= '" + customerID + "' "; try { con.Open(); SqlCommand cmd = new SqlCommand(sql, con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { value = dr[6].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } return(value); }
// GET: Master/Customer public async Task <IActionResult> GetCustomer() { try { if (_cache.TryGetValue("CACHE_MASTER_CUSTOMER", out List <M_Customer> c_lstCust)) { return(Json(new { data = c_lstCust })); } MemoryCacheEntryOptions options = new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300), SlidingExpiration = TimeSpan.FromSeconds(60), Priority = CacheItemPriority.NeverRemove }; using (var custBll = new CustomerBLL()) { var lstCust = await custBll.GetCustomer(null); _cache.Set("CACHE_MASTER_CUSTOMER", lstCust, options); return(Json(new { data = lstCust })); } } catch (Exception ex) { return(BadRequest(new { success = false, message = ex.Message })); } //using (var custBll = new CustomerBLL()) //{ // return Json(new { data = await custBll.GetCustomer(null) }); //} }
public bool Delete(CustomerBLL c) { bool isSuccess = false; SqlConnection con = new SqlConnection(myconnstring); try { string sql = "DELETE FROM Customers WHERE cust_id=@id"; SqlCommand cmd = new SqlCommand(sql, con); cmd.Parameters.AddWithValue("@id", c.cust_id); con.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { isSuccess = true; } else { isSuccess = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } return(isSuccess); }
public async Task <IActionResult> UploadModelData(List <M_Customer> lstCust) { var uId = await base.CurrentUserId(); lstCust.ForEach(m => { m.Created_By = uId; }); try { using (var custBll = new CustomerBLL()) { var rowaffected = await custBll.BulkInsertCustomer(lstCust); _cache.Remove("CACHE_MASTER_CUSTOMER"); } return(Json(new { success = true, data = lstCust, message = "Import Success." })); } catch (Exception ex) { return(Json(new { success = true, data = lstCust, message = ex.Message })); } }
public async Task <IActionResult> Edit([Bind("CustomerCode,CustomerName,AddressL1,AddressL2,AddressL3,AddressL4,Telephone,Fax,CustomerEmail,CustomerContact,CreditTerm,PriceLevel,CustomerTaxId,Remark,CompanyCode,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_Customer m_Customer) { try { if (ModelState.IsValid) { m_Customer.Updated_By = await base.CurrentUserId(); ResultObject resultObj; try { using (var custBll = new CustomerBLL()) { resultObj = await custBll.UpdateCustomer(m_Customer); _cache.Remove("CACHE_MASTER_CUSTOMER"); } return(Json(new { success = true, data = (M_Customer)resultObj.ObjectValue, message = "Customer Update." })); } catch (Exception ex) { return(Json(new { success = false, data = m_Customer, message = ex.Message })); } } var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList(); return(Json(new { success = false, errors = err, data = m_Customer, message = "Update Failed" })); } catch (Exception ex) { return(BadRequest(new { success = false, message = ex.Message })); } }
public JsonResult SaveOrUpdateCustomer(string Name, string PhoneNumber, string Address1, string Address2, string City, string State, string Zip, string EmployeeId, string Custormer_UID) { CustomerBLL customerBLL = new CustomerBLL(); Response _response = new Response(); try { CustomerDTO customerDTO = new CustomerDTO(); customerDTO.Name = Name; customerDTO.PhoneNumber = PhoneNumber; customerDTO.Address1 = Address1; customerDTO.Address2 = Address2; customerDTO.City = City; customerDTO.State = State; customerDTO.Zip = Zip; customerDTO.EmployeeID = Convert.ToInt32(EmployeeId); customerDTO.CustormerUID = Custormer_UID; _response = customerBLL.AddOrEditCustomer(customerDTO); } catch (Exception) { } return(Json(_response, JsonRequestBehavior.AllowGet)); }
public ResponseInfo <Model.Customer> Register(Customer customer) { ResponseInfo <Model.Customer> response = new ResponseInfo <Customer>(); if (customer == null) { return(response); } bool result = CustomerBLL.Register(customer); if (result) { Model.Customer customerDetail = CustomerBLL.GetCustomerDetail(customer); response.Code = 1; response.Value = customerDetail; } else { response.Code = -1; response.Message = "注册用户已存在"; } return(response); }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.textBox1.Text) || String.IsNullOrEmpty(this.textBox2.Text) || String.IsNullOrEmpty(this.textBox3.Text) || String.IsNullOrEmpty(this.textBox4.Text) || String.IsNullOrEmpty(this.textBox5.Text)) { MessageBox.Show("Please Enter Valid Record!!!"); } else { Customer customer = new Customer(); customer.FullName = this.textBox1.Text; customer.CNIC = this.textBox2.Text; customer.Address = this.textBox3.Text; customer.MobileNo = this.textBox4.Text; customer.Remarks = this.textBox5.Text; customer.Measurements = this.listBox1.SelectedItem.ToString(); CustomerBLL cbll = new CustomerBLL(); try { if (cbll.insertCustomer(customer)) { MessageBox.Show("Customer Successfully Added!!!!!"); } else { MessageBox.Show("Failed To Add!!!!"); } } catch (Exception ex) { throw ex; } } }
public ResponseInfo <Model.Customer> Login(Customer customer) { ResponseInfo <Model.Customer> response = new ResponseInfo <Customer>(); if (customer == null) { return(response); } bool result = CustomerBLL.Login(customer); if (result) { Model.Customer customerDetail = CustomerBLL.GetCustomerDetail(customer); response.Code = 1; response.Value = customerDetail; } else { response.Code = -1; response.Message = "用户名或密码错误"; } return(response); }
private void button3_Click(object sender, EventArgs e) { CustomerDelete del = new CustomerDelete(); del.ShowDialog(); if (del.select) { Customer customer = new Customer(); customer.CNIC = del.selectedCustomer1.CNIC; customer.FullName = del.selectedCustomer1.FullName; CustomerBLL cbll = new CustomerBLL(); try { if (cbll.delCustomer(customer)) { MessageBox.Show("successfully deleted!!!"); } else { MessageBox.Show("Unsucessful........ deletion failed!!!"); } } catch (Exception ex) { throw ex; } } }
/// <summary> /// 客户下单时提醒 /// </summary> /// <param name="context"></param> public void CustomerTip(HttpContext context) { var customerId = context.Request["customerId"]; if (string.IsNullOrEmpty(customerId)) { context.Response.Write("0"); return; } var customerModel = new CustomerBLL().SelectCustomerBaseByID(int.Parse(customerId)); var customerName = customerModel.Rows[0]["CA01003"].ToString(); var html = "<p style='margin: 20px 0 10px 20px;text-align:center;'>" + customerName + "</p>"; //查询客户是否黑名单 var balckList = customerModel.Rows[0]["CA01052"].ToString(); html += "<p style='margin: 20px 0 10px 20px;'>黑名单:" + "<span style='color:red;margin-right:30%'>" + (balckList == "0" ? "否" : "是") + "</span>"; //未提货订单 int count = new OrderBLL().GetFailDelivery(int.Parse(customerId)); html += "未提货订单:" + "<span style='color:red;'>" + (count > 0 ? "是" : "否") + "</span></p>"; //信用金额 var ca01014 = customerModel.Rows[0]["CA01014"].ToString() == "" ? 0 : Convert.ToInt32(customerModel.Rows[0]["CA01014"].ToString()); var ca01015 = customerModel.Rows[0]["CA01015"].ToString() == "" ? 0 : Convert.ToDecimal(customerModel.Rows[0]["CA01015"]); var deliveredAmount = new OrderBLL().GetDeliveredAmount(int.Parse(customerId)); var ob01009 = deliveredAmount.Rows[0]["OP01016"].ToString() == "" ? 0 : Convert.ToDecimal(deliveredAmount.Rows[0]["OP01016"]); var debtsDays = deliveredAmount.Rows[0]["DebtsDays"].ToString() == "" ? 0 : Convert.ToInt32(deliveredAmount.Rows[0]["DebtsDays"]); html += "<p style='margin: 20px 0 10px 20px;'>信用金额:<span style='color:red;'>" + Math.Round((ca01015), 2) + "</span>,信用天数:<span style='color:red;'>" + ca01014 + "</span>,"; html += "剩余信用金额:<span style='color:red;'>" + Math.Round((ca01015 - ob01009), 2) + "</span>,剩余信用天数:<span style='color:red;'>" + (ca01014 - debtsDays) + "</span></p>"; //欠款金额 html += "<p style='margin: 20px 0 10px 20px;'>欠款总金额:<span style='color:red;'>" + Convert.ToDouble(deliveredAmount.Rows[0]["OP01016"]) + "</span>,欠款最长天数:" + "<span style='color:red;'>" + deliveredAmount.Rows[0]["DebtsDays"] + "</span></p>"; context.Response.Write(html); }
protected void BtnGetCustomer_Click(object sender, EventArgs e) { Customer cusObj = CustomerBLL.GetCustomer(tbCustId.Text); if (cusObj != null) { PanelErrorResult.Visible = false; PanelCust.Visible = true; Lbl_custname.Text = cusObj.Name; Lbl_Address.Text = cusObj.Address; Lbl_HomePhone.Text = cusObj.HomePhone; Lbl_Mobile.Text = cusObj.Mobile; Lbl_err.Text = string.Empty; HyplinkAdd.Visible = true; Session["SScustId"] = tbCustId.Text; Session["SScustName"] = cusObj.Name; } else { Lbl_err.Text = "Customer record not found!"; PanelErrorResult.Visible = true; PanelCust.Visible = false; Lbl_custname.Text = string.Empty; Lbl_Address.Text = string.Empty; Lbl_HomePhone.Text = string.Empty; Lbl_Mobile.Text = string.Empty; HyplinkAdd.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["isLogin"] == null) { Response.Redirect("Login.aspx"); } alertSuccess.Visible = false; alertFailure.Visible = false; panelChangePassword.Visible = false; if (!IsPostBack) { UserAccount user = (UserAccount)Session["UserAccountObj"]; txtCUsername.Text = user.Username; CustomerBLL cBLL = new CustomerBLL(); Customer customer = cBLL.DoRetrieveCustomerByID(user.UserId); if (customer != null) { txtCName.Text = customer.CName; txtRewardPoint.Text = customer.RewardPoint.ToString(); } else { alertFailure.Visible = true; lblAlertMsg.Text = "Unable to retrieve user profile"; } } }
public bool cashTransfer() { CustomerBLL bll = new CustomerBLL(); int transferTo = -2; decimal requestedAmount = 0; Transaction transaction = null; inputRequestedAmount: try { ATMInterface.changeTextColor(Color.Gray); Write("\nEnter amount in multiples of 500: "); ATMInterface.changeTextColor(Color.Green); requestedAmount = decimal.Parse(ReadLine()); ATMInterface.changeTextColor(Color.Gray); Account account = bll.getAccount(customer.accountNo); if (requestedAmount < 0 || requestedAmount % 500 != 0 || requestedAmount > account.Balance) { throw new Exception($"Amount should not be neagitive and Sould " + $"be multipiles of 500 and should be less than you current account balance i.e {account.Balance}"); } Write("\nEnter the account number to which you want to transfer: "); ATMInterface.changeTextColor(Color.Green); transferTo = int.Parse(ReadLine()); ATMInterface.changeTextColor(Color.Gray); if (transferTo == customer.accountNo) { throw new Exception("You cannot transfer to yourself"); } Person personTo = bll.getPerson(transferTo); if (personTo == null) { throw new Exception("Account did not found"); } Write($"\nYou wish to deposit Rs {requestedAmount} in account held by {personTo.Name};" + $" If this information is correct please re - enter the account number: "); ATMInterface.changeTextColor(Color.Green); transferTo = int.Parse(ReadLine()); ATMInterface.changeTextColor(Color.Gray); if (transferTo == personTo.accountNo) { transaction = bll.transferAmount(requestedAmount, customer.accountNo, personTo.accountNo); if (transaction != null) { WriteLine("Transaction confirmed."); printRecepit(transaction, account.ID); delay(); return(true); } } } catch (Exception ex) { errorMessage(ex.Message); goto inputRequestedAmount; } errorMessage("Transaction unsuccessfull!"); delay(); return(true); }
public dynamic GetSourceList() { CustomerBLL c = new CustomerBLL(); List <C_CustomerSource> list = c.GetSourceList(); return(list); }
public bool normalCash() { Clear(); decimal requestedAmount = 0; inputRequestedAmount: try { Write("\nEnter the withdrawal amount: "); ATMInterface.changeTextColor(Color.Green); requestedAmount = decimal.Parse(ReadLine()); ATMInterface.changeTextColor(Color.Gray); } catch (Exception ex) { errorMessage(ex.Message); goto inputRequestedAmount; } CustomerBLL bll = new CustomerBLL(); Transaction transaction = bll.withDraw(requestedAmount, customer.accountNo); ATMInterface.changeTextColor(Color.Gray); if (transaction != null) { WriteLine("\nCash Successfully Withdrawn!"); printRecepit(transaction, customer.accountNo); delay(); return(true); } errorMessage("\nCashDrawn unsuccesfull!"); delay(); return(true); }
public bool DeleteCustomer(CustomerBLL u) { bool isSuccess = false; SqlConnection con = new SqlConnection(myconnection); try { string sql = "Delete FROM tbl_customer WHERE Id=@customer_id"; SqlCommand cmd = new SqlCommand(sql, con); cmd.Parameters.AddWithValue("@customer_id", u.id); con.Open(); int rows = cmd.ExecuteNonQuery(); // if the Query is Excuted then the value of the rows will be greater thean zero if (rows > 0) { isSuccess = true; } else { isSuccess = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } return(isSuccess); }
public UC_Customer_Default() { customerBLL = new CustomerBLL(); InitializeComponent(); dgvCustomer.AutoGenerateColumns = false; dgvCustomer.ColumnCount = 6; dgvCustomer.Columns[0].HeaderText = "First Name"; dgvCustomer.Columns[0].DataPropertyName = "firstName"; dgvCustomer.Columns[1].HeaderText = "Last Name"; dgvCustomer.Columns[1].DataPropertyName = "lastName"; dgvCustomer.Columns[2].HeaderText = "Phone"; dgvCustomer.Columns[2].DataPropertyName = "phone"; dgvCustomer.Columns[3].HeaderText = "Email"; dgvCustomer.Columns[3].DataPropertyName = "email"; dgvCustomer.Columns[4].HeaderText = "Address"; dgvCustomer.Columns[4].DataPropertyName = "address"; dgvCustomer.Columns[5].HeaderText = "Female"; dgvCustomer.Columns[5].DataPropertyName = "isFemale"; dgvCustomer.DataSource = listCustomers; LoadCustomer(); }
public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { CustomerBLL CustomerBLLObj = new CustomerBLL(); if (string.IsNullOrEmpty(context.UserName) || CustomerBLLObj.Query <object>(context.UserName).FirstOrDefault() == null) { context.SetError("invalid_grant", "The user name or password is incorrect."); return(Task.FromResult <object>(null)); } ; var identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName)); identity.AddClaim(new Claim(ClaimTypes.Role, "user")); identity.AddClaim(new Claim("sub", context.UserName)); var props = new AuthenticationProperties(new Dictionary <string, string> { { "as:client_id", context.ClientId ?? string.Empty }, { "userName", context.UserName } }); var ticket = new AuthenticationTicket(identity, props); context.Validated(ticket); return(Task.FromResult <object>(null)); }
public UCCustomer_Add(Form_Restaurant form, DataGridView data) { datagrid = data; customerBLL = new CustomerBLL(); mainform = form; InitializeComponent(); }
// GET: Customer public ActionResult DisplayCustomers() { var customerBLL = new CustomerBLL(); List <Customer> displayAllCustomers = customerBLL.getAll(); return(View(displayAllCustomers)); }
// thanh toán protected void btnThanhToan_Click(object sender, EventArgs e) { CustomerBLL b1 = new CustomerBLL(); b1.Insert(txtNameCus.Text, txtAddressCus.Text, txtPhoneCus.Text); string id_cus = b1.getByIdJustCreated()[0].Id; BillBLL b2 = new BillBLL(); b2.Insert(id_cus, DateTime.Parse(txtDateDelivery.Text), Int32.Parse("1")); string id_bill = b2.getByIdJustCreated()[0].Id; BillDetailsBLL b3 = new BillDetailsBLL(); DataTable cart = (DataTable)Session["cart"]; foreach (DataRow r in cart.Rows) { string id_pro = r[0].ToString(); int price = Int32.Parse(r[2].ToString()); int qty = Int32.Parse(r[3].ToString()); int discount = Int32.Parse(txtDiscount.Text); int amount = price * qty - price * discount / 100; ProductBLL b4 = new ProductBLL(); int qty_pro = b4.getById(id_pro)[0].Qty; // lấy giá trị số lượng tồn b3.Insert(id_bill, id_pro, qty_pro, qty, price, discount, amount); } for (int i = 0; i < gv_Cart.Rows.Count; i++) { gv_Cart.DeleteRow(i); } Session.Contents.Remove("cart"); }