/// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     Song.Entities.ProfitSharing theme = id < 1 ? null : Business.Do <IProfitSharing>().ThemeSingle(id);
     if (theme != null)
     {
         tbName.Text     = theme.Ps_Name;
         tbIntro.Text    = theme.Ps_Intro;
         cbIsUse.Checked = theme.Ps_IsUse;
     }
     BindGridviewData();
 }
        /// 修改是否使用的状态
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void sbUse_Click(object sender, EventArgs e)
        {
            StateButton ub    = (StateButton)sender;
            int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
            int         id    = int.Parse(this.gvProfit.DataKeys[index].Value.ToString());

            //
            Song.Entities.ProfitSharing entity = Business.Do <IProfitSharing>().ProfitSingle(id);
            entity.Ps_IsUse = !entity.Ps_IsUse;
            Business.Do <IProfitSharing>().ProfitSave(entity);
            BindGridviewData();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取分润方案名称
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected string GetProfit(object obj)
        {
            int psid = 0;

            int.TryParse(obj.ToString(), out psid);
            Song.Entities.ProfitSharing ps = Business.Do <IProfitSharing>().ThemeSingle(psid);
            if (ps == null)
            {
                return("");
            }
            return(ps.Ps_Name);
        }
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     Song.Entities.ProfitSharing theme = id < 1 ? new Song.Entities.ProfitSharing() : Business.Do <IProfitSharing>().ThemeSingle(id);
     if (theme != null)
     {
         theme.Ps_Name  = tbName.Text.Trim();
         theme.Ps_Intro = tbIntro.Text.Trim();
         theme.Ps_IsUse = cbIsUse.Checked;
     }
     if (id < 1)
     {
         id = Business.Do <IProfitSharing>().ThemeAdd(theme);
         //刷新页面
         string encrypt = WeiSha.Common.DataConvert.EncryptForBase64(id.ToString());
         encrypt = System.Web.HttpUtility.UrlEncode(encrypt);
         this.Response.Redirect(this.AddPara("id", encrypt));
     }
     else
     {
         Business.Do <IProfitSharing>().ThemeSave(theme);
         Master.AlertCloseAndRefresh("操作成功");
     }
 }
        /// <summary>
        /// 编辑当前数据项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEditEnter_Click(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Button btn = (System.Web.UI.WebControls.Button)sender;
            GridViewRow row = (GridViewRow)btn.Parent.Parent;   //当前所在行
            int         id  = int.Parse(this.gvProfit.DataKeys[row.RowIndex].Value.ToString());

            //
            Song.Entities.ProfitSharing profit = Business.Do <IProfitSharing>().ProfitSingle(id);
            if (profit != null)
            {
                //资金比例
                TextBox tbm = (TextBox)row.FindControl("tbMoneyEdit");
                int     money;
                int.TryParse(tbm.Text, out money);
                profit.Ps_Moneyratio = money;
                //卡券比例
                TextBox tbc = (TextBox)row.FindControl("tbCouponEdit");
                int     coupon;
                int.TryParse(tbc.Text, out coupon);
                profit.Ps_Couponratio = coupon;
                //是否可用
                CheckBox cb = (CheckBox)row.FindControl("cbIsUse");
                profit.Ps_IsUse = cb.Checked;
                //保存
                try
                {
                    Business.Do <IProfitSharing>().ProfitSave(profit);
                }
                catch (Exception ex)
                {
                    this.Message.Alert(ex.Message);
                }
            }
            gvProfit.EditIndex  = -1;
            plAddProfit.Enabled = true;    //启用新增
            BindGridviewData();
        }