protected void btnAdd_Click(object sender, EventArgs e) { UserIdentity identity = User.Identity as UserIdentity; if (RoleId == 0) { //添加角色 Weifenxiao.Entity.RolesEntity model = new Weifenxiao.Entity.RolesEntity(); model.ShopId = identity.ShopID; model.Name = this.txtName.Text; model.Permission = 0; model.price = decimal.Parse(this.txtmoney.Text); model.Description = txtDescrition.Text; Weifenxiao.BLL.RolesBLL.GetInstance().Insert(model); } else { Weifenxiao.Entity.RolesEntity model = Weifenxiao.BLL.RolesBLL.GetInstance().GetAdminSingle(RoleId); model.ShopId = identity.ShopID; model.Name = this.txtName.Text; model.Permission = 0; model.price = decimal.Parse(this.txtmoney.Text); model.Description = txtDescrition.Text; Weifenxiao.BLL.RolesBLL.GetInstance().Update(model); } Jnwf.Utils.Helper.HttpHelper.LoadPageContent("http://m.disneybg.com/clear.aspx?type=role&shopid=" + identity.ShopID); Response.Redirect("roleList.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserIdentity identity = User.Identity as UserIdentity; if (identity != null) { IList <Weifenxiao.Entity.RolesEntity> list = Weifenxiao.BLL.RolesBLL.GetInstance().GetListByShopId(identity.ShopID); if (list.Count > 0 && list != null) { if (list[0].Name == "请选择") { list.RemoveAt(0); } if (list[0].Name != "通用权限") { Weifenxiao.Entity.RolesEntity temp = new Weifenxiao.Entity.RolesEntity(); temp.RoleId = 0; temp.Name = "通用权限"; list.Insert(0, temp); } dpdRole.DataSource = list; dpdRole.DataTextField = "Name"; dpdRole.DataValueField = "RoleId"; dpdRole.DataBind(); } } GetData(); } }
public void GetData() { UserIdentity identity = User.Identity as UserIdentity; if (identity != null) { IList <Weifenxiao.Entity.wx_RoleFenxiaoEntity> list = Weifenxiao.BLL.wx_RoleFenxiaoBLL.GetInstance().GetListByShopId(identity.ShopID); IList <Weifenxiao.Entity.RolesEntity> rolelist = Weifenxiao.BLL.RolesBLL.GetInstance().GetListByShopId(identity.ShopID); List <A> alist = new List <A>(); int roleid = 0; Weifenxiao.Entity.RolesEntity role = null; foreach (Weifenxiao.Entity.wx_RoleFenxiaoEntity model in list) { if (roleid != model.RoleId) { A a = new A(); a.roleid = model.RoleId; role = rolelist.FirstOrDefault(c => c.RoleId == model.RoleId); if (role != null) { a.rolename = role.Name; } foreach (Weifenxiao.Entity.wx_RoleFenxiaoEntity m in list) { if (m.RoleId == model.RoleId) { role = rolelist.FirstOrDefault(c => c.RoleId == m.SetRoleId); if (role != null) { a.desc += role.Name + " 分佣 " + m.Commission + ",渠道 分佣 " + m.QuDao + "<br/>"; } } else { continue; } } alist.Add(a); roleid = model.RoleId; } } rptPointList.DataSource = alist; rptPointList.DataBind(); } }
/// <summary> /// 修改时获取数据 /// </summary> public void GetData() { if (Id != 0) { Weifenxiao.Entity.wx_FenxiaoEntity model = Weifenxiao.BLL.wx_FenxiaoBLL.GetInstance().GetAdminSingle(Id); Weifenxiao.Entity.RolesEntity entity = Weifenxiao.BLL.RolesBLL.GetInstance().GetAdminSingle(model.RoleId); if (entity == null) { dpdRole.SelectedValue = "0"; } else { dpdRole.SelectedValue = entity.RoleId.ToString(); } txtYiji.Text = model.OneFenxiao.ToString(); txtErji.Text = model.TwoFenxiao.ToString(); txtSanji.Text = model.ThreeFenxiao.ToString(); } }
private void BindData() { try { UserIdentity identity = User.Identity as UserIdentity; if (identity != null) { // .Model.RolesEntity model = Weifenxiao.BLL.RolesBLL.GetInstance().GetAdminSingle(RoleId); Weifenxiao.Entity.RolesEntity model = Weifenxiao.BLL.RolesBLL.GetInstance().GetAdminSingle(RoleId); model.ShopId = identity.ShopID; if (model != null) { txtName.Text = model.Name; txtmoney.Text = model.price.ToString(); Permission = model.Permission; txtDescrition.Text = model.Description; } } } catch (Exception ex) { // MessageBox.Show(this, ex.Message); } }