Ejemplo n.º 1
0
        /// <summary>
        /// 设置Ip
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "您确定要修改么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString() == "Yes")
            {
                string gunark_ip = gunarkIp.Text.Trim();
                string gunark_gatWay = gatWay.Text.Trim();
                string gunark_subNet = subNet.Text.Trim();
                string service_ip = serviceIp.Text.Trim();

                //获取软件版本号和修改日期
                string CurrentSoftVersion = Utils.GetVersion.getSoftVersion();
                try
                {
                    if (Utils.CheckFormate.IsIpaddress(gunark_ip) && Utils.CheckFormate.IsIpaddress(service_ip))
                    {
                        Utils.SettingIp.SetIPAddress(gunark_ip, gunark_subNet, gunark_gatWay);

                        Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                        cfa.AppSettings.Settings["gunark_ip"].Value = gunark_ip;
                        cfa.AppSettings.Settings["service_ip"].Value = service_ip;
                        cfa.AppSettings.Settings["version"].Value = CurrentSoftVersion;
                        cfa.AppSettings.Settings["updateTime"].Value = DateTime.Now.ToLocalTime().ToString();
                        cfa.Save(); ConfigurationManager.RefreshSection("appSettings");
                        ConfigurationManager.RefreshSection("appSettings");
                    }
                    else
                    {
                        MessageBox.Show(this, "您输入的IP地址格式不正确!正确格式为【192.168.1.1】", "提示");
                    }
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                }
                //同步枪柜信息
                Utils.SynInfo.getSynInfo();
                Model.gunark g = new Bll.gunark().GetModelByIp(gunark_ip);
                if (g == null)
                {
                    MessageBox.Show("请先在服务器端添加枪柜!!!");
                    return;
                }
                Configuration cfa1 = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                cfa1.AppSettings.Settings["gunark_id"].Value = g.GUNARK_ID;
                cfa1.AppSettings.Settings["unit_id"].Value = g.UNITINFO_CODE;
                cfa1.AppSettings.Settings["first_run"].Value = "False";
                cfa1.Save(); ConfigurationManager.RefreshSection("appSettings");
                ConfigurationManager.RefreshSection("appSettings");
                //同步枪弹绑定信息
                //Bll.gbg gbg_bll = new Gunark.BLL.gbg();
                ////WebService接口调用工具
                //WebService.gunServices webService = SingleWebService.getWebService();
                //WebService.gunarkGroupGunBullet[] gggb = webService.getGunarkGroupGunBullet(ConfigurationManager.AppSettings["gunark_id"]);
                //for (int i = 0; i < gggb.Length; i++)
                //{
                //    Model.gbg gbg = new Gunark.Model.gbg();
                //    gbg.GGGBID = gggb[i].gggbId;
                //    gbg.GUNARK_ID = gggb[i].gunarkId;
                //    gbg.GUN_LOCATION = gggb[i].gunLocation;
                //    gbg.BULLET_LOCATION = int.Parse(gggb[i].bulletLocation);
                //    gbg.GROUP_ID = gggb[i].groupId;
                //    gbg_bll.Add(gbg);
                //}
                _isSuccess = true;
                this.Close();
            }
        }
