Exemplo n.º 1
0
        private static void analysisUser1(string prams)
        {
            Bll.user user_bll = new Gunark.BLL.user();
            int      j        = -1;

            string[] attributes = prams.Split('|');
            int      user_count = int.Parse(attributes[0].Substring(0, attributes[0].IndexOf("&")));

            for (int i = 0; i < user_count; i++)
            {
                Model.user user = new Gunark.Model.user();
                if (i == 0)
                {
                    user.USER_POLICENUMB = attributes[++j].Substring(attributes[0].IndexOf("&") + 1);
                }
                else
                {
                    user.USER_POLICENUMB = attributes[++j];
                }
                user.USER_REALNAME       = attributes[++j];
                user.USER_NAME           = attributes[++j];
                user.USER_PWD            = attributes[++j];
                user.USER_STATE          = int.Parse(attributes[++j]);
                user.USER_ADDRESS        = attributes[++j];
                user.USER_OFFICETELEP    = attributes[++j];
                user.USER_MOBILTELEP     = attributes[++j];
                user.USER_SEX            = int.Parse(attributes[++j]);
                user.USER_EMAIL          = attributes[++j];
                user.USER_POSTCODE       = attributes[++j];
                user.USER_PRIVIEGES      = int.Parse(attributes[++j]);
                user.USER_GUNLICENSE     = attributes[++j];
                user.USER_GUNLICENSEDATE = attributes[++j];
                j = j + 4;
                user.USER_JOBSTATUS = int.Parse(attributes[++j]);
                user.UNITINFO_CODE  = attributes[++j];
                user.GROUP_ID       = attributes[++j];
                user.USER_BANNED    = int.Parse(attributes[++j]);
                user.USER_ID        = attributes[++j];
                if (i != user_count - 1)
                {
                    ++j;
                }
                user_bll.Add(user);
            }
        }
        /// <summary>
        /// 立即同步
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            int count = 0;
                //获取选中的行数
                for (int i = 0; i < dataGridView3.RowCount; i++)
                {
                    if ((bool)dataGridView3.Rows[i].Cells[0].EditedFormattedValue)
                    {
                        count++;
                    }
                }
                if (count <= 0)
                {
                    MessageBox.Show("请选择人员!", "提示");
                    return;
                }
                if (MessageBox.Show(this, "您确定要同步么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString() == "Yes")
                {
                    ArrayList al = new ArrayList();
                    Bll.user user_bll = new Gunark.BLL.user();
                    for (int i = 0; i < dataGridView3.RowCount; i++)
                    {
                        al.Add(user_list[i]);
                        if ((bool)dataGridView3.Rows[i].Cells[0].EditedFormattedValue)
                        {
                            Model.user user = new Model.user();

                            user.UNITINFO_CODE = user_list[i].unitInfo.unitInfoCode;

                            Utils.ClassValueCopier.Copy(user, user_list[i]);

                            if (!user_bll.Exists(dataGridView3.Rows[i].Cells[1].Value.ToString()))
                                user_bll.Add(user);

                            al.RemoveAt(al.Count - 1);
                        }
                    }
                    user_list = (WebService.user[])al.ToArray(typeof(WebService.user));
                    dataGridView3.DataSource = user_list;
                }
        }
Exemplo n.º 3
0
 private static void analysisUser1(string prams)
 {
     Bll.user user_bll = new Gunark.BLL.user();
     int j = -1;
     string[] attributes = prams.Split('|');
     int user_count = int.Parse(attributes[0].Substring(0, attributes[0].IndexOf("&")));
     for (int i = 0; i < user_count; i++)
     {
         Model.user user = new Gunark.Model.user();
         if (i == 0)
             user.USER_POLICENUMB = attributes[++j].Substring(attributes[0].IndexOf("&") + 1);
         else
             user.USER_POLICENUMB = attributes[++j];
         user.USER_REALNAME = attributes[++j];
         user.USER_NAME = attributes[++j];
         user.USER_PWD = attributes[++j];
         user.USER_STATE = int.Parse(attributes[++j]);
         user.USER_ADDRESS = attributes[++j];
         user.USER_OFFICETELEP = attributes[++j];
         user.USER_MOBILTELEP = attributes[++j];
         user.USER_SEX = int.Parse(attributes[++j]);
         user.USER_EMAIL = attributes[++j];
         user.USER_POSTCODE = attributes[++j];
         user.USER_PRIVIEGES = int.Parse(attributes[++j]);
         user.USER_GUNLICENSE = attributes[++j];
         user.USER_GUNLICENSEDATE = attributes[++j];
         j = j + 4;
         user.USER_JOBSTATUS = int.Parse(attributes[++j]);
         user.UNITINFO_CODE = attributes[++j];
         user.GROUP_ID = attributes[++j];
         user.USER_BANNED = int.Parse(attributes[++j]);
         user.USER_ID = attributes[++j];
         if (i != user_count - 1)
             ++j;
         user_bll.Add(user);
     }
 }
Exemplo n.º 4
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 同步类型
 }
