Esempio n. 1
0
        /// <summary>
        /// 获取分类id
        /// </summary>
        /// <param name="depart"></param>
        /// <param name="departName"></param>
        /// <returns></returns>
        private int _getSortId(List <Song.Entities.AddressSort> sortArr, string sortName)
        {
            int sortId = 0;

            try
            {
                foreach (Song.Entities.AddressSort s in sortArr)
                {
                    if (sortName.Trim() == s.Ads_Name)
                    {
                        sortId = s.Ads_Id;
                        break;
                    }
                }
                if (sortId == 0)
                {
                    Song.Entities.AddressSort nwsort = new Song.Entities.AddressSort();
                    nwsort.Ads_Name  = sortName;
                    nwsort.Acc_Id    = Extend.LoginState.Admin.CurrentUserId;
                    nwsort.Ads_IsUse = true;
                    sortId           = Business.Do <IAddressList>().SortAdd(nwsort);
                    this.sort        = Business.Do <IAddressList>().SortAll(null);
                }
                return(sortId);
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
                return(sortId);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 修改是否使用的状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void sbUse_Click(object sender, EventArgs e)
 {
     try
     {
         StateButton ub    = (StateButton)sender;
         int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
         int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());
         //
         Song.Entities.AddressSort entity = Business.Do <IAddressList>().SortSingle(id);
         entity.Ads_IsUse = !entity.Ads_IsUse;
         Business.Do <IAddressList>().SortSave(entity);
         BindData(null, null);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     Song.Entities.AddressSort mm = null;
     try
     {
         if (id != 0)
         {
             mm = Business.Do <IAddressList>().SortSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.AddressSort();
         }
         mm.Ads_Name  = tbName.Text.Trim();
         mm.Ads_IsUse = cbIsUse.Checked;
         mm.Acc_Id    = Extend.LoginState.Admin.CurrentUser.Acc_Id;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
     try
     {
         //确定操作
         if (id == 0)
         {
             Business.Do <IAddressList>().SortAdd(mm);
         }
         else
         {
             Business.Do <IAddressList>().SortSave(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Master.Alert(ex.Message);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         Song.Entities.AddressSort mm;
         if (id != 0)
         {
             mm = Business.Do <IAddressList>().SortSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.AddressSort();
         }
         tbName.Text = mm.Ads_Name;
         //是否使用
         cbIsUse.Checked = mm.Ads_IsUse;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }