/// <summary>
 /// 确定事件
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (WeChatId > 0)
     {
         string pidText = string.Empty;
         int    result  = 0;
         if (SelectedRow != null)
         {
             int.TryParse(SelectedRow["id"].Value.ToString(), out result);
             pidText = SelectedRow["pid"].Value.ToString();
         }
         Loading ld = new Loading();
         ((Action)(delegate()
         {
             if (LogicHotTao.Instance(MyUserInfo.currentUserId).UpdateUserWeChatGroup(WeChatId, pidText))
             {
                 pidText = result > 0 ? pidText : "";
             }
             ld.CloseForm();
             this.BeginInvoke((Action)(delegate()   //等待结束
             {
                 this.Close();
                 hotTask.SetWeChatRowData(CurrentRowIndex, "pid", pidText);
             }));
         })).BeginInvoke(null, null);
         ld.ShowDialog(hotForm);
     }
 }
        /// <summary>
        /// 保存操作
        /// </summary>
        public void Save()
        {
            MessageAlert alert    = new MessageAlert();
            Loading      ld       = new Loading();
            string       tempText = txtTempText.Text;

            ((Action)(delegate()
            {
                if (LogicUser.Instance.AddUserSendTemplate(MyUserInfo.LoginToken, tempText))
                {
                    alert.Message = "保存成功";
                }
                else
                {
                    alert.Message = "保存失败";
                }
                ld.CloseForm();
                this.BeginInvoke((Action)(delegate()
                {
                    MyUserInfo.sendtemplate = tempText;
                    alert.ShowDialog(this);
                }));
            })).BeginInvoke(null, null);
            ld.ShowDialog(this);
        }
Esempio n. 3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtKeyword.Text))
            {
                txtKeyword.Focus();
                return;
            }
            if (ckbAutoText.Checked)
            {
                if (string.IsNullOrEmpty(txtReplyContent.Text))
                {
                    txtReplyContent.Focus();
                    return;
                }
            }
            int flag      = 0;
            int replyType = 0;

            if (ckbAutoText.Checked)
            {
                replyType = 0;
            }
            if (ckbAutoGoods.Checked)
            {
                replyType = 1;
            }


            string keyword = txtKeyword.Text;
            string content = txtReplyContent.Text;

            MessageAlert alert = new MessageAlert();
            Loading      ld    = new Loading();

            ((Action)(delegate()
            {
                flag = LogicUser.Instance.AddReplyKeyword(MyUserInfo.LoginToken, keyword, content, replyType, 0) ? 1 : 0;
                ld.CloseForm();
                if (flag > 0)
                {
                    alert.Message = "添加成功";
                }
                else
                {
                    alert.Message = "添加失败,请稍候再试!";
                }
                this.BeginInvoke((Action)(delegate()
                {
                    alert.ShowDialog(this);
                    if (flag > 0)
                    {
                        hotControl.LoadDgvKeyword();
                        this.Close();
                    }
                }));
            })).BeginInvoke(null, null);
            ld.ShowDialog(hotForm);
        }
Esempio n. 4
0
 private void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         if (isLogining)
         {
             return;
         }
         if (string.IsNullOrEmpty(loginName.Text))
         {
             lbTipMsg.Text = "请输入登录账户!";
             loginName.Focus();
             return;
         }
         if (string.IsNullOrEmpty(loginPwd.Text))
         {
             lbTipMsg.Text = "请输入登录密码!";
             loginPwd.Focus();
             return;
         }
         string  lgname     = loginName.Text;
         string  pwd        = EncryptHelper.MD5(loginPwd.Text);
         string  verifyCode = "";
         Loading ld         = new Loading();
         ((Action)(delegate()
         {
             var data = LogicUser.Instance.Register(lgname, pwd, verifyCode, (err) =>
             {
                 if (err != null && err.resultCode != 200)
                 {
                     this.BeginInvoke((Action)(delegate()   //等待结束
                     {
                         lbTipMsg.Text = err.resultMsg;
                     }));
                 }
             });
             ld.CloseForm();
             if (data != null)
             {
                 this.BeginInvoke((Action)(delegate()   //等待结束
                 {
                     loginForm.openControl(new LoginPage(hotForm, loginForm));
                 }));
             }
         })).BeginInvoke(null, null);
         ld.ShowDialog(this);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message);
         this.BeginInvoke((Action)(delegate()   //等待结束
         {
             lbTipMsg.Text = "连接服务器失败!";
         }));
     }
 }
