/// <summary>
        /// 获取服务器列表
        /// </summary>
        private void GetServerList()
        {
            string  sUrl   = domin + "/index.php/Appclt/getOpSerLst";
            string  result = HttpHelper.HttpPost(sUrl, string.Empty);
            JObject job    = JObject.Parse(result);

            if (job["code"].ToString() == "200")
            {
                serverList = JsonConvert.DeserializeObject <List <ServerItem> >(Convert.ToString(job["entity"]));
                var showList = new List <ServerTextValue>();
                foreach (var item in serverList)
                {
                    showList.Add(new ServerTextValue()
                    {
                        value = item.serverid.ToString(),
                        text  = string.Format("{0} ({1}人在线) {2}M/秒", item.name, item.node_connector, item.traffic_rate)
                    });
                }
                this.ServerlistBox.DataSource = showList;
            }
            else
            {
                TipHelper.Alert(Convert.ToString(job["msg"]));
            }
        }
        /// <summary>
        /// 登录操作
        /// </summary>
        /// <param name="own_mob_no"></param>
        /// <param name="own_pwd"></param>
        /// <param name="vercode"></param>
        private void LoginOperate(string own_mob_no, string own_pwd, string vercode)
        {
            string  sUrl   = domin + "/index.php/Appclt/login";
            string  body   = string.Format("own_mob_no={0}&own_pwd={1}&vercode={2}", own_mob_no, own_pwd, vercode);
            string  result = HttpHelper.HttpPost(sUrl, body);
            JObject job    = JObject.Parse(result);

            if (job["code"].ToString() == "200")
            {
                var      user    = JsonConvert.DeserializeObject <UserInfo>(Convert.ToString(job["entity"]));
                TimeSpan d3      = user.expire_in.Subtract(DateTime.Now);
                double   seconds = d3.TotalSeconds;
                //缓存用户信息
                CacheHelper.SetCache("UserInfo", user, seconds);

                //弹出窗体
                NewConfigForm cf = new NewConfigForm();
                cf.Show();
                this.Hide();//隐藏登录窗体
            }
            else
            {
                this.LoginBtn.Enabled = true;//启用按钮
                TipHelper.Alert(Convert.ToString(job["msg"]));
                //登录失败更新验证码
                GetImagesCode();
            }
        }
Пример #3
0
        public ActionResult Save(FormCollection f, P_CommodityType info)
        {
            int count = 0;

            if (info.Id > 0)
            {
                count = SugarFactory.GetInstance().Updateable <P_CommodityType>(info).ExecuteCommand();
            }
            else
            {
                count = SugarFactory.GetInstance().Insertable <P_CommodityType>(info).ExecuteCommand();
            }
            if (info.Id == 0)
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("新增类别成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增类别失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
            else
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("更新类别成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("更新类别失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
        }
Пример #4
0
 private void btnEncodeQRCoder_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtContent.Text))
     {
         TipHelper.TipMsg(this, $"请输入标签内容!");
     }
     gbxQRCoder.BackgroundImage = GenerateQRCcodes(txtContent.Text, (int)numPixelsPerModule.Value);
 }
Пример #5
0
        public ActionResult DeleteMerchantInfo(string code)
        {
            int rcount = SugarFactory.GetInstance().Deleteable <P_MerchantInfo>().Where(it => it.Merchant_Code == Guid.Parse(code)).ExecuteCommand();

            if (rcount > 0)
            {
                return(Json(TipHelper.JsonData("删除成功!", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));;
            }
            else
            {
                return(Json(TipHelper.JsonData("删除失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
            }
        }
Пример #6
0
        public ActionResult Save(FormCollection fc, P_User cm)
        {
            int rcount = 0;

            if (!String.IsNullOrEmpty(cm.User_Pwd))
            {
                cm.User_Pwd = Encryption.GetMd5(cm.User_Pwd);
            }
            else
            {
                P_User pu = SugarFactory.GetInstance().Queryable <P_User>().InSingle(cm.User_Code);
                cm.User_Pwd = pu.User_Pwd;
            }
            if (Convert.ToInt32(fc["Id"]) > 0)
            {
                rcount = SugarFactory.GetInstance().Updateable <P_User>(cm).ExecuteCommand();
            }
            else
            {
                rcount = SugarFactory.GetInstance().Insertable <P_User>(cm).ExecuteCommand();
            }
            string formOperateType = fc["formOperateType"].ToString().ToLower();

            if (formOperateType == "saveandnewnext")
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("新增用户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增用户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
            else
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("保存用户信息成功!", "/UserInfo/UserList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage)));
                }
                else
                {
                    //表单提交失败固定写法
                    return(Json(TipHelper.JsonData("保存用户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
        }
Пример #7
0
        public ActionResult SaveRoles(FormCollection f, P_SystemRoles info)
        {
            int count = 0;

            if (info.Role_Id > 0)
            {
                count = SugarFactory.GetInstance().Updateable <P_SystemRoles>(info).ExecuteCommand();
            }
            else
            {
                count = SugarFactory.GetInstance().Insertable <P_SystemRoles>(info).ExecuteCommand();
            }
            SugarFactory.GetInstance().Deleteable <P_RolesToMenu>().Where(it => it.RTM_Roles_Code == info.Role_Code).ExecuteCommand();
            if (!String.IsNullOrEmpty(info.MenuCodes))
            {
                string[] strs = info.MenuCodes.TrimEnd(',').Split(',');
                foreach (string item in strs)
                {
                    P_RolesToMenu rtm = new P_RolesToMenu();
                    rtm.RTM_Menu_Code  = Guid.Parse(item);
                    rtm.RTM_Roles_Code = info.Role_Code;
                    SugarFactory.GetInstance().Insertable <P_RolesToMenu>(rtm).ExecuteCommand();
                }
            }
            if (info.Role_Id == 0)
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("新增角色成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增角色失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
            else
            {
                if (count > 0)
                {
                    return(Json(TipHelper.JsonData("更新角色成功!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("更新角色失败!", "", IsAlertTip.No, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.CloseDialogAndRefreshThisPage)));
                }
            }
        }
Пример #8
0
 private void PrintCoder(Bitmap coderImage)
 {
     printCoderImage = coderImage;
     printDocument1  = new PrintDocument();
     printDocument1.PrintController = new StandardPrintController(); //不要打印进度框
     printDocument1.DefaultPageSettings.Landscape = false;           //设置打印横向还是纵向
     printDocument1.PrintPage += new PrintPageEventHandler(MyPrintDoc1_PrintPage);
     try
     {
         printDocument1.Print();
         printDocument1.PrintPage -= new PrintPageEventHandler(MyPrintDoc1_PrintPage);
     }
     catch (Exception ex)
     {
         TipHelper.TipMsg(this, $"打印异常:{ex.Message}");
     }
     printCoderImage = null;
 }
        /// <summary>
        /// 接入服务操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ServerBtn_Click(object sender, EventArgs e)
        {
            string  sUrl   = domin + "/index.php/Appclt/accessact";
            var     item   = this.ServerlistBox.SelectedItem as ServerTextValue;//获取当前的选中的服务器
            string  body   = "serverid=" + item.value;
            string  result = HttpHelper.HttpPost(sUrl, body);
            JObject job    = JObject.Parse(result);

            if (job["code"].ToString() == "200")
            {
                //创建服务
                Server server = new Server();
                RunServer(server);
            }
            else
            {
                TipHelper.Alert(Convert.ToString(job["msg"]));
            }
        }
 /// <summary>
 /// 用户登录操作
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Login(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.UserName.Text))
     {
         TipHelper.Alert("用户名不能为空!");
         return;
     }
     if (string.IsNullOrWhiteSpace(this.UserPwd.Text))
     {
         TipHelper.Alert("密码不能为空!");
         return;
     }
     if (string.IsNullOrWhiteSpace(this.Code.Text))
     {
         TipHelper.Alert("验证码不能为空!");
         return;
     }
     this.LoginBtn.Enabled = false;//禁用按钮
     LoginOperate(this.UserName.Text, this.UserPwd.Text, this.Code.Text);
 }
Пример #11
0
 /// <summary>
 /// 被要求使用指定卡时的使用返回
 /// </summary>
 /// <param name="game"></param>
 /// <param name="useLimt"></param>
 /// <param name="useInfo"></param>
 /// <param name="nextRequest"></param>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool CheckLimit(Game game, UseLimitCard useLimt, FreeUse useInfo, ref NextRequest nextRequest, Card card)
 {
     if (useLimt.CardType != CardHelper.getId(card))
     {
         return(false);
     }
     else
     {
         if (useInfo.Source.Count != 1)
         {
             nextRequest = new CardChooseRequest()
             {
                 RequestInfo = TipHelper.GetText("UseLimitTip", card.Name),
             };
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }
Пример #12
0
        public ActionResult Save(FormCollection fc, AdminPanel.CodeModels.P_MerchantInfo cm)
        {
            int rcount = 0;

            if (Convert.ToInt32(fc["Id"]) > 0)
            {
                rcount = SugarFactory.GetInstance().Updateable <P_MerchantInfo>(cm).ExecuteCommand();
            }
            else
            {
                rcount = SugarFactory.GetInstance().Insertable <P_MerchantInfo>(cm).ExecuteCommand();
            }
            string formOperateType = fc["formOperateType"].ToString().ToLower();

            if (formOperateType == "saveandnewnext")
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("新增商户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));
                }
                else
                {
                    return(Json(TipHelper.JsonData("新增商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
            else
            {
                if (rcount > 0)
                {
                    return(Json(TipHelper.JsonData("保存商户信息成功!", "/MerchantInfo/MerchantInfoList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage)));
                }
                else
                {
                    //表单提交失败固定写法
                    return(Json(TipHelper.JsonData("保存商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction)));
                }
            }
        }
Пример #13
0
        /// <summary>
        /// 输出条码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEncode_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtContent.Text))
            {
                TipHelper.TipMsg(this, $"请输入标签内容!");
            }

            errorProvider1.Clear();
            int W = Convert.ToInt32(this.txtWidth.Text.Trim());
            int H = Convert.ToInt32(this.txtHeight.Text.Trim());

            bar.Alignment = BarcodeLib.AlignmentPositions.CENTER;

            //条形码对齐
            switch (cbBarcodeAlign.SelectedItem.ToString().Trim().ToLower())
            {
            case "left": bar.Alignment = BarcodeLib.AlignmentPositions.LEFT; break;

            case "right": bar.Alignment = BarcodeLib.AlignmentPositions.RIGHT; break;

            default: bar.Alignment = BarcodeLib.AlignmentPositions.CENTER; break;
            }

            BarcodeLib.TYPE type = BarcodeLib.TYPE.UNSPECIFIED;
            switch (cbEncodeType.SelectedItem.ToString().Trim())
            {
            case "UPC-A": type = BarcodeLib.TYPE.UPCA; break;

            case "UPC-E": type = BarcodeLib.TYPE.UPCE; break;

            case "UPC 2 Digit Ext.": type = BarcodeLib.TYPE.UPC_SUPPLEMENTAL_2DIGIT; break;

            case "UPC 5 Digit Ext.": type = BarcodeLib.TYPE.UPC_SUPPLEMENTAL_5DIGIT; break;

            case "EAN-13": type = BarcodeLib.TYPE.EAN13; break;

            case "JAN-13": type = BarcodeLib.TYPE.JAN13; break;

            case "EAN-8": type = BarcodeLib.TYPE.EAN8; break;

            case "ITF-14": type = BarcodeLib.TYPE.ITF14; break;

            case "Codabar": type = BarcodeLib.TYPE.Codabar; break;

            case "PostNet": type = BarcodeLib.TYPE.PostNet; break;

            case "Bookland/ISBN": type = BarcodeLib.TYPE.BOOKLAND; break;

            case "Code 11": type = BarcodeLib.TYPE.CODE11; break;

            case "Code 39": type = BarcodeLib.TYPE.CODE39; break;

            case "Code 39 Extended": type = BarcodeLib.TYPE.CODE39Extended; break;

            case "Code 39 Mod 43": type = BarcodeLib.TYPE.CODE39_Mod43; break;

            case "Code 93": type = BarcodeLib.TYPE.CODE93; break;

            case "LOGMARS": type = BarcodeLib.TYPE.LOGMARS; break;

            case "MSI": type = BarcodeLib.TYPE.MSI_Mod10; break;

            case "Interleaved 2 of 5": type = BarcodeLib.TYPE.Interleaved2of5; break;

            case "Standard 2 of 5": type = BarcodeLib.TYPE.Standard2of5; break;

            case "Code 128": type = BarcodeLib.TYPE.CODE128; break;

            case "Code 128-A": type = BarcodeLib.TYPE.CODE128A; break;

            case "Code 128-B": type = BarcodeLib.TYPE.CODE128B; break;

            case "Code 128-C": type = BarcodeLib.TYPE.CODE128C; break;

            case "Telepen": type = BarcodeLib.TYPE.TELEPEN; break;

            case "FIM": type = BarcodeLib.TYPE.FIM; break;

            case "Pharmacode": type = BarcodeLib.TYPE.PHARMACODE; break;

            default: TipHelper.TipMsg(this, "请指定条码编码类型!"); break;
            }

            try
            {
                if (type != BarcodeLib.TYPE.UNSPECIFIED)
                {
                    try
                    {
                        bar.BarWidth = textBoxBarWidth.Text.Trim().Length < 1 ? null : (int?)Convert.ToInt32(textBoxBarWidth.Text.Trim());
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Unable to parse BarWidth: " + ex.Message, ex);
                    }
                    try
                    {
                        bar.AspectRatio = textBoxAspectRatio.Text.Trim().Length < 1 ? null : (double?)Convert.ToDouble(textBoxAspectRatio.Text.Trim());
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Unable to parse AspectRatio: " + ex.Message, ex);
                    }

                    bar.IncludeLabel = this.chkGenerateLabel.Checked;

                    bar.RotateFlipType = (RotateFlipType)Enum.Parse(typeof(RotateFlipType), this.cbRotateFlip.SelectedItem.ToString(), true);

                    //标签对齐和位置
                    switch (this.cbLabelLocation.SelectedItem.ToString().Trim().ToUpper())
                    {
                    case "BOTTOMLEFT": bar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMLEFT; break;

                    case "BOTTOMRIGHT": bar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMRIGHT; break;

                    case "TOPCENTER": bar.LabelPosition = BarcodeLib.LabelPositions.TOPCENTER; break;

                    case "TOPLEFT": bar.LabelPosition = BarcodeLib.LabelPositions.TOPLEFT; break;

                    case "TOPRIGHT": bar.LabelPosition = BarcodeLib.LabelPositions.TOPRIGHT; break;

                    default: bar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER; break;
                    }

                    //===== 此处执行编码 =====
                    gbxBarCoder.BackgroundImage = bar.Encode(type, this.txtContent.Text.Trim(), this.btnForeColor.BackColor, this.btnBackColor.BackColor, W, H);
                    //===================================

                    //显示编码耗时
                    this.lblEncodingTime.Text = "(" + Math.Round(bar.EncodingTime, 0, MidpointRounding.AwayFromZero).ToString() + "ms)";

                    txtEncoded.Text = bar.EncodedValue;

                    //读取动态计算的宽度/高度,因为用户感兴趣。
                    if (bar.BarWidth.HasValue)
                    {
                        txtWidth.Text = bar.Width.ToString();
                    }
                    if (bar.AspectRatio.HasValue)
                    {
                        txtHeight.Text = bar.Height.ToString();
                    }
                }//if

                //条形码图像重新定位到中间
                gbxBarCoder.Location = new Point((this.gbxBarCoder.Location.X + this.gbxBarCoder.Width / 2) - gbxBarCoder.Width / 2, (this.gbxBarCoder.Location.Y + this.gbxBarCoder.Height / 2) - gbxBarCoder.Height / 2);
            }
            catch (Exception ex)
            {
                TipHelper.TipMsg(this, $"{ex.Message}");
            }
        }
Пример #14
0
 public ActionResult DeleteRoles(string code)
 {
     SugarFactory.GetInstance().Deleteable <P_SystemRoles>().Where(it => it.Role_Code == Guid.Parse(code)).ExecuteCommand();
     return(Json(TipHelper.JsonData("删除成功!", "AnyTimeList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage)));
 }