private bool DoAdd()
        {
            Model.t_business model = new Model.t_business();
            BLL.t_business   bll   = new BLL.t_business();
            //model.IsManage = Convert.ToInt32(ddl_IsManage.SelectedValue);
            model.TrueName = txt_TrueName.Text;
            //model.AgentCode = txt_AgentCode.Text;
            model.Nickname     = txt_Nickname.Text;
            model.Gender       = Convert.ToInt32(ddl_Gender.SelectedValue);
            model.AvatarUrl    = img_AvatarUrl.ImageUrl;
            model.PhoneNumber  = txt_PhoneNumber.Text;
            model.Country      = txt_Country.Text;
            model.Province     = txt_Province.Text;
            model.City         = txt_City.Text;
            model.NativePlace  = txt_NativePlace.Text;
            model.Height       = Convert.ToDecimal(txt_Height.Text);
            model.Birthday     = txt_Birthday.Text == "" ? DateTime.Now : Convert.ToDateTime(txt_Birthday.Text);
            model.CreationTime = DateTime.Now;

            if (bll.Add(model))
            {
                //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.t_business   bll   = new BLL.t_business();
            Model.t_business model = bll.GetModel(_id);
            model.ID = _id;
            //model.IsManage = Convert.ToInt32(ddl_IsManage.SelectedValue);
            model.TrueName = txt_TrueName.Text;
            //model.AgentCode = txt_AgentCode.Text;
            model.Nickname             = txt_Nickname.Text;
            model.Gender               = Convert.ToInt32(ddl_Gender.SelectedValue);
            model.AvatarUrl            = img_AvatarUrl.ImageUrl;
            model.PhoneNumber          = txt_PhoneNumber.Text;
            model.Country              = txt_Country.Text;
            model.Province             = txt_Province.Text;
            model.City                 = txt_City.Text;
            model.NativePlace          = txt_NativePlace.Text;
            model.Height               = Convert.ToDecimal(txt_Height.Text);
            model.Birthday             = txt_Birthday.Text == "" ? DateTime.Now : Convert.ToDateTime(txt_Birthday.Text);
            model.LastModificationTime = DateTime.Now;

            if (bll.Update(model))
            {
                //AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志
                result = true;
            }

            return(result);
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_business", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.t_business bll = new BLL.t_business();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("sys_business_list.aspx", "telphone={0}&storeName={1}&roleId={2}&stateId={3}", telphone, storeName, roleId, stateId));
        }
 private void ShowInfo(int _id)
 {
     BLL.t_business   bll   = new BLL.t_business();
     Model.t_business model = bll.GetModel(_id);
     //ddl_IsManage.SelectedValue = model.IsManage.ToString();
     txt_TrueName.Text = model.TrueName;
     //txt_AgentCode.Text = model.AgentCode;
     txt_Nickname.Text        = model.Nickname;
     ddl_Gender.SelectedValue = model.Gender.ToString();
     img_AvatarUrl.ImageUrl   = model.AvatarUrl;
     txt_PhoneNumber.Text     = model.PhoneNumber;
     txt_Country.Text         = model.Country;
     txt_Province.Text        = model.Province;
     txt_City.Text            = model.City;
     txt_NativePlace.Text     = model.NativePlace;
     txt_Height.Text          = model.Height.ToString();
     txt_Birthday.Text        = model.Birthday.ToString();
 }
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page         = DTRequest.GetQueryInt("page", 1);
            txtTelPhone.Text  = this.telphone;
            txtStoreName.Text = this.storeName;
            ddl_Role.Text     = this.roleId;
            ddl_State.Text    = this.stateId;

            BLL.t_business bll = new BLL.t_business();
            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("sys_business_list.aspx", "telphone={0}&storeName={1}&roleId={2}&stateId={3}&page={4}", telphone, storeName, roleId, stateId, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
예제 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(LingLong.Admin.Model.t_templatemessage model)
 {
     //发送消息
     BLL.t_message meaagebll = new BLL.t_message();
     if (model.Type == 1)
     {
         //服务人员 需要门店信息
         BLL.t_business businessbll = new BLL.t_business();
         var            result      = businessbll.GetListOther(string.Format(" b.OpenId='{0}' ", model.OpenId));
         if (result.Tables[0].Rows.Count == 0)
         {
             meaagebll.Add(new Model.t_message
             {
                 StoreId      = 1,
                 SendOpenId   = "System",
                 SendUserId   = 1,
                 AcceptOpenId = model.OpenId,
                 AcceptUserId = 1,
                 Content      = model.Message,
                 MessageType  = 0,
                 SendTime     = DateTime.Now,
                 State        = 0,
                 IsDeleted    = 0,
                 CreationTime = DateTime.Now
             });
         }
         else
         {
             for (int i = 0; i < result.Tables[0].Rows.Count; i++)
             {
                 var openid  = result.Tables[0].Rows[i]["OpenId"].ToString();
                 var storeid = result.Tables[0].Rows[i]["StoreId"].ToString();
                 var id      = result.Tables[0].Rows[i]["BusinessId"].ToString();
                 meaagebll.Add(new Model.t_message
                 {
                     StoreId      = int.Parse(storeid),
                     SendOpenId   = "System",
                     SendUserId   = 1,
                     AcceptOpenId = openid,
                     AcceptUserId = int.Parse(id),
                     Content      = model.Message,
                     MessageType  = 0,
                     SendTime     = DateTime.Now,
                     State        = 0,
                     IsDeleted    = 0,
                     CreationTime = DateTime.Now
                 });
             }
         }
     }
     if (model.Type == 2)
     {
         //客户
         BLL.t_customer customerbll = new BLL.t_customer();
         var            result      = customerbll.GetList(" IsDeleted=0 and CustomerType=0");
         for (int i = 0; i < result.Tables[0].Rows.Count; i++)
         {
             var openid = result.Tables[0].Rows[i]["OpenId"].ToString();
             var id     = result.Tables[0].Rows[i]["ID"].ToString();
             meaagebll.Add(new Model.t_message
             {
                 StoreId      = 1,
                 SendOpenId   = "System",
                 SendUserId   = 1,
                 AcceptOpenId = openid,
                 AcceptUserId = int.Parse(id),
                 Content      = model.Message,
                 MessageType  = 0,
                 SendTime     = DateTime.Now,
                 State        = 0,
                 IsDeleted    = 0,
                 CreationTime = DateTime.Now
             });
         }
     }
     if (model.Type == 3)
     {
         //服务人员 需要门店信息
         BLL.t_business businessbll = new BLL.t_business();
         var            result      = businessbll.GetListOther("");
         for (int i = 0; i < result.Tables[0].Rows.Count; i++)
         {
             var openid  = result.Tables[0].Rows[i]["OpenId"].ToString();
             var storeid = result.Tables[0].Rows[i]["StoreId"].ToString();
             var id      = result.Tables[0].Rows[i]["BusinessId"].ToString();
             meaagebll.Add(new Model.t_message
             {
                 StoreId      = int.Parse(storeid),
                 SendOpenId   = "System",
                 SendUserId   = 1,
                 AcceptOpenId = openid,
                 AcceptUserId = int.Parse(id),
                 Content      = model.Message,
                 MessageType  = 0,
                 SendTime     = DateTime.Now,
                 State        = 0,
                 IsDeleted    = 0,
                 CreationTime = DateTime.Now
             });
         }
     }
     return(dal.Add(model));
 }