Ejemplo n.º 2
0
        public static void analysis(WebService.synInfo synInfo)
        {
            WebService.gunServices webService = SingleWebService.getWebService();
            #region model
            Model.gunark      gunark      = new Gunark.Model.gunark();
            Model.user        user        = new Gunark.Model.user();
            Model.group       group       = new Gunark.Model.group();
            Model.gbg         gbg         = new Gunark.Model.gbg();
            Model.fingerprint fingerPrint = new Gunark.Model.fingerprint();
            #endregion model
            #region bll
            Bll.user        user_bll        = new Gunark.BLL.user();
            Bll.gunark      gunark_bll      = new Gunark.BLL.gunark();
            Bll.group       group_bll       = new Gunark.BLL.group();
            Bll.gbg         gbg_bll         = new Gunark.BLL.gbg();
            Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint();
            #endregion bll
            #region attritubes
            string[] attritubes = null;
            #endregion attritubes
            #region  步类型
            switch (synInfo.syn_Type)
            {
                #region 枪柜
            case "枪柜信息增加":    //通过
                gunark = analysisGunark(synInfo.syn_Param);
                gunark_bll.Add(gunark);
                //获取枪弹绑定关系
                attritubes = synInfo.syn_Param.Split('|');
                WebService.gunarkGroupGunBullet[] gggb = webService.getGunarkGroupGunBullet(attritubes[0]);
                for (int i = 0; i < gggb.Length; i++)
                {
                    Model.gbg ggbg = new Gunark.Model.gbg();
                    gbg.GGGBID          = gggb[i].gggbId;
                    gbg.GROUP_ID        = gggb[i].groupId;
                    gbg.GUN_LOCATION    = gggb[i].gunLocation;
                    gbg.GUNARK_ID       = gggb[i].gunarkId;
                    gbg.BULLET_LOCATION = int.Parse(gggb[i].bulletLocation);
                    gbg_bll.Add(gbg);
                }
                break;

            case "枪柜信息修改":    //未通过
                gunark = analysisGunark(synInfo.syn_Param);
                gunark_bll.Update(gunark);
                break;

            case "注销":    //未通过
                attritubes           = synInfo.syn_Param.Split('|');
                gunark               = gunark_bll.GetModel(attritubes[0]);
                gunark.GUNARK_STATUS = 0;
                gunark_bll.Update(gunark);
                break;

            case "是否枪弹对应":    //未通过
                break;

            case "是否使用组权限":    //未通过
                break;

                #endregion 枪柜
                #region 用户(用户绑定组未通过【寄存组有问题】、新增枪柜增加用户)
            case "增加用户":
                user = analysisUser(synInfo.syn_Param);
                user_bll.Add(user);
                break;

            case "更新用户":
                user = analysisUser(synInfo.syn_Param);
                user_bll.Update(user);
                break;

            case "枪柜增加用户":
                analysisUser1(synInfo.syn_Param);
                break;

                #endregion 用户
                #region 组信息(组增加已通过、新增枪柜增加组)
            case "增加班组":
                group = analysisGroup(synInfo.syn_Param);
                group_bll.Add(group);
                break;

            case "组注销":
                attritubes = synInfo.syn_Param.Split('|');
                group      = group_bll.GetModel(attritubes[0]);
                group_bll.Update(group);
                break;

            case "枪柜增加组":
                analysisGroup1(synInfo.syn_Param);
                break;

                #endregion 组信息
                #region 枪弹组绑定关系(未测试)
            case "枪柜对应修改":
                attritubes          = synInfo.syn_Param.Split('|');
                gbg                 = gbg_bll.GetModel(attritubes[0]);
                gbg.GUN_LOCATION    = int.Parse(attritubes[2]);
                gbg.BULLET_LOCATION = int.Parse(attritubes[3]);
                gbg_bll.Update(gbg);
                break;

            case "枪位所属组修改":
                attritubes   = synInfo.syn_Param.Split('|');
                gbg          = gbg_bll.GetModelByGunPos(attritubes[0], attritubes[1]);
                gbg.GROUP_ID = attritubes[2];
                gbg_bll.Update(gbg);
                break;

                #endregion 枪弹组绑定关系
                #region 指纹信息(未测试)
            case "指纹增加":
                fingerPrint = analysisFingerPrint(synInfo.syn_Param);
                fingerPrint_bll.Add(fingerPrint);
                break;

            case "指纹修改":
                //通过USER_ID查
                fingerPrint = fingerPrint_bll.GetModelByUser(attritubes[1], attritubes[4]);
                fingerPrint.USER_FINGERPRINT = StrToByte(attritubes[6]);
                fingerPrint.USER_BAN         = int.Parse(attritubes[7]);
                fingerPrint_bll.Update(fingerPrint);
                break;

                #endregion 指纹信息
                #region 增加任务(测试通过)
            case "增加任务":
                addTask(synInfo.syn_Param);
                break;

                #endregion 增加任务
            default:
                break;
            }
            #endregion  步类型
        }
