public ActionResult CustomerDetail() { var customer = new CustomerDao().ListAll(); ViewBag.Customer = customer; return(View(customer)); }
public ActionResult Login(LoginModel model) { if (ModelState.IsValid) { var dao = new CustomerDao(); var result = dao.Login(model.name, (model.password0)); if (result == 1) { var user = dao.GetById(model.name); var userSession = new UserLogin(); userSession.UserName = user.name; userSession.UserID = user.customer_id; Session.Add(CommonConstants.USER_SESSION, userSession); return(Redirect("/")); } else if (result == 0) { ModelState.AddModelError("", "Tài khoản không tồn tại."); } else if (result == 2) { ModelState.AddModelError("", "Mật khẩu không đúng."); } else { ModelState.AddModelError("", "đăng nhập không đúng."); } } return(View(model)); }
public ActionResult Login(string email, string password) { if (Membership.ValidateUser(email, password)) { FormsAuthentication.SetAuthCookie(email, false); if (email.Contains("@alkoshop.com")) { EmployeeDao employeeDao = new EmployeeDao(); DataAccess.Model.Employee employee = employeeDao.GetByEmailAndPassword(email, password); Session["User"] = employee; Session["UserRole"] = "Employee"; } else { CustomerDao customerDao = new CustomerDao(); DataAccess.Model.Customer customer = customerDao.GetByEmailAndPassword(email, password); Session["User"] = customer; Session["UserRole"] = "Customer"; } return(RedirectToAction("Index", "Home", new { area = Session["UserRole"] })); } TempData["login-error"] = "Login nebo heslo není správné"; return(RedirectToAction("Index", "Login")); }
private void 全部数据清空ToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("数据将全部被清除,建议先备份数据文件后再清除,是否备份?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { 导出数据文件ToolStripMenuItem_Click(null, null); } else if (result == DialogResult.No) { if (MessageBox.Show("现有数据将全部被清除,是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } else { CustomerDao.getInstance().ClearAllArrear(); PayReceiptDao.getInstance().DeleteAll(); ProductStainlessCirculationDao.getInstance().DeleteAll(); SellProfitDao.getInstance().DeleteAll(); ProductStainlessDao.getInstance().ClearAllNumAndCost(); MessageBox.Show("删除清空数据成功,系统将自动关闭,请重新启动软件!", "提示", MessageBoxButtons.OK); this.Close(); } } }
/// <summary> /// event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton3_Click(object sender, EventArgs e) { Customer customer = null; if (this.getCustomer(out customer) == false) { return; } //double arrearDif = 0; if (openMode == 0) { int customerId; bool insertResult = CustomerDao.getInstance().Insert(customer, out customerId); if (customer.arrear != 0 && insertResult == true) { generatePayReceipt(customer.arrear, 0, customerId); } MessageBox.Show("保存来往单位成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (openMode == 1) { double previousArrear = CustomerDao.getInstance().FindByID(this.customerID).arrear; CustomerDao.getInstance().Update(customer); if (customer.arrear != previousArrear) { generatePayReceipt(customer.arrear - previousArrear, previousArrear, this.customerID); } MessageBox.Show("修改来往单位成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.invokeUpdateNotify(UpdateType.CustomerUpdate); this.Close(); }
private void lookupText1_valueSetted(object sender, LookupArg arg) { Customer customer = CustomerDao.getInstance().FindByID((int)arg.Value); this.textBox_previousArrears.Text = (customer.arrear * conf.arrearDirection).ToString(); resetNeedSave(true); }
public ActionResult GetListCustomer(string keywork) { var res = new CustomerDao().GetDataCustomer(keywork); List <CustomerModel> model = new List <CustomerModel>(); foreach (var item in res) { model.Add(new CustomerModel { MAKH = item.MAKHACHHANG, //MANHOMNGUOIDUNG= item.MANHOMNGUOIDUNG, HOKH = item.HOKHACHHANG, TENKH = item.TENKHACHHANG, EMAIL = item.EMAIL, DIENTHOAI = item.DIENTHOAI, QUOCGIA = item.QUOCGIA, THANHPHO = item.THANHPHO, QUAN = item.QUAN, PHUONG = item.PHUONG, DIACHI = item.DIACHI, USERNAME = item.TENDANGNHAPKHACHHANG, PASSWORD = item.MATKHAUKHACHHANG, NGAYTAO = item.NGAYTAO }); } return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult Detail(int id) { var dao = new CustomerDao(); var model = dao.Viewdetail(id); return(View(model)); }
public bool Delete(CustomerQueryForm form) { CustomerDao dao = new CustomerDao(); dao.Delete(form); return(true); }
public List <Customer> Query(CustomerQueryForm form) { CustomerDao dao = new CustomerDao(); form.IsDeleted = 0; return(dao.Query(form)); }
public ActionResult Index(string name, string password) { LoginDao login_dao = new LoginDao(); if (login_dao.Login(name, password) == 1) { EmployeeDao employee_dao = new EmployeeDao(); UserLogin userlogin = new UserLogin(); userlogin.Type = 1; userlogin.ID = employee_dao.GetIDByLogin(name); userlogin.Login = name; userlogin.Name = employee_dao.GetNameByID(userlogin.ID); userlogin.GroupEmployeeID = employee_dao.GetGroupEmployeeIDByLogin(name); Session["UserLogin"] = userlogin; return(RedirectToAction("Blank", "Blank", new { Area = "Admin" })); } else if (login_dao.Login(name, password) == 2) { CustomerDao cus_dao = new CustomerDao(); UserLogin userlogin = new UserLogin(); userlogin.Type = 2; userlogin.ID = cus_dao.GetIDByLogin(name); userlogin.Login = name; userlogin.Name = cus_dao.GetNameByID(userlogin.ID); Session["UserLogin"] = userlogin; return(RedirectToAction("HomePage", "HomePage")); } else { ModelState.AddModelError("loitaikhoan", "Tài khoản hoặc mật khẩu không chính xác"); } return(View("Index")); }
/// <summary> /// 流水号失去焦点后,如果用户输入了流水号,则根据输入的流水号进行查找,否则生成流水号 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void serial_Leave(object sender, EventArgs e) { if (this.serial.ReadOnly || this.serial.Text.Length != 11) { return; } vehicle = VehicleDao.GetBySerial(this.serial.Text);; if (vehicle != null) { this.setControlReadOnly(false); InitComboBox(); SetVehicleInfo(vehicle); this.SetOriginCustomer(CustomerDao.GetById(vehicle.OriginCustomer.UserId)); this.SetCurrentCustomer(CustomerDao.GetById(vehicle.CurrentCustomer.UserId)); } else { MessageBox.Show("无此数据:流水号" + this.serial.Text); this.serial.Focus(); this.serial.Text = VehicleDao.GetCurrentDate(); this.serial.Select(this.serial.Text.Length, 0); } }
protected virtual void statisticCustomer() { itemsTable = CustomerDao.getInstance().FindListForStatistic(null); itemsTable.Columns.Add("purchase"); itemsTable.Columns.Add("purchaseBack"); itemsTable.Columns.Add("sell"); itemsTable.Columns.Add("sellBack"); foreach (DataRow dr in itemsTable.Rows) { int customerID = (int)dr["ID"]; double totalNum = 0; double sum; this.getSum(this.dateTimePicker3.Value, this.dateTimePicker4.Value, 1, 0, customerID, out totalNum, out sum); dr["purchase"] = totalNum == 0 && sum == 0 ? "" : string.Format("{0}/{1:0.00}", totalNum, sum); this.getSum(this.dateTimePicker3.Value, this.dateTimePicker4.Value, 2, 0, customerID, out totalNum, out sum); dr["purchaseBack"] = totalNum == 0 && sum == 0?"":string.Format("{0}/{1:0.00}", totalNum, sum); this.getSum(this.dateTimePicker3.Value, this.dateTimePicker4.Value, 3, 0, customerID, out totalNum, out sum); dr["sell"] = totalNum == 0 && sum == 0 ? "" : string.Format("{0}/{1:0.00}", totalNum, sum); this.getSum(this.dateTimePicker3.Value, this.dateTimePicker4.Value, 4, 0, customerID, out totalNum, out sum); dr["sellBack"] = totalNum == 0 && sum == 0 ? "" : string.Format("{0}/{1:0.00}", totalNum, sum); } }
public void ProcessCustomer(string customerId) { //Find all orders for customer Customer customer = CustomerDao.Get(customerId); foreach (Order order in customer.Orders) { if (order.ShippedDate.HasValue) { log.Warn("Order with " + order.Id + " has already been shipped, skipping."); continue; } //Validate Order Validate(order); log.Info("Order " + order.Id + " validated, proceeding with shipping.."); //Ship with external shipping service ShippingService.ShipOrder(order); //Update shipping date order.ShippedDate = DateTime.Now; //Update shipment date OrderDao.Update(order); //Other operations...Decrease product quantity... etc } }
public List <FullTask> Query(QueryMyTaskServiceForm form) { ISqlMapper mapper = Common.GetMapperFromSession(); FullTaskDao dao = new FullTaskDao(mapper); WorkflowDao wfdao = new WorkflowDao(mapper); Customer_ProjectDao cpdao = new Customer_ProjectDao(mapper); CustomerDao customerdao = new CustomerDao(mapper); var tasks = dao.QueryTaskByRelationship(form); var workflowids = (from t in tasks select t.WorkflowID).ToList(); var workflows = wfdao.Query(new WorkflowQueryForm { IDs = workflowids }); var projectids = (from w in workflows select w.ProcessID).ToList(); var cps = cpdao.Query(new Customer_ProjectQueryForm { ProjectIDs = projectids }); var customerids = (from cp in cps select cp.CustomerID).ToList(); var customers = customerdao.Query(new CustomerQueryForm { IDs = customerids }); foreach (var task in tasks) { var customername = (from cp in cps join c in customers on cp.CustomerID equals c.ID join w in workflows on cp.ProjectID equals w.ProcessID where w.ID.Equals(task.WorkflowID) && (cp.Type == 1 || cp.Type == 2) select c.Name.Trim()).ToList(); task.Title = String.Join(",", customername); } return(tasks); }
public JsonResult DeleteAll() { if (Session[OnlineShop.Common.CommonConstants.USER_SESSION] != null) { var customerSession = (OnlineShop.Common.UserLogin)Session[OnlineShop.Common.CommonConstants.USER_SESSION]; var customer = new CustomerDao().GetCustomerById(Convert.ToInt32(customerSession.UserId)); var shoppingCartItemDao = new ShoppingCartItemDao(); foreach (var item in customer.ShoppingCartItems) { if (item.ShoppingCartTypeId == (int)ShoppingCartType.Wishlist) { shoppingCartItemDao.DeleteShoppingCartItem(item.Id); } } return(Json(new { Status = true })); } else { Session[WishListSession] = null; return(Json(new { Status = true })); } }
public ActionResult MobileFlyoutWrapper() { if (Session[OnlineShop.Common.CommonConstants.USER_SESSION] != null) { var customerSession = (OnlineShop.Common.UserLogin)Session[OnlineShop.Common.CommonConstants.USER_SESSION]; var customer = new CustomerDao().GetCustomerById(Convert.ToInt32(customerSession.UserId)); var listShoppingCart = new List <ShoppingCartItemModel>(); foreach (var item in customer.ShoppingCartItems) { if (item.ShoppingCartTypeId == 1) { var shoppingCartItem = new ShoppingCartItemModel(); shoppingCartItem.Product = item.Product; shoppingCartItem.Quantity = item.Quantity; shoppingCartItem.ShoppingCartTypeId = item.ShoppingCartTypeId; listShoppingCart.Add(shoppingCartItem); } } return(PartialView(listShoppingCart)); } else { var shoppingCart = Session[OnlineShop.Common.CommonConstants.ShoppingCartSession]; var listShoppingCart = new List <ShoppingCartItemModel>(); if (shoppingCart != null) { listShoppingCart = (List <ShoppingCartItemModel>)shoppingCart; } return(PartialView(listShoppingCart)); } }
public ActionResult UserProfile() { var session = (UserLogin)Session[BookShop.Common.CommonConstants.USER_SESSION]; var dao = new CustomerDao(); var userProfile = new UserProfile(); try { var currentUser = dao.GetById(session.UserName); userProfile.UserName = currentUser.UserName; userProfile.Name = currentUser.Name; userProfile.OldPassword = currentUser.Password; userProfile.Phone = currentUser.Phone; userProfile.Email = currentUser.Email; userProfile.Address = currentUser.Address; return(View(new UserProfile { UserName = userProfile.UserName, Name = userProfile.Name, Phone = userProfile.Phone, Email = userProfile.Email, Address = userProfile.Address })); }catch (Exception e) { return(View()); } }
public void BindCustomers() { List <Customer> customers = new CustomerDao().GetCustomers(null, null, 1, 1000); this.Customers = customers; cbCustomer.DataSource = customers; }
public ActionResult Create(khachhang kh) { if (ModelState.IsValid) { var dao = new CustomerDao(); /* if (dao.CheckUserName(kh.KH_DIACHILAPDAT)) * { * ModelState.AddModelError("", "Khách hàng đã tồn tại"); * }*/ /*else * {*/ long id = dao.InsertKH(kh); if (id > 0) { //SetAlert("Thêm user thành công", "success"); return(RedirectToAction("Index", "Customer")); } else { ModelState.AddModelError("", "Thêm khách hàng không thành công"); } //} } return(RedirectToAction("Index", "Customer")); }
public LetterSettingForm(ProductCirculation c, string p) { InitializeComponent(); cir = c; pieces = p; this.textBox_timeFormat.Text = ConfDao.getInstance().Get(12); if (string.IsNullOrEmpty(this.textBox_timeFormat.Text) || this.textBox_timeFormat.Text == "0") { resetTime(); } if (cir.CustomerID != 0) { Customer customer = CustomerDao.getInstance().FindByID(cir.CustomerID); this.textBox_name.Text = customer.Name; this.textBox_address.Text = customer.Address; this.textBox_tel.Text = customer.Contract; this.textBox_contractor.Text = ConfDao.getInstance().Get(5); this.textBox_contractorPhone.Text = ConfUtility.getContract(); } this.textBox_pieces.Text = pieces; try { this.textBox_time.Text = cir.CirculationTime.ToString(this.textBox_timeFormat.Text); } catch { resetTime(); this.textBox_time.Text = cir.CirculationTime.ToString(this.textBox_timeFormat.Text); } this.textBox_comment.Text = cir.Comment; }
private void Save() { if (Helpers.CheckEmpty(errorProvider1, txtCustomerName, txtGender, txtAddress, lblOtherContact)) { return; } else { SaveCompleted = true; errorProvider1.Clear(); //string text = StringCipher.Encrypt CustomerEntity customerEntity = new CustomerEntity(); customerEntity.CustomerName = txtCustomerName.Text; customerEntity.Gender = txtGender.Text; customerEntity.Address = txtAddress.Text; customerEntity.Photo = picCustomer.GetByteArrayFromBrowse(); customerEntity.Active = chkActive.Checked; customerEntity.MemberShipID = (Guid)cboMemberShip.SelectedValue; customerEntity.OtherContact = txtOtherContact.Text; if (CustomerID != Guid.Empty) { customerEntity.ID = CustomerID; customerEntity.Update(USER.UserName); CustomerDao.Update(customerEntity); } else { customerEntity.ID = Guid.NewGuid(); customerEntity.Create(USER.UserName); CustomerDao.Insert(customerEntity); } } }
public ActionResult Edit(int ma) { dao = new CustomerDao(); Customer customer = dao.FindCustomer(ma); return(View(customer)); }
public JsonResult Delete(long Id) { if (Session[OnlineShop.Common.CommonConstants.USER_SESSION] != null) { var customerSession = (OnlineShop.Common.UserLogin)Session[OnlineShop.Common.CommonConstants.USER_SESSION]; var customer = new CustomerDao().GetCustomerById(Convert.ToInt32(customerSession.UserId)); var shoppingCartItemDao = new ShoppingCartItemDao(); foreach (var item in customer.ShoppingCartItems) { if (item.ShoppingCartTypeId == (int)ShoppingCartType.Wishlist && item.ProductId == Id) { shoppingCartItemDao.DeleteShoppingCartItem(item.Id); } } return(Json(new { Status = true })); } else { var shoppingCart = (List <ShoppingCartItemModel>)Session[WishListSession]; shoppingCart.RemoveAll(x => x.Product.Id == Id && x.ShoppingCartTypeId == 2); Session[WishListSession] = shoppingCart; return(Json(new { Status = true })); } }
public ActionResult Delete(int?id) { CustomerDao dao = new CustomerDao(); dao.Delete(id); return(RedirectToAction("Index")); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private bool saveInfo() { vehicle = VehicleDao.GetBySerial(this.serial.Text); this.ValidateChildren(ValidationConstraints.Enabled & ValidationConstraints.TabStop & ValidationConstraints.Selectable); if (!ValidatorManager.ValidateControls(this)) { MessageBox.Show("控件内容不合法"); return(false); } Customer originInfo = GetOriginCustomer(); Customer currentInfo = GetCurrentCustomer(); vehicle = GetVehicleInfo(); try { originInfo.Id = vehicle.OriginCustomer.Id; currentInfo.Id = vehicle.CurrentCustomer.Id; CustomerDao.Update(originInfo); CustomerDao.Update(currentInfo); vehicle.OriginCustomer = originInfo; vehicle.CurrentCustomer = currentInfo; VehicleDao.UpdateVehicle(vehicle); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } return(true); }
public string Add(Customer customer) { CustomerDao dao = new CustomerDao(); customer.Enabled = 1; customer.IsDeleted = 0; return dao.Add(customer); }
public List<FullHouse> Query(QueryHouseServiceForm form) { //form.OwnerID = ""; List<FullHouse> list = new List<FullHouse>(); ISqlMapper mapper = MapperHelper.GetMapper(); HouseDao dao = new HouseDao(mapper); House_CustomerDao hcdao = new House_CustomerDao(mapper); CustomerDao customerdao = new CustomerDao(mapper); BuildingDao buildingdao = new BuildingDao(mapper); var house = dao.QueryFullHouse(form); var houseids = (from h in house select h.ID).ToList(); var hos = hcdao.Query(new House_CustomerQueryForm { HouseOrRoomIDs = houseids }); var customerids = (from ho in hos select ho.CustomerID).Distinct().ToList(); var customers = customerdao.Query(new CustomerQueryForm { IDs = customerids, Enabled = 1, IsDeleted = 0 }); var buildingids = (from h in house select h.BuildingID).Distinct().ToList(); var buidlings = buildingdao.Query(new BuildingQueryForm { IDs = buildingids }); foreach (var h in house) { FullHouse fh = new FullHouse { House = h, Customer = (from ho in hos join c in customers on ho.CustomerID equals c.ID where ho.HouseOrRoomID.Equals(h.ID) select c).FirstOrDefault(), Building = buidlings.Find(t => t.ID.Equals(h.BuildingID)), }; list.Add(fh); } return list; }
public ActionResult GetInforDetailOrder(string idDH) { var order = new DonHangDao().GetDonHang(idDH); var listCT_DonHang = new DonHangDao().getListCTDH(idDH); var customer = new CustomerModel(); decimal phiShip = 0; decimal tong = 0; foreach (var item in listCT_DonHang) { tong += item.SOLUONG * item.THANHTIEN; } if (tong < 300000) { phiShip = 30000; } if (order != null) { var cusdetail = new CustomerDao().ViewDetail(order.MAKHACHHANG); var pttt = new OrdersDao().GetPhuongThucThanhToan(order.MAPHUONGTHUCTHANHTOAN); customer.MAKH = cusdetail.MAKHACHHANG; customer.TENKH = cusdetail.TENKHACHHANG; customer.DIACHI = cusdetail.DIACHI; customer.DIENTHOAI = cusdetail.DIENTHOAI; customer.EMAIL = cusdetail.EMAIL; customer.NgayTaoDon = order.NGAYLAP; customer.PhuongThucThanhToan = pttt.TENPHUONGTHUCTHANHTOAN; customer.Ship = phiShip; } return(Json(customer, JsonRequestBehavior.AllowGet)); }
public ActionResult Payment() { var list = new List <CartItem>(); var session = (UserLogin)Session[BookShop.Common.CommonConstants.USER_SESSION]; if (session != null) { var cusDao = new CustomerDao(); var customer = cusDao.GetById(session.UserName); ViewBag.ShipName = customer.Name; ViewBag.ShipPhone = customer.Phone; ViewBag.ShipAddress = customer.Address; ViewBag.ShipEmail = customer.Email; } var cart = Session[CartSession]; ViewBag.ngaymua = DateTime.Now; int tien = 0; if (cart != null) { list = (List <CartItem>)cart; foreach (var item in list) { tien += Convert.ToInt32(item.Book.Price.GetValueOrDefault(0) * item.Quantity); } ViewBag.tongtien = tien; } return(View(list)); }
public void saveCustomer(string id, string name, string email, string birthDate) { Customer customer = CustomerDao.GetCustomer(id); if (customer == null) { customer = new Customer { Id = id }; } if (name != null) { customer.Name = name; } if (email != null) { customer.Email = email; } //...还有其他属性 CustomerDao.SaveCustomer(customer); }
public ActionResult Add(Customer customer) { if (customer.Email.Contains("alkoshop.com")) { TempData["message-no-success"] = "Nemas pravo pridavat zamestnance"; return(RedirectToAction("Index", "Home")); } if (customer.BirthDate.Year > DateTime.Today.Year - 18) { TempData["message-no-success"] = "Pro registraci musíte být starší než 18 let!"; TempData["addresscontainer"] = customer.Address; return(RedirectToAction("Create", customer)); } customer.Address = (Address)TempData["addresscontainer"]; if (ModelState.IsValid) { AddressDao addressDao = new AddressDao(); addressDao.Create(customer.Address); CustomerDao customerDao = new CustomerDao(); customerDao.Create(customer); TempData["message-success"] = "Registrace proběhla úspěšně prosím přihlaste se"; return(RedirectToAction("Index", "Home")); } return(RedirectToAction("Create", customer)); }
public AddOrderProxy() { OrderModel = new OrderDao(context); CustomerModel = new CustomerDao(context); GoodsModel = new GoodsDao(context); GoodsRowModel = new GoodsRowDao(context); OrderStatusModel = new OrderStatusDao(context); CommentModel = new CommentDao(context); }
/// <summary> /// Setup the dependency injection for controllers. /// </summary> private static void ConfigureDependencies(HttpConfiguration config) { var dependencyResolver = new DependencyResolver(); // create the service to be injected var customerDao = new CustomerDao(); // setup a constructor for a CustomersController dependencyResolver.RegisterType<CustomersController>(() => new CustomersController(customerDao)); // assign the resolver to the config config.DependencyResolver = dependencyResolver; }
public List<FullHouse> QueryFullHouse(QueryHouseServiceForm form) { List<FullHouse> list = new List<FullHouse>(); ISqlMapper mapper = MapperHelper.GetMapper(); HouseDao dao = new HouseDao(mapper); House_CustomerDao hcdao = new House_CustomerDao(mapper); CustomerDao customerdao = new CustomerDao(mapper); BuildingDao buildingdao = new BuildingDao(mapper); RentFeeDao rfdao = new RentFeeDao(mapper); House_OtherFeeDao hofdao = new House_OtherFeeDao(mapper); OtherFeeDao ofdao = new OtherFeeDao(mapper); var house = dao.QueryFullHouse(form); var houseids = (from h in house select h.ID).ToList(); var hcs = hcdao.Query(new House_CustomerQueryForm { HouseOrRoomIDs = houseids }); var customerids = (from ho in hcs select ho.CustomerID).Distinct().ToList(); var customers = customerdao.Query(new CustomerQueryForm { IDs = customerids, Enabled = 1, IsDeleted = 0, }); var buildingids = (from h in house select h.BuildingID).Distinct().ToList(); var buidlings = buildingdao.Query(new BuildingQueryForm { IDs = buildingids }); var rentfees = rfdao.Query(new RentFeeQueryForm { HouseOrRoomIDs = houseids, Enabled = 1, IsDeleted = 0 }); var rentfeeids = (from rf in rentfees select rf.ID).ToList(); var hos = hofdao.Query(new House_OtherFeeQueryForm { HouseOrRoomIDs = houseids }); var otherfeeids = (from ho in hos select ho.OtherFeeID).Distinct().ToList(); var ofs = ofdao.Query(new OtherFeeQueryForm { IDs = otherfeeids }); foreach (var h in house) { FullHouse fh = new FullHouse { House = h, Customer = (from ho in hcs join c in customers on ho.CustomerID equals c.ID where ho.HouseOrRoomID.Equals(h.ID) && c.Type == (int)CustomerType.业主 select c).FirstOrDefault(), Building = buidlings.Find(t => t.ID.Equals(h.BuildingID)), RentFee = rentfees.Find(t => t.HouseOrRoomID.Equals(h.ID)), OtherFees = (from ho in hos join of in ofs on ho.OtherFeeID equals of.ID where ho.HouseOrRoomID.Equals(h.ID) select of).ToList(), Renter = (from ho in hcs join c in customers on ho.CustomerID equals c.ID where ho.HouseOrRoomID.Equals(h.ID) && c.Type == (int)CustomerType.租客 select c).FirstOrDefault(), }; list.Add(fh); } return list; }
public Customer Save(Customer customer) { CustomerDao customerdao = new CustomerDao(); Customer c = null; if (string.IsNullOrEmpty(customer.ID)) { customer.IsDeleted = 0; customer.Enabled = 1; customerdao.Add(customer); c = customer; } else { c = customerdao.Query(new CustomerQueryForm { ID = customer.ID, IsDeleted = 0, Enabled = 1 }).FirstOrDefault(); if (c == null) { customer.IsDeleted = 0; customer.Enabled = 1; customerdao.Add(customer); c = customer; } else { customerdao.Update(new CustomerUpdateForm { Entity = new Customer { Name = customer.Name, Phone = customer.Phone, IdentityCode = customer.IdentityCode, Remark = customer.Remark, }, CustomerQueryForm = new CustomerQueryForm { ID = c.ID }, }); } } return c; }
public List<FullHouse> QueryFullHouse(QueryHouseServiceForm form) { List<FullHouse> list = new List<FullHouse>(); ISqlMapper mapper = MapperHelper.GetMapper(); UserBLL userbll = new UserBLL(); HouseDao dao = new HouseDao(mapper); House_CustomerDao hcdao = new House_CustomerDao(mapper); CustomerDao customerdao = new CustomerDao(mapper); BuildingDao buildingdao = new BuildingDao(mapper); FollowupDao followupdao = new FollowupDao(mapper); form.IsDeleted = 0; var house = dao.QueryFullHouse(form); var houseids = (from h in house select h.ID).ToList(); var hos = hcdao.Query(new House_CustomerQueryForm { HouseOrRoomIDs = houseids }); var customerids = (from ho in hos select ho.CustomerID).Distinct().ToList(); var customers = customerdao.Query(new CustomerQueryForm { IDs = customerids, Enabled = 1, IsDeleted = 0 }); var buildingids = (from h in house select h.BuildingID).Distinct().ToList(); var buidlings = buildingdao.Query(new BuildingQueryForm { IDs = buildingids }); //var ownerids = (from h in house where !string.IsNullOrEmpty(h.OwnerID.Trim()) select h.OwnerID).Distinct().ToList(); var users = userbll.Query(new FullUserQueryForm { Enabled = 1, IsDeleted = 0 }); var followups = followupdao.Query(new FollowupQueryForm { HouseIDs = houseids }); var fullfollowup = (from f in followups join u in users on f.Creator equals u.ID select new FullFollowup { ID = f.ID, Creator = f.Creator, CreateTime = f.CreateTime, HouseID = f.HouseID, Name = f.Name, CreatorName = u.CnName, Remark = f.Remark }).ToList(); //var rentfee = rentfeebll.Query(new RentFeeQueryForm { HouseOrRoomIDs = houseids, Type = (int)HouseOrRoomType.House, Enabled = 1, IsDeleted = 0 }); //var house_otherfee = hobll.Query(new House_OtherFeeQueryForm { HouseOrRoomIDs = houseids, Type = (int)HouseOrRoomType.House }); //var otherfee = ofbll.Query(new OtherFeeQueryForm { Enabled = 1, IsDeleted = 0 }); foreach (var h in house) { FullHouse fh = new FullHouse { House = h, //RentFee = rentfee.Find(t => t.HouseOrRoomID.Equals(h.ID)), //OtherFees = (from ho in house_otherfeeu //join of in otherfee on ho.OtherFeeID equals of.ID //where ho.HouseOrRoomID.Equals(h.ID) //select of).ToList(), Customer = (from ho in hos join c in customers on ho.CustomerID equals c.ID where ho.HouseOrRoomID.Equals(h.ID) select c).FirstOrDefault(), Building = buidlings.Find(t => t.ID.Equals(h.BuildingID)), Owner = users.Find(t => t.ID.Equals(h.OwnerID)), Followups = fullfollowup.FindAll(t => t.HouseID.Equals(h.ID)), }; //rentfee.Remove(fh.RentFee); //house_otherfee.RemoveAll(t => t.HouseOrRoomID.Equals(fh.House.ID)); list.Add(fh); } return list; }
public bool Delete(CustomerQueryForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); CustomerDao dao = new CustomerDao(mapper); return dao.Delete(form); }
public List<Customer> QueryFullCustomer(FullCustomerQueryForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); CustomerDao dao = new CustomerDao(mapper); return dao.QueryFullCustomer(form); }
public string Update(FullHouse house) { ISqlMapper mapper = MapperHelper.GetMapper(); House_OtherFeeDao hofdao = new House_OtherFeeDao(mapper); House_CustomerDao hcdao = new House_CustomerDao(mapper); CustomerDao customerdao = new CustomerDao(mapper); RentFeeDao rfdao = new RentFeeDao(mapper); RentFee rf = null; house.RentFee.HouseOrRoomID = house.House.ID; if (!string.IsNullOrEmpty(house.RentFee.ID)) rf = rfdao.Query(new RentFeeQueryForm { HouseOrRoomID = house.House.ID, Enabled = 1, IsDeleted = 0 }).FirstOrDefault(); string id = house.RentFee.ID; if (rf == null) id = rfdao.Add(house.RentFee); else rfdao.Update(new RentFeeUpdateForm { Entity = house.RentFee, RentFeeQueryForm = new RentFeeQueryForm { ID = id }, }); hofdao.Delete(new House_OtherFeeQueryForm { HouseOrRoomID = house.House.ID }); if (house.OtherFees != null) { foreach (var of in house.OtherFees) { hofdao.Add(new House_OtherFee { HouseOrRoomID = house.House.ID, OtherFeeID = of.ID, Type = (int)HouseOrRoomType.House }); } } hcdao.Delete(new House_CustomerQueryForm { HouseOrRoomID = house.House.ID, Type = (int)CustomerType.租客 }); if (house.Renter != null) hcdao.Add(new House_Customer { HouseOrRoomID = house.House.ID, CustomerID = house.Renter.ID, Type = (int)CustomerType.租客 }); return id; }
public int QueryFullCustomerCount(FullCustomerQueryForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); CustomerDao dao = new CustomerDao(mapper); return dao.QueryFullCustomerCount(form); }
public bool Update(CustomerUpdateForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); CustomerDao dao = new CustomerDao(mapper); return dao.Update(form); }
public string Add(Customer customer) { ISqlMapper mapper = MapperHelper.GetMapper(); CustomerDao dao = new CustomerDao(mapper); return dao.Add(customer); }
public bool CheckIdentityCodeExists(CustomerQueryForm form) { CustomerDao dao = new CustomerDao(); return dao.CheckIdentityCode(form) != null; }
public bool Delete(CustomerQueryForm form) { CustomerDao dao = new CustomerDao(); dao.Delete(form); return true; }
public bool Update(CustomerUpdateForm form) { CustomerDao dao = new CustomerDao(); //MonitorCache.GetInstance().PushMessage(new CacheMessage { Message = "id:" + form.Entity.ID + " gender:" + form.Entity.Gender }, SOAFramework.Library.CacheEnum.FormMonitor); dao.Update(form); return true; }
public List<Customer> Query(CustomerQueryForm form) { CustomerDao dao = new CustomerDao(); form.IsDeleted = 0; return dao.Query(form); }