コード例 #1
0
ファイル: wx_RoleFenxiaoDal.cs プロジェクト: Hizcy/disneybg
        /// <summary>
        /// 得到  wx_rolefenxiao 数据实体
        /// </summary>
        /// <param name="dr">dr</param>
        /// <returns>wx_rolefenxiao 数据实体</returns>
        public wx_RoleFenxiaoEntity Populate_wx_RoleFenxiaoEntity_FromDr(IDataReader dr)
        {
            wx_RoleFenxiaoEntity Obj = new wx_RoleFenxiaoEntity();

            Obj.Id         = ((dr["Id"]) == DBNull.Value)?0:Convert.ToInt32(dr["Id"]);
            Obj.ShopId     = ((dr["ShopId"]) == DBNull.Value)?0:Convert.ToInt32(dr["ShopId"]);
            Obj.RoleId     = ((dr["RoleId"]) == DBNull.Value)?0:Convert.ToInt32(dr["RoleId"]);
            Obj.Commission = ((dr["Commission"]) == DBNull.Value)?0:Convert.ToDecimal(dr["Commission"]);
            Obj.SetRoleId  = ((dr["SetRoleId"]) == DBNull.Value)?0:Convert.ToInt32(dr["SetRoleId"]);
            Obj.QuDao      = ((dr["QuDao"]) == DBNull.Value)?0:Convert.ToDecimal(dr["QuDao"]);

            return(Obj);
        }
コード例 #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        UserIdentity identity = User.Identity as UserIdentity;

        if (identity != null)
        {
            List <Weifenxiao.Entity.wx_RoleFenxiaoEntity> list = new List <Weifenxiao.Entity.wx_RoleFenxiaoEntity>();

            wx_RoleFenxiaoEntity rolefenxiao1 = new wx_RoleFenxiaoEntity();
            wx_RoleFenxiaoEntity rolefenxiao2 = new wx_RoleFenxiaoEntity();
            wx_RoleFenxiaoEntity rolefenxiao3 = new wx_RoleFenxiaoEntity();
            wx_RoleFenxiaoEntity rolefenxiao4 = new wx_RoleFenxiaoEntity();
            if (RoleId > 0)
            {
                Weifenxiao.BLL.wx_RoleFenxiaoBLL.GetInstance().Delete(identity.ShopID, RoleId);
            }

            rolefenxiao1.Commission = this.txtHehuoren.Text == "" ? 0 : decimal.Parse(this.txtHehuoren.Text.Trim());
            rolefenxiao1.SetRoleId  = int.Parse(hidHehuoren.Text.Trim());
            rolefenxiao1.RoleId     = RoleId > 0?RoleId:int.Parse(dpdRole.SelectedValue.ToString());
            rolefenxiao1.ShopId     = identity.ShopID;
            rolefenxiao1.QuDao      = this.txtHehuorenQudao.Text == "" ? 0 : decimal.Parse(this.txtHehuorenQudao.Text.Trim());
            list.Add(rolefenxiao1);

            rolefenxiao2.Commission = this.txtJinpai.Text == "" ? 0 : decimal.Parse(this.txtJinpai.Text.Trim());
            rolefenxiao2.SetRoleId  = int.Parse(hidJinpai.Text.Trim());
            rolefenxiao2.RoleId     = RoleId > 0 ? RoleId : int.Parse(dpdRole.SelectedValue.ToString());
            rolefenxiao2.ShopId     = identity.ShopID;
            rolefenxiao2.QuDao      = this.txtJinpaiQudao.Text == "" ? 0 : decimal.Parse(this.txtJinpaiQudao.Text.Trim());
            list.Add(rolefenxiao2);

            rolefenxiao3.Commission = this.txtYinpai.Text == "" ? 0 : decimal.Parse(this.txtYinpai.Text.Trim());
            rolefenxiao3.SetRoleId  = int.Parse(hidYinpai.Text.Trim());
            rolefenxiao3.RoleId     = RoleId > 0 ? RoleId : int.Parse(dpdRole.SelectedValue.ToString());
            rolefenxiao3.ShopId     = identity.ShopID;
            rolefenxiao3.QuDao      = this.txtYinpaiQudao.Text == "" ? 0 : decimal.Parse(this.txtYinpaiQudao.Text.Trim());
            list.Add(rolefenxiao3);

            rolefenxiao4.Commission = this.txtPutong.Text == "" ? 0 : decimal.Parse(this.txtPutong.Text.Trim());
            rolefenxiao4.SetRoleId  = int.Parse(hidPutong.Text.Trim());
            rolefenxiao4.RoleId     = RoleId > 0 ? RoleId : int.Parse(dpdRole.SelectedValue.ToString());
            rolefenxiao4.ShopId     = identity.ShopID;
            rolefenxiao4.QuDao      = this.txtPutongQudao.Text == "" ? 0 : decimal.Parse(this.txtPutongQudao.Text.Trim());
            list.Add(rolefenxiao4);

            Weifenxiao.BLL.wx_RoleFenxiaoBLL.GetInstance().Insert(list);
        }
        Response.Redirect("roleyongList.aspx");
    }