Ejemplo n.º 3
0
 public static void analysis(WebService.synInfo synInfo)
 {
     WebService.gunServices webService = SingleWebService.getWebService();
     #region model
     Model.gunark gunark = new Gunark.Model.gunark();
     Model.user user = new Gunark.Model.user();
     Model.group group = new Gunark.Model.group();
     Model.gbg gbg = new Gunark.Model.gbg();
     Model.fingerprint fingerPrint = new Gunark.Model.fingerprint();
     #endregion model
     #region bll
     Bll.user user_bll = new Gunark.BLL.user();
     Bll.gunark gunark_bll = new Gunark.BLL.gunark();
     Bll.group group_bll = new Gunark.BLL.group();
     Bll.gbg gbg_bll = new Gunark.BLL.gbg();
     Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint();
     #endregion bll
     #region attritubes
     string[] attritubes = null;
     #endregion attritubes
     #region 同步类型
     switch (synInfo.syn_Type)
     {
         #region 枪柜
         case "枪柜信息增加"://通过
             gunark = analysisGunark(synInfo.syn_Param);
             gunark_bll.Add(gunark);
             //获取枪弹绑定关系
             attritubes = synInfo.syn_Param.Split('|');
             WebService.gunarkGroupGunBullet[] gggb = webService.getGunarkGroupGunBullet(attritubes[0]);
             for (int i = 0; i < gggb.Length; i++)
             {
                 Model.gbg ggbg = new Gunark.Model.gbg();
                 gbg.GGGBID = gggb[i].gggbId;
                 gbg.GROUP_ID = gggb[i].groupId;
                 gbg.GUN_LOCATION = gggb[i].gunLocation;
                 gbg.GUNARK_ID = gggb[i].gunarkId;
                 gbg.BULLET_LOCATION = int.Parse(gggb[i].bulletLocation);
                 gbg_bll.Add(gbg);
             }
             break;
         case "枪柜信息修改"://未通过
             gunark = analysisGunark(synInfo.syn_Param);
             gunark_bll.Update(gunark);
             break;
         case "注销"://未通过
             attritubes = synInfo.syn_Param.Split('|');
             gunark = gunark_bll.GetModel(attritubes[0]);
             gunark.GUNARK_STATUS = 0;
             gunark_bll.Update(gunark);
             break;
         case "是否枪弹对应"://未通过
             break;
         case "是否使用组权限"://未通过
             break;
         #endregion 枪柜
         #region 用户(用户绑定组未通过【寄存组有问题】、新增枪柜增加用户)
         case "增加用户":
             user = analysisUser(synInfo.syn_Param);
             user_bll.Add(user);
             break;
         case "更新用户":
             user = analysisUser(synInfo.syn_Param);
             user_bll.Update(user);
             break;
         case "枪柜增加用户":
             analysisUser1(synInfo.syn_Param);
             break;
         #endregion 用户
         #region 组信息(组增加已通过、新增枪柜增加组)
         case "增加班组":
             group = analysisGroup(synInfo.syn_Param);
             group_bll.Add(group);
             break;
         case "组注销":
             attritubes = synInfo.syn_Param.Split('|');
             group = group_bll.GetModel(attritubes[0]);
             group_bll.Update(group);
             break;
         case "枪柜增加组":
             analysisGroup1(synInfo.syn_Param);
             break;
         #endregion 组信息
         #region 枪弹组绑定关系(未测试)
         case "枪柜对应修改":
             attritubes = synInfo.syn_Param.Split('|');
             gbg = gbg_bll.GetModel(attritubes[0]);
             gbg.GUN_LOCATION = int.Parse(attritubes[2]);
             gbg.BULLET_LOCATION = int.Parse(attritubes[3]);
             gbg_bll.Update(gbg);
             break;
         case "枪位所属组修改":
             attritubes = synInfo.syn_Param.Split('|');
             gbg = gbg_bll.GetModelByGunPos(attritubes[0], attritubes[1]);
             gbg.GROUP_ID = attritubes[2];
             gbg_bll.Update(gbg);
             break;
         #endregion 枪弹组绑定关系
         #region 指纹信息(未测试)
         case "指纹增加":
             fingerPrint = analysisFingerPrint(synInfo.syn_Param);
             fingerPrint_bll.Add(fingerPrint);
             break;
         case "指纹修改":
             //通过USER_ID查
             fingerPrint = fingerPrint_bll.GetModelByUser(attritubes[1], attritubes[4]);
             fingerPrint.USER_FINGERPRINT = StrToByte(attritubes[6]);
             fingerPrint.USER_BAN = int.Parse(attritubes[7]);
             fingerPrint_bll.Update(fingerPrint);
             break;
         #endregion 指纹信息
         #region 增加任务(测试通过)
         case "增加任务":
             addTask(synInfo.syn_Param);
             break;
         #endregion 增加任务
         default:
             break;
     }
     #endregion 同步类型
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置Ip
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "您确定要修改么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString() == "Yes")
            {
                string gunark_ip     = gunarkIp.Text.Trim();
                string gunark_gatWay = gatWay.Text.Trim();
                string gunark_subNet = subNet.Text.Trim();
                string service_ip    = serviceIp.Text.Trim();

                //获取软件版本号和修改日期
                string CurrentSoftVersion = Utils.GetVersion.getSoftVersion();
                try
                {
                    if (Utils.CheckFormate.IsIpaddress(gunark_ip) && Utils.CheckFormate.IsIpaddress(service_ip))
                    {
                        Utils.SettingIp.SetIPAddress(gunark_ip, gunark_subNet, gunark_gatWay);

                        Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                        cfa.AppSettings.Settings["gunark_ip"].Value  = gunark_ip;
                        cfa.AppSettings.Settings["service_ip"].Value = service_ip;
                        cfa.AppSettings.Settings["version"].Value    = CurrentSoftVersion;
                        cfa.AppSettings.Settings["updateTime"].Value = DateTime.Now.ToLocalTime().ToString();
                        cfa.Save(); ConfigurationManager.RefreshSection("appSettings");
                        ConfigurationManager.RefreshSection("appSettings");
                    }
                    else
                    {
                        MessageBox.Show(this, "您输入的IP地址格式不正确!正确格式为【192.168.1.1】", "提示");
                    }
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                }
                //同步枪柜信息
                Utils.SynInfo.getSynInfo();
                Model.gunark g = new Bll.gunark().GetModelByIp(gunark_ip);
                if (g == null)
                {
                    MessageBox.Show("请先在服务器端添加枪柜!!!");
                    return;
                }
                Configuration cfa1 = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                cfa1.AppSettings.Settings["gunark_id"].Value = g.GUNARK_ID;
                cfa1.AppSettings.Settings["unit_id"].Value   = g.UNITINFO_CODE;
                cfa1.AppSettings.Settings["first_run"].Value = "False";
                cfa1.Save(); ConfigurationManager.RefreshSection("appSettings");
                ConfigurationManager.RefreshSection("appSettings");
                //同步枪弹绑定信息
                //Bll.gbg gbg_bll = new Gunark.BLL.gbg();
                ////WebService接口调用工具
                //WebService.gunServices webService = SingleWebService.getWebService();
                //WebService.gunarkGroupGunBullet[] gggb = webService.getGunarkGroupGunBullet(ConfigurationManager.AppSettings["gunark_id"]);
                //for (int i = 0; i < gggb.Length; i++)
                //{
                //    Model.gbg gbg = new Gunark.Model.gbg();
                //    gbg.GGGBID = gggb[i].gggbId;
                //    gbg.GUNARK_ID = gggb[i].gunarkId;
                //    gbg.GUN_LOCATION = gggb[i].gunLocation;
                //    gbg.BULLET_LOCATION = int.Parse(gggb[i].bulletLocation);
                //    gbg.GROUP_ID = gggb[i].groupId;
                //    gbg_bll.Add(gbg);
                //}
                _isSuccess = true;
                this.Close();
            }
        }