private bool DoAdd() { ps_depot model = new ps_depot(); if (model.Exists(txttitle.Text.Trim())) { mym.JscriptMsg(this.Page, "您输入的商家名称已经存在,请检查!", "", "Error"); return(false); } model.title = txttitle.Text.Trim(); model.code = ""; model.contact_name = txtcontact_name.Text.Trim(); model.contact_mobile = txtcontact_tel.Text.Trim(); model.contact_address = txtcontact_address.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue.Trim()); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.remark = txtremark.Text.Trim(); if (cbIsLock.Checked == true) { model.status = 1; } else { model.status = 2; } if (model.Add() > 0) { mym.AddAdminLog("增加", "添加商家:" + txttitle.Text); //记录日志 return(true); } return(false); }
private void ShowInfo(int _id) { ps_manager model = new ps_manager(); model.GetModel(_id); Lituser_name.Text = model.user_name; Litreal_name.Text = model.real_name; txtmobile.Text = model.mobile; Litdepot_id.Text = model.depot_id.ToString(); if (Convert.ToInt32(model.depot_id) != 0) { mdxx.Visible = true; ps_depot model1 = new ps_depot(); model1.GetModel(Convert.ToInt32(model.depot_id)); Litdepotname.Text = model1.title; Litcontact_name.Text = model1.contact_name; Litcontact_tel.Text = model1.contact_mobile; txtcontact_address.Text = model1.contact_address; } if (Convert.ToInt32(model.depot_category_id) != 0) { bmxx.Visible = true; ps_depot_category model2 = new ps_depot_category(); model2.GetModel(Convert.ToInt32(model.depot_category_id)); Litdepot_category_name.Text = model2.title; } }
//绑定记录 public void binddr() { ps_depot bll = new ps_depot(); string sqlstr = "id>0 "; sqlstr = sqlstr + CombSqlTxt(this.status, this.category_id, this.keywords); sqlstr = sqlstr + " order by category_id asc,sort_id asc,id desc "; DataView dv = bll.GetList(sqlstr).Tables[0].DefaultView; repCategory.DataSource = dv; repCategory.DataBind(); }
private void MDYHBind(int _id) { ps_depot bll = new ps_depot(); DataTable dt = bll.GetList("id=" + _id + "and status=1").Tables[0]; this.ddlDepotId.Items.Clear(); this.ddlDepotId.Items.Add(new ListItem("==全部==", "")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); string Title = dr["title"].ToString().Trim(); this.ddlDepotId.Items.Add(new ListItem(Title, Id)); } }
private void DepotBind(int _category_id) { ps_depot bll = new ps_depot(); DataTable dt = bll.GetList(_category_id); this.ddlDepotId.Items.Clear(); this.ddlDepotId.Items.Add(new ListItem("请选择所属商家...", "")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); string Title = dr["title"].ToString().Trim(); this.ddlDepotId.Items.Add(new ListItem(Title, Id)); } }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ps_depot bll = new ps_depot(); Repeater rptList = new Repeater(); rptList = this.rptList; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } mym.JscriptMsg(this.Page, " 排序保存成功", Utils.CombUrlTxt("depot_list.aspx", "status={0}&category_id={1}&keywords={2}&page={3}", this.status.ToString(), this.category_id.ToString(), this.keywords, this.page.ToString()), "Success"); }
private void ShowInfo(int _id) { model.GetModel(_id); //绑定商品列表 ps_order_goods bll = new ps_order_goods(); string sql = " order_id =" + _id; DataTable dt = bll.GetList(sql).Tables[0]; this.rptList.DataSource = dt; this.rptList.DataBind(); //获得商家信息 if (model.depot_id > 0) { ps_depot user_info = new ps_depot(); user_info.GetModel(Convert.ToInt32(model.depot_id)); user_name.Text = model.user_name; title.Text = user_info.title; contact_address.Text = user_info.contact_address; contact_name.Text = user_info.contact_name; contact_tel.Text = user_info.contact_mobile; } //根据订单状态,显示各类操作按钮 switch (model.status) { case 1: //订单为已生成状态 //确认订单、取消订单显示 btnConfirm.Visible = btnCancel.Visible = true; //修改订单备注、调价按钮显示 btnEditRemark.Visible = btnEditPaymentFee.Visible = true; break; case 2: //如果订单为已确认状态 //完成显示 btnComplete.Visible = true; //修改订单备注按钮可见 btnEditRemark.Visible = true; break; } }
private void ShowInfo(int _id) { ps_depot model = new ps_depot(); model.GetModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txttitle.Text = model.title; txtcontact_name.Text = model.contact_name; txtcontact_tel.Text = model.contact_mobile; txtcontact_address.Text = model.contact_address; txtSortId.Text = model.sort_id.ToString(); txtremark.Text = model.remark; if (model.status == 1) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } }
private void ShowInfo(string _order_no) { model.GetModel(_order_no); ps_order_goods bll = new ps_order_goods(); string sql = " order_id =" + model.id; DataTable dt = bll.GetList(sql).Tables[0]; this.rptList.DataSource = dt; this.rptList.DataBind(); //获得商家信息 if (model.depot_id > 0) { ps_depot user_info = new ps_depot(); user_info.GetModel(Convert.ToInt32(model.depot_id)); title.Text = user_info.title; contact_address.Text = user_info.contact_address; contact_name.Text = user_info.contact_name; contact_tel.Text = user_info.contact_mobile; } }
private bool DoEdit(int _id) { bool result = false; ps_depot model = new ps_depot(); if (model.Exists(txttitle.Text.Trim(), _id)) { mym.JscriptMsg(this.Page, "您输入的商家名称已经存在,请检查!", "", "Error"); return(false); } model.GetModel(_id); model.title = txttitle.Text.Trim(); model.code = ""; model.contact_name = txtcontact_name.Text.Trim(); model.contact_mobile = txtcontact_tel.Text.Trim(); model.contact_address = txtcontact_address.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue.Trim()); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.remark = txtremark.Text.Trim(); if (cbIsLock.Checked == true) { model.status = 1; } else { model.status = 2; } if (model.Update()) { mym.AddAdminLog("修改", "修改商家:" + txttitle.Text); //记录日志 result = true; } return(result); }
private void RptBind(string _strWhere, string _orderby) { this.page = AXRequest.GetQueryInt("page", 1); if (this.status > 0) { this.ddlStatus.SelectedValue = this.status.ToString(); } if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = this.category_id.ToString(); } txtKeywords.Text = this.keywords; ps_depot bll = new ps_depot(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("depot_list.aspx", "status={0}&category_id={1}&keywords={2}&page={3}", this.status.ToString(), this.category_id.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ps_manager model = new ps_manager(); model.GetModel(Convert.ToInt32(Session["AID"])); string userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtOldPassword.Text.Trim(), "MD5"); if (userPwd != model.password) { mym.JscriptMsg(this.Page, "旧密码不正确!", "", "Warning"); return; } if (txtPassword.Text.Trim() != txtPassword1.Text.Trim()) { mym.JscriptMsg(this.Page, "两次密码不一致!", "", "Warning"); return; } model.password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5"); model.mobile = txtmobile.Text.Trim(); model.id = Convert.ToInt32(Session["AID"]); if (!model.UpdateMY()) { ps_depot model1 = new ps_depot(); model1.id = Convert.ToInt32(Litdepot_id.Text); model1.contact_address = txtcontact_address.Text.Trim(); model1.UpdateAddress(); mym.JscriptMsg(this.Page, "保存过程中发生错误!", "", "Error"); return; } mym.AddAdminLog("修改", "修改个人信息:用户名:" + Lituser_name.Text); //记录日志 mym.JscriptMsg(this.Page, "个人信息修改成功!请下次用新密码登陆!", "", "Success"); }
// 单个删除 protected void lbtnDelCa_Click(object sender, EventArgs e) { // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ps_depot bll = new ps_depot(); bll.GetModel(caId); string title = bll.title; ps_manager bllpp = new ps_manager(); bllpp.depot_id = caId; if (!bllpp.ExistsMD())//查找是否存在用户 { bll.Delete(caId); mym.AddAdminLog("删除", "删除商家:" + title + ""); //记录日志 mym.JscriptMsg(this.Page, " 成功删除商家:" + title + "", Utils.CombUrlTxt("depot_list.aspx", "status={0}&category_id={1}&keywords={2}&page={3}", this.status.ToString(), this.category_id.ToString(), this.keywords, this.page.ToString()), "Success"); } else { mym.JscriptMsg(this.Page, "有用户属于该商家,不能删除!", "", "Error"); return; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Value.Trim(); string userPwd = txtPassword.Value.Trim(); //判断登录信息 ps_manager myuser = new ps_manager(); string sqlGetUserID = "select id from [ps_manager] where user_name='" + userName + "'"; int userid = Convert.ToInt16(DbHelperSQL.GetSingle(sqlGetUserID)); myuser.GetModel(userid); if (myuser.password != null) { userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5"); if (myuser.password.Trim() != userPwd) { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } //判断账号是否被禁用 if (Convert.ToInt32(myuser.is_lock) == 2) { MessageBox.errorShow(this.Page, "您的账号被禁用,请联系客服!"); return; } ps_depot myd = new ps_depot(); myd.GetModel(Convert.ToInt32(myuser.depot_id)); //判断账号对应的商家是否被禁用 if (Convert.ToInt32(myuser.depot_id) != 0 && Convert.ToInt32(myd.status) == 2) { MessageBox.errorShow(this.Page, "您所在商家被禁用,请联系客服!"); return; } //写入登录日志 ps_manager_log mylog = new ps_manager_log(); mylog.user_id = userid; mylog.user_name = userName; mylog.action_type = "登陆"; mylog.add_time = DateTime.Now; mylog.remark = "登陆系统"; mylog.user_ip = AXRequest.GetIP(); mylog.Add(); //写入Cookies Utils.WriteCookie("RememberName", userName, 14400); Utils.WriteCookie("AdminName", userName, 14400); Utils.WriteCookie("RoleID", myuser.role_id.ToString(), 14400); Utils.WriteCookie("AID", myuser.id.ToString(), 14400); Utils.WriteCookie("RealName", myuser.real_name, 14400); Utils.WriteCookie("DepotID", myuser.depot_id.ToString(), 14400); Utils.WriteCookie("DepotCatID", myuser.depot_category_id.ToString(), 14400); //写入Session Session["RememberName"] = userName; Session["AdminName"] = userName; Session["RoleID"] = myuser.role_id.ToString(); Session["AID"] = myuser.id.ToString(); Session["RealName"] = myuser.real_name; Session["DepotID"] = myuser.depot_id.ToString(); Session["DepotCatID"] = myuser.depot_category_id.ToString(); Session.Timeout = 45; Response.Redirect("main.aspx"); return; } else { MessageBox.errorShow(this.Page, "账号或密码有误,请重试!"); return; } }