Esempio n. 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MessageAlert alert = new MessageAlert();
            Loading      ld    = new Loading();

            ((Action)(delegate()
            {
                hotForm.myConfig.enable_autoremove = ckbAutoRemove.Checked ? 1 : 0;

                AutoRemoveUserWhereModel auto_remove_user_where = new AutoRemoveUserWhereModel();
                auto_remove_user_where.enable_send_text = ckbSendMessage.Checked ? 1 : 0;
                auto_remove_user_where.enable_send_image = ckbSendImage.Checked ? 1 : 0;
                auto_remove_user_where.enable_share_card = ckbSendCard.Checked ? 1 : 0;
                auto_remove_user_where.enable_share_link = ckbSendLink.Checked ? 1 : 0;

                int result = 0;

                int.TryParse(txtSendImageCount.Text, out result);
                auto_remove_user_where.send_image_count = result > 0 ? result : 2;

                //发送文本的长度
                int.TryParse(txtSendTextLenght.Text, out result);
                auto_remove_user_where.send_text_lenght = result > 0 ? result : 20;

                ConfigWhereModel cfgWhere = string.IsNullOrEmpty(hotForm.myConfig.where_config) ? null : JsonConvert.DeserializeObject <ConfigWhereModel>(hotForm.myConfig.where_config);

                cfgWhere.auto_remove_user_where = JsonConvert.SerializeObject(auto_remove_user_where);

                hotForm.myConfig.where_config = JsonConvert.SerializeObject(cfgWhere);
                int flag = LogicUser.Instance.AddUserConfigModel(MyUserInfo.LoginToken, hotForm.myConfig);

                ld.CloseForm();
                this.BeginInvoke((Action)(delegate()   //等待结束
                {
                    alert.Message = flag > 0 ? "保存成功" : "保存失败";
                    alert.ShowDialog(this);
                }));
            })).BeginInvoke(null, null);
            ld.ShowDialog(hotForm);
        }
Esempio n. 6
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            try
            {
                if (isLogining)
                {
                    return;
                }
                if (string.IsNullOrEmpty(loginName.Text))
                {
                    AlertTip("请输入登录账户");
                    loginName.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(loginPwd.Text))
                {
                    AlertTip("请输入登录密码!");
                    loginPwd.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtRegisterVerifyCode.Text))
                {
                    AlertTip("请输入验证码!");
                    txtRegisterVerifyCode.Focus();
                    return;
                }


                string lgname     = loginName.Text;
                string pwd        = EncryptHelper.MD5(loginPwd.Text);
                string verifyCode = txtRegisterVerifyCode.Text;
                string code       = txtCode.Text;
                isLogining = true;
                Loading ld = new Loading();
                ((Action)(delegate()
                {
                    var data = LogicUser.Instance.Register(lgname, pwd, verifyCode, (err) =>
                    {
                        if (err != null && err.resultCode != 200)
                        {
                            this.BeginInvoke((Action)(delegate()   //等待结束
                            {
                                MessageAlert alert = new MessageAlert(err.resultMsg, "提示");
                                alert.StartPosition = FormStartPosition.CenterScreen;
                                alert.Show();
                            }));
                        }
                        isLogining = false;
                    }, code);
                    ld.CloseForm();
                    if (data != null)
                    {
                        AlertTip("注册成功!");
                        isLogining = false;
                        this.BeginInvoke((Action)(delegate()   //等待结束
                        {
                            loginForm.openControl(new LoginPage(hotForm, loginForm));
                        }));
                    }
                })).BeginInvoke(null, null);
                ld.ShowDialog(this);
            }
            catch (Exception ex)
            {
                AlertTip("连接服务器失败!");
                log.Error(ex.Message);
            }
        }
