/** * 2.添加新员工 * 参数:新员工名字 * 返回值:成功返回员工id,失败返回0 */ public staff addNewStaff(string newStaffName, string newStaffPassword, string newShopId, int newStaffJob, string newGender, string newPhone) { string newId = createNewId("staff");//根据一个算法产生ID staff newStaff = new staff { staffId = newId, staffName = newStaffName, password = newStaffPassword, staffLoginName = newId, shopId = newShopId, staffJob = newStaffJob, staffGender = newGender, staffPhone = newPhone }; //写入数据库 using (YMDBEntities db = new YMDBEntities()) { try { db.staff.Add(newStaff); db.SaveChanges(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("员工添加异常"); System.Diagnostics.Debug.WriteLine(ex.Message); } } return newStaff; }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["staff"]; System.Diagnostics.Debug.WriteLine("theStaff:" + theStaff.staffId); check checker = DBModel.sharedDBModel().addNewCheckRecord(theStaff.staffId); checkDetailTable = DBModel.sharedDBModel().getCheckDetailInfoWithStaffId(checker.checkId ,theStaff.staffId); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; searchResult = DBModel.sharedDBModel().getAllItemsOfThisShop(theStaff.staffId); for (int i = 0; i < searchResult.Length; i++) { System.Diagnostics.Debug.WriteLine("test debug shopid and item id :: " + theStaff.shopId + searchResult[i].itemId); thisStock[i]= DBModel.sharedDBModel().getItemStockInThisShop(theStaff.staffId, searchResult[i].itemId); } System.Diagnostics.Debug.WriteLine("stock debug :" + thisStock.Length); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; order[] getAllStaffOrder = DBModel.sharedDBModel().getAllOrderInfo(theStaff.staffId); for (int i = 0; i < 5; i++) { getStaffOrder[i] = getAllStaffOrder[i]; } orderMonthChart = DBModel.sharedDBModel().getEverySumOfThisMonth(theStaff.staffId); hotItems = DBModel.sharedDBModel().topFiveItems(theStaff.staffId); System.Diagnostics.Debug.WriteLine("size of the hotItems:" + hotItems.GetLength(0)); }
protected void loginSubmit(object sender, EventArgs e) { string username = Request.Form["username"]; string pwd = Request.Form["password"]; System.Diagnostics.Debug.WriteLine("Debug : username:"******"password:"******"") || pwd.Equals("")) { System.Diagnostics.Debug.WriteLine("kong"); Session["errorMessage"] = "用户名和密码不能为空"; Session["returnURL"] = "Login.aspx"; Response.Redirect("Error.aspx"); } else { staff theStaff = DBModel.sharedDBModel().loginWithStaffLoginNameAndPassword(username, pwd); if (theStaff == null) { System.Diagnostics.Debug.WriteLine("用户名密码错误"); Session["errorMessage"] = "用户名和密码错误"; Session["returnURL"] = "Login.aspx"; Response.Redirect("Error.aspx"); } else { Session["Staff"] = theStaff; System.Diagnostics.Debug.WriteLine("success !" + "usr job :" + theStaff.staffJob); if (theStaff.staffJob == 1) { Response.Redirect("ManagerIndex.aspx"); } if (theStaff.staffJob == 0) { Response.Redirect("BossIndex.aspx"); } else { Response.Redirect("Index.aspx"); } } } }
// protected string[] topFiveItemId; // protected string[] topFiveItemName; // protected string[] topFiveItemImgid; protected void Page_Load(object sender, EventArgs e) { theStaff =(staff)Session["Staff"]; // 为空返回什么数值? // string [,] showItems = DBModel.sharedDBModel().topFiveItems(); order[] getAllStaffOrder = DBModel.sharedDBModel().getAllOrderInfo(theStaff.staffId); int temp = getAllStaffOrder.Length; if ( temp > 5) { temp = 5; } getStaffOrder = new order[temp]; for (int i = 0; i < temp; i++) { getStaffOrder[i] = getAllStaffOrder[i]; } hotItems = DBModel.sharedDBModel().topFiveItems(theStaff.staffId); // 前端 no problems orderMonthChart = DBModel.sharedDBModel().getEverySumOfThisMonth(theStaff.staffId); System.Diagnostics.Debug.WriteLine("month order debug :"+ orderMonthChart.Length); }
// protected string[] topFiveItemId; // protected string[] topFiveItemName; // protected string[] topFiveItemImgid; protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; // 为空返回什么数值? // string [,] showItems = DBModel.sharedDBModel().topFiveItems(); order[] getAllStaffOrder = DBModel.sharedDBModel().getAllOrderInfo(theStaff.staffId); int temp = getAllStaffOrder.Length; if (temp > 5) { temp = 5; } getStaffOrder = new order[temp]; for (int i = 0; i < temp; i++) { getStaffOrder[i] = getAllStaffOrder[i]; } hotItems = DBModel.sharedDBModel().topFiveItems(theStaff.staffId); // 前端 no problems orderMonthChart = DBModel.sharedDBModel().getEverySumOfThisMonth(theStaff.staffId); System.Diagnostics.Debug.WriteLine("month order debug :" + orderMonthChart.Length); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; checkTable = DBModel.sharedDBModel().getAllCheckInfo(theStaff.staffId); }
/** * 4.更改员工信息 * 参数:员工id,姓名,电话,密码 * 返回值:成功返回true,失败返回false */ public bool modifyPersonalInformation(staff currentInfo) { using (YMDBEntities db = new YMDBEntities()) { try { staff oldStaff = db.staff.Where(p => p.staffId == currentInfo.staffId).FirstOrDefault(); oldStaff.staffLoginName = currentInfo.staffLoginName; oldStaff.password = currentInfo.password; oldStaff.staffPhone = currentInfo.staffPhone; db.SaveChanges(); return true; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("修改失败,没有这员工."); System.Diagnostics.Debug.WriteLine(ex.Message); return false; } } }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; }
protected void Page_Load(object sender, EventArgs e) { theStaff =(staff)Session["Staff"]; }
protected void SearchByStaffName(string name) { staffToFind = DBModel.sharedDBModel().getStaffWithStaffName(name).FirstOrDefault(); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; searchResult = DBModel.sharedDBModel().getAllinBaseInfoByStaffId(theStaff.staffId); System.Diagnostics.Debug.WriteLine("searchResult Length:" + searchResult.Length); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; items = DBModel.sharedDBModel().getAllItemsOfThisShop(theStaff.staffId); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; allShop = DBModel.sharedDBModel().getAllShop(); }
//查找员工 protected void SearchByStaffId(string id) { staffToFind = DBModel.sharedDBModel().findStaffByStaffId(id); }
protected void Page_Load(object sender, EventArgs e) { theStaff =(staff)Session["Staff"]; searchResult = DBModel.sharedDBModel().getAllOrderInfo(theStaff.staffId); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; applyOutResult = DBModel.sharedDBModel().getAllApllyToThisShop(theStaff.staffId); applyInResult = DBModel.sharedDBModel().getAllApllyFromThisShop(theStaff.staffId); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; System.Diagnostics.Debug.WriteLine("staff id " + theStaff.staffId); hisShop = DBModel.sharedDBModel().findShopByShopId(theStaff.shopId); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; addresses = DBModel.sharedDBModel().getAllAddressInfo(); }
protected void Page_Load(object sender, EventArgs e) { theStaff = (staff)Session["Staff"]; searchResult = DBModel.sharedDBModel().getAllOrderInfo(theStaff.staffId); }