Exemplo n.º 1
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.t_customer   bll   = new BLL.t_customer();
            Model.t_customer model = bll.GetModel(_id);
            model.ID                   = _id;
            model.CustomerType         = Convert.ToInt32(ddl_CustomerType.SelectedValue);
            model.TrueName             = txt_TrueName.Text;
            model.Wechat               = txt_Wechat.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);
        }
Exemplo n.º 2
0
        private bool DoAdd()
        {
            Model.t_customer model = new Model.t_customer();
            BLL.t_customer   bll   = new BLL.t_customer();
            model.CustomerType = Convert.ToInt32(ddl_CustomerType.SelectedValue);
            model.TrueName     = txt_TrueName.Text;
            model.Wechat       = txt_Wechat.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);
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_customer", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.t_customer bll = new BLL.t_customer();
            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_customer_list.aspx", "telphone={0}&nickname={1}", telphone, nickname));
        }
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);

            txtTelPhone.Text = this.telphone;
            txtNickname.Text = this.nickname;

            BLL.t_customer bll = new BLL.t_customer();
            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_customer_list.aspx", "telphone={0}&nickname={1}&page={2}", telphone, nickname, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 5
0
 private void ShowInfo(int _id)
 {
     BLL.t_customer   bll   = new BLL.t_customer();
     Model.t_customer model = bll.GetModel(_id);
     ddl_CustomerType.SelectedValue = model.CustomerType.ToString();
     txt_TrueName.Text        = model.TrueName;
     txt_Wechat.Text          = model.Wechat;
     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();
 }
Exemplo n.º 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));
 }