Esempio n. 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MessageAlert alert = new MessageAlert();

            if (string.IsNullOrEmpty(txtTaskTitle.Text))
            {
                alert.Message = "请输入任务标题";
                alert.ShowDialog(this);
                txtTaskTitle.Focus();
                return;
            }

            if (string.IsNullOrEmpty(txtStartTime.Text))
            {
                txtStartTime.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtEndTime.Text))
            {
                txtEndTime.Focus();
                return;
            }
            string goodsText = JsonConvert.SerializeObject(hotGoodsText);
            string pidsText  = JsonConvert.SerializeObject(hotPidsText);

            TaskPlanModel model = new TaskPlanModel()
            {
                userid    = MyUserInfo.currentUserId,
                title     = txtTaskTitle.Text,
                startTime = Convert.ToDateTime(txtStartTime.Text),
                endTime   = Convert.ToDateTime(txtEndTime.Text),
                pidsText  = pidsText,
                goodsText = goodsText,
                id        = taskid
            };
            Loading ld = new Loading();

            ((Action)(delegate()
            {
                //TaskPlanModel data = LogicTaskPlan.Instance.addTaskPlan(MyUserInfo.LoginToken, model);
                TaskPlanModel data = LogicHotTao.Instance(MyUserInfo.currentUserId).AddUserTaskPlan(model);
                ld.CloseForm();
                if (data != null)
                {
                    this.BeginInvoke((Action)(delegate()   //等待结束
                    {
                        if (hotTask != null)
                        {
                            hotTask.SetTaskView(data, taskid > 0 ? CurrentRowIndex : -1);
                        }

                        if (hotHistoryTask != null)
                        {
                            hotHistoryTask.LoadTaskPlanGridView();
                        }

                        txtTaskTitle.Clear();
                        alert.Message = "保存成功";
                        alert.CallBack += () => { this.Close(); };
                        alert.ShowDialog(this);
                    }));
                }
                else
                {
                    this.BeginInvoke((Action)(delegate()   //等待结束
                    {
                        alert.Message = "保存失败";
                        alert.ShowDialog(this);
                    }));
                }
            })).BeginInvoke(null, null);
            ld.ShowDialog(hotForm);
        }
Esempio n. 8
0
        public void Save()
        {
            int     result  = 0;
            decimal result2 = 0;

            hotForm.myConfig.userid = MyUserInfo.currentUserId;
            ConfigSendTimeModel cfgTime = string.IsNullOrEmpty(hotForm.myConfig.send_time_config) ? new ConfigSendTimeModel() : JsonConvert.DeserializeObject <ConfigSendTimeModel>(hotForm.myConfig.send_time_config);

            cfgTime = cfgTime == null ? new ConfigSendTimeModel() : cfgTime;


            //淘宝API
            cfgTime.appkey    = txtTaoAppKey.Text;
            cfgTime.appsecret = txtTaoAppSecret.Text;


            //商品间隔
            int.TryParse(txtgoodsinterval.Text, out result);
            cfgTime.goodsinterval = result < 0 ? 35 : result;

            //操作间隔
            decimal result3 = 0;

            decimal.TryParse(txthandleInterval.Text, out result3);
            cfgTime.hdInterval = result3 == 0 ? 1 : result3;

            //任务间隔
            int.TryParse(txtTaskInterval.Text, out result);
            cfgTime.taskinterval = result == 0 ? 30 : result;
            //图文顺序
            cfgTime.imagetextsort = rbTwSort.Checked ? 0 : 1;

            //发送模式
            cfgTime.sendmode = rdSendWindows.Checked ? 0 : 1;

            MyUserInfo.sendmode = cfgTime.sendmode;

            //过滤条件
            ConfigWhereModel cfgWhere = string.IsNullOrEmpty(hotForm.myConfig.where_config) ? new ConfigWhereModel() : JsonConvert.DeserializeObject <ConfigWhereModel>(hotForm.myConfig.where_config);

            cfgWhere = cfgWhere == null ? new ConfigWhereModel() : cfgWhere;

            //优惠券过期
            cfgWhere.minCouponDateDayCountEnable = ckbminCouponDayCount.Checked ? 1 : 0;
            int.TryParse(txtminCouponDateDayCount.Text, out result);
            cfgWhere.minCouponDateDayCount = result;

            //优惠券数量
            cfgWhere.minCouponAmountEnable = ckbCoupon.Checked ? 1 : 0;
            int.TryParse(txtminCouponAmount.Text, out result);
            cfgWhere.minCouponAmount = result;

            //月销量
            cfgWhere.minMonthSalesAmountEnable = ckbMonthSales.Checked ? 1 : 0;
            int.TryParse(txtminMonthSalesAmount.Text, out result);
            cfgWhere.minMonthSalesAmount = result;


            //佣金比率
            cfgWhere.minCmsRateAmountEnable = ckbCmsRate.Checked ? 1 : 0;
            decimal.TryParse(txtminCmsRateAmount.Text, out result2);
            cfgWhere.minCmsRateAmount = result2;

            //商品价格
            cfgWhere.GoodsPriceEnable = ckbGoodsPrice.Checked ? 1 : 0;
            decimal.TryParse(txtminGoodsPrice.Text, out result2);
            cfgWhere.minGoodsPrice = result2;
            decimal.TryParse(txtmaxGoodsPrice.Text, out result2);
            cfgWhere.maxGoodsPrice = result2;

            //过滤今日重复商品
            cfgWhere.filterGoodsEnable = ckbfilterGoods.Checked ? 1 : 0;

            ConfigModel myConfig = hotForm.myConfig;

            myConfig.send_time_config = JsonConvert.SerializeObject(cfgTime);
            myConfig.where_config     = JsonConvert.SerializeObject(cfgWhere);

            MessageAlert alert = new MessageAlert();
            Loading      ld    = new Loading();

            ((Action)(delegate()
            {
                if (LogicUser.Instance.AddUserConfigModel(MyUserInfo.LoginToken, hotForm.myConfig) > 0)
                {
                    alert.Message = "保存成功";
                }
                else
                {
                    alert.Message = "保存失败,请重试";
                }
                ld.CloseForm();
                this.BeginInvoke((Action)(delegate()
                {
                    hotForm.myConfig = myConfig;
                    alert.ShowDialog(this);
                }));
            })).BeginInvoke(null, null);
            ld.ShowDialog(this);
        }