Exemplo n.º 5
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  步类型
        }
 /// <summary>
 /// 人员信息同步
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void user_syn_Layout()
 {
     //禁止datagridview自动创建列和行
         this.dataGridView3.AutoGenerateColumns = false;
         //从服务器获取用户信息
         if (PubFlag.online)
         {
             user_list = Utils.SynInfoFormService.getUserInfo();
             ArrayList al = new ArrayList();
             Bll.user user_bll = new Gunark.BLL.user();
             if (user_list != null)
             {
                 for (int i = 0; i < user_list.Length; i++)
                 {
                     al.Add(user_list[i]);
                     if (user_bll.Exists(user_list[i].userPoliceNumb))
                         al.RemoveAt(al.Count - 1);
                 }
                 user_list = (WebService.user[])al.ToArray(typeof(WebService.user));
                 dataGridView3.DataSource = user_list;
             }
         }
         else {
             MessageBox.Show("同步用户信息失败,请检查与远程服务器联网状态!","提示");
         }
 }
        /// <summary>
        /// 下载指纹
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            int count = 0;
                //获取选中的行数
                for (int i = 0; i < dataGridView7.RowCount; i++)
                {
                    if ((bool)dataGridView7.Rows[i].Cells[0].EditedFormattedValue)
                    {
                        count++;
                    }
                }
                if (count <= 0)
                {
                    MessageBox.Show("请选择人员!", "提示");
                    return;
                }
                if (MessageBox.Show(this, "您确定要下载么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString() == "Yes")
                {
                    Bll.user user_bll = new Gunark.BLL.user();

                    for (int i = 0; i < dataGridView7.RowCount; i++)
                    {
                        if ((bool)dataGridView7.Rows[i].Cells[0].EditedFormattedValue)
                        {
                            string userPoliceNum = dataGridView7.Rows[i].Cells[1].Value.ToString();
                            WebService.fingerUser[] fingerPrint_list = webService.getFingerUserInfo(userPoliceNum, user_bll.GetModel(userPoliceNum).UNITINFO_CODE);

                            for(int j = 0;j<fingerPrint_list.Length;j++)
                            {
                                if (!fingerPrint_bll.ExistsByFingerPrintId(fingerPrint_list[j].fingerPrintId))
                                {
                                    Model.fingerprint fingerPrint = new Gunark.Model.fingerprint();

                                    fingerPrint.USER_FINGERPRINT_ID = fingerPrint_list[j].fingerPrintId;
                                    fingerPrint.USER_POLICENUMB = fingerPrint_list[j].userPoliceNumb;
                                    fingerPrint.USER_NAME = fingerPrint_list[j].userName;
                                    fingerPrint.FINGER_NUMBER = fingerPrint_list[j].fingerNumber.ToString();
                                    fingerPrint.UNIT_ID = fingerPrint_list[j].unitCode;
                                    fingerPrint.USER_FINGERPRINT = fingerPrint_list[j].userFingerPrint;
                                    fingerPrint.IS_UPDATE = 0;
                                    fingerPrint_bll.Add(fingerPrint);

                                    DownloadPrinter.download(fingerPrint);
                                }
                            }
                        }
                    }
                    for (int i = dataGridView7.Rows.Count-1; i >= 0;i--)
                    {
                        if ((bool)dataGridView7.Rows[i].Cells[0].EditedFormattedValue)
                        {
                            finger_user_list.RemoveAt(i);
                        }
                    }
                    dataGridView7.DataSource = null;
                    dataGridView7.DataSource = finger_user_list;
                }
        }