コード例 #3
0
ファイル: wx_RoleFenxiaoDal.cs プロジェクト: Hizcy/disneybg
        /// <summary>
        /// 得到  wx_rolefenxiao 数据实体
        /// </summary>
        /// <param name="row">row</param>
        /// <returns>wx_rolefenxiao 数据实体</returns>
        public wx_RoleFenxiaoEntity Populate_wx_RoleFenxiaoEntity_FromDr(DataRow row)
        {
            wx_RoleFenxiaoEntity Obj = new wx_RoleFenxiaoEntity();

            if (row != null)
            {
                Obj.Id         = ((row["Id"]) == DBNull.Value)?0:Convert.ToInt32(row["Id"]);
                Obj.ShopId     = ((row["ShopId"]) == DBNull.Value)?0:Convert.ToInt32(row["ShopId"]);
                Obj.RoleId     = ((row["RoleId"]) == DBNull.Value)?0:Convert.ToInt32(row["RoleId"]);
                Obj.Commission = ((row["Commission"]) == DBNull.Value)?0:Convert.ToDecimal(row["Commission"]);
                Obj.SetRoleId  = ((row["SetRoleId"]) == DBNull.Value)?0:Convert.ToInt32(row["SetRoleId"]);
                Obj.QuDao      = ((row["QuDao"]) == DBNull.Value)?0:Convert.ToDecimal(row["QuDao"]);
            }
            else
            {
                return(null);
            }
            return(Obj);
        }
コード例 #4
0
ファイル: wx_RoleFenxiaoDal.cs プロジェクト: Hizcy/disneybg
        /// <summary>
        /// 根据ID,返回一个wx_RoleFenxiao对象
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>wx_RoleFenxiao对象</returns>
        public wx_RoleFenxiaoEntity Get_wx_RoleFenxiaoEntity(int id)
        {
            wx_RoleFenxiaoEntity _obj = null;

            SqlParameter[] _param =
            {
                new SqlParameter("@Id", SqlDbType.Int)
            };
            _param[0].Value = id;
            string sqlStr = "select * from wx_RoleFenxiao with(nolock) where Id=@Id";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.WfxRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_wx_RoleFenxiaoEntity_FromDr(dr);
                }
            }
            return(_obj);
        }
コード例 #5
0
ファイル: wx_RoleFenxiaoDal.cs プロジェクト: Hizcy/disneybg
        /// <summary>
        /// 向数据库中插入一条新记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_wx_RoleFenxiaoModel">wx_RoleFenxiao实体</param>
        /// <returns>新插入记录的编号</returns>
        public int Insert(SqlTransaction sp, wx_RoleFenxiaoEntity _wx_RoleFenxiaoModel)
        {
            string sqlStr = "insert into wx_RoleFenxiao([ShopId],[RoleId],[Commission],[SetRoleId],[QuDao]) values(@ShopId,@RoleId,@Commission,@SetRoleId,@QuDao) select @@identity";
            int    res;

            SqlParameter[] _param =
            {
                new SqlParameter("@ShopId",     SqlDbType.Int),
                new SqlParameter("@RoleId",     SqlDbType.Int),
                new SqlParameter("@Commission", SqlDbType.Decimal),
                new SqlParameter("@SetRoleId",  SqlDbType.Int),
                new SqlParameter("@QuDao",      SqlDbType.Decimal)
            };
            _param[0].Value = _wx_RoleFenxiaoModel.ShopId;
            _param[1].Value = _wx_RoleFenxiaoModel.RoleId;
            _param[2].Value = _wx_RoleFenxiaoModel.Commission;
            _param[3].Value = _wx_RoleFenxiaoModel.SetRoleId;
            _param[4].Value = _wx_RoleFenxiaoModel.QuDao;
            res             = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param));
            return(res);
        }
コード例 #6
0
ファイル: wx_RoleFenxiaoDal.cs プロジェクト: Hizcy/disneybg
        /// <summary>
        /// 向数据表wx_RoleFenxiao更新一条记录。带事务
        /// </summary>
        /// <param name="sp">事务对象</param>
        /// <param name="_wx_RoleFenxiaoModel">_wx_RoleFenxiaoModel</param>
        /// <returns>影响的行数</returns>
        public int Update(SqlTransaction sp, wx_RoleFenxiaoEntity _wx_RoleFenxiaoModel)
        {
            string sqlStr = "update wx_RoleFenxiao set [ShopId]=@ShopId,[RoleId]=@RoleId,[Commission]=@Commission,[SetRoleId]=@SetRoleId,[QuDao]=@QuDao where Id=@Id";

            SqlParameter[] _param =
            {
                new SqlParameter("@Id",         SqlDbType.Int),
                new SqlParameter("@ShopId",     SqlDbType.Int),
                new SqlParameter("@RoleId",     SqlDbType.Int),
                new SqlParameter("@Commission", SqlDbType.Decimal),
                new SqlParameter("@SetRoleId",  SqlDbType.Int),
                new SqlParameter("@QuDao",      SqlDbType.Decimal)
            };
            _param[0].Value = _wx_RoleFenxiaoModel.Id;
            _param[1].Value = _wx_RoleFenxiaoModel.ShopId;
            _param[2].Value = _wx_RoleFenxiaoModel.RoleId;
            _param[3].Value = _wx_RoleFenxiaoModel.Commission;
            _param[4].Value = _wx_RoleFenxiaoModel.SetRoleId;
            _param[5].Value = _wx_RoleFenxiaoModel.QuDao;
            return(SqlHelper.ExecuteNonQuery(sp, CommandType.Text, sqlStr, _param));
        }
コード例 #7
0
ファイル: wx_RoleFenxiaoLogic.cs プロジェクト: Hizcy/disneybg
 public void Update(wx_RoleFenxiaoEntity wx_RoleFenxiaoEntity)
 {
     wx_RoleFenxiaodal.Update(wx_RoleFenxiaoEntity);
 }
コード例 #8
0
ファイル: wx_RoleFenxiaoLogic.cs プロジェクト: Hizcy/disneybg
 public int Insert(wx_RoleFenxiaoEntity wx_RoleFenxiaoEntity)
 {
     return(wx_RoleFenxiaodal.Insert(wx_RoleFenxiaoEntity));
 }