Esempio n. 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            MessageAlert alert = new MessageAlert();

            if (!isJoinImage && string.IsNullOrEmpty(txtTaskTitle.Text))
            {
                alert.Message = "请输入任务标题";
                alert.ShowDialog(this);
                txtTaskTitle.Focus();
                return;
            }
            else
            {
                if (txtTaskTitle.Text.Length > 8)
                {
                    alert.Message = "商品简述最多8个字";
                    alert.ShowDialog(this);
                    txtTaskTitle.Focus();
                    return;
                }
            }
            if (string.IsNullOrEmpty(txtStartTime.Text))
            {
                txtStartTime.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtEndTime.Text))
            {
                txtEndTime.Focus();
                return;
            }
            string goodsText = JsonConvert.SerializeObject(hotGoodsText);
            string pidsText  = JsonConvert.SerializeObject(hotPidsText);

            TaskPlanModel model = new TaskPlanModel()
            {
                userid    = MyUserInfo.currentUserId,
                title     = isJoinImage ? "【合成图片转发】" + txtTaskTitle.Text : txtTaskTitle.Text,
                startTime = Convert.ToDateTime(txtStartTime.Text),
                endTime   = Convert.ToDateTime(txtEndTime.Text),
                pidsText  = pidsText,
                goodsText = goodsText,
                id        = taskid,
                status    = 0,
                isTpwd    = isJoinImage ? 1 : 0
            };
            Loading ld = new Loading();

            ((Action)(delegate()
            {
                TaskPlanModel data = LogicHotTao.Instance(MyUserInfo.currentUserId).AddUserTaskPlan(model);

                if (data != null)
                {
                    if (isJoinImage)
                    {
                        BuildText(Convert.ToInt32(data.id));
                    }
                    ld.CloseForm();
                    this.BeginInvoke((Action)(delegate()   //等待结束
                    {
                        if (hotTask != null)
                        {
                            //hotTask.SetTaskView(data, taskid > 0 ? CurrentRowIndex : -1);
                            hotTask.LoadTaskPlanGridView();
                        }
                        txtTaskTitle.Clear();
                        alert.Message = "保存成功";
                        alert.CallBack += () => { this.Close(); };
                        alert.ShowDialog(this);
                    }));
                }
                else
                {
                    ld.CloseForm();
                    this.BeginInvoke((Action)(delegate()   //等待结束
                    {
                        alert.Message = "保存失败";
                        alert.ShowDialog(this);
                    }));
                }
            })).BeginInvoke(null, null);
            ld.ShowDialog(hotForm);
        }