Пример #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                GetModel();

                if (btnOK.Text == "添加")
                {
                    if (_BLL.GetModelList(Global.Methods.FormatStrW(string.Format("  and FapID='{0}' ", _mModel.FapID))).Count > 0)
                    {
                        CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("编号【{0}】已存在!", _mModel.FapID), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        txtCode.Focus();
                        return;
                    }
                    if (_BLL.GetModelList(string.Format(" i_flag=0 and  BoxID='{0}' and vc_Name='{1}'", Global.Params.BoxID,_mModel.vc_Name)).Count > 0)
                    {
                        CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("名称【{0}】已存在!",  _mModel.vc_Name), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        txtName.Focus();
                        return;
                    }
                    if (_BLL.GetModelList(string.Format(" i_flag=0 and BoxID='{0}' and vc_Identify='{1}'", Global.Params.BoxID, _mModel.vc_Identify)).Count > 0)
                    {
                        CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("标示码【{0}】已存在!", _mModel.vc_Identify), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        txtIdentify.Focus();
                        return;
                    }

                    //判断
                    List<DB_Talk.Model.m_FAP> lstFap = new DB_Talk.BLL.m_FAP().GetModelList(
                        string.Format("i_Flag=0 and boxid={0} and vc_TempAddress='{1}' ", Global.Params.BoxID, txtFapIP.Text.Trim()));
                    if (lstFap != null && lstFap.Count > 0)
                    {
                        CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("基站IP:【{0}】已存在!", _mModel.vc_TempAddress), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        txtFapIP.Focus();
                        return;
                    }

                    if (Tools.MBoxOperate.CreateFAP(_mModel))
                    {
                        _BLL.Add(_mModel);
                        CommControl.MessageBoxEx.MessageBoxEx.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        CommControl.SystemLogBLL.WriteLog(Global.Params.UserID, Global.Params.BoxID,
                            CommControl.SystemLogBLL.EnumLogAction.Add, "添加", "添加了3G基站:" + _mModel.vc_Name, "");
                        this.DialogResult = DialogResult.OK;
                        MBoxSDK.ConfigSDK.MBOX_SaveHaveDoneCfg(Global.Params.BoxHandle);
                        this.Close();
                    }
                    else
                    {

                        CommControl.MessageBoxEx.MessageBoxEx.Show("添加失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Пример #2
0
        private void UpdateDB()
        {
            //同步数据库数据
            List<DB_Talk.Model.m_FAP> lstBoxFap = new List<DB_Talk.Model.m_FAP>();
            Tools.MBoxOperate.GetFAP(out lstBoxFap);
            //new DB_Talk.BLL.m_StaticRoute().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            DB_Talk.BLL.m_FAP bll = new DB_Talk.BLL.m_FAP();
            foreach (DB_Talk.Model.m_FAP m in lstBoxFap)
            {
                if (bll.Exists(string.Format("i_Flag=0 and BoxID='{0}' and FapID='{1}'", Global.Params.BoxID, m.FapID)) == false)
                {
                    bll.Add(m);
                }
            }
            List<DB_Talk.Model.m_FAP> lstDBFap = new List<DB_Talk.Model.m_FAP>();
            lstDBFap = new DB_Talk.BLL.m_FAP().GetModelList(string.Format("i_Flag=0 and BoxID='{0}' ", Global.Params.BoxID));

            foreach (DB_Talk.Model.m_FAP m in lstDBFap)
            {
                if (lstBoxFap.Exists(p => p.FapID == m.FapID) == false)
                {
                    bll.Delete(m.ID);
                }
                else
                {
                    m.vc_TempAddress = lstBoxFap.Find(p => p.FapID == m.FapID).vc_TempAddress;
                    bll.Update(m);
                }
            }
         
        }
Пример #3
0
        public void LoadData()
        {
            dgvList.Rows.Clear();
            List<DB_Talk.Model.m_FAP> lst = new List<DB_Talk.Model.m_FAP>();
            lst = new DB_Talk.BLL.m_FAP().GetModelList(string.Format("i_Flag=0 and BoxID='{0}' ", Global.Params.BoxID));
            int i = 0;


            //从BOX中取
            List<DB_Talk.Model.m_FAP> lstBoxFap = new List<DB_Talk.Model.m_FAP>();
            Tools.MBoxOperate.GetFAP(out lstBoxFap);

            foreach (DB_Talk.Model.m_FAP item in lst)
            {
                i++;
                List<DB_Talk.Model.m_Member> lstMember = new DB_Talk.BLL.m_Member().GetModelList(string.Format("i_Flag=0 and FapID={0} and BoxID={1}", item.ID,Global.Params.BoxID));
                int phoneCount = 0;
                if (lstMember!=null && lstMember.Count>0)
                {
                    phoneCount = lstMember.Count;
                }
                string fapState=GetFapState(lstBoxFap,item.FapID);
                if (fapState!="注册成功")
                {
                    phoneCount = 0;
                }
                dgvList.Rows[dgvList.Rows.Add(item.ID,
                        item.FapID,
                        item.vc_TempAddress,
                        fapState,
                        item.vc_Name,
                        item.vc_Identify,
                        phoneCount
                        )].Tag = item;
            }

           
           
            kryptonHeaderGroup1.ValuesSecondary.Heading = "  共" + dgvList.Rows.Count.ToString() + "条记录";
            
        }
Пример #4
0
 /// <summary>
 /// 加载基站信息(3G)
 /// </summary>
 public void LoadFap()
 {
     List<DB_Talk.Model.m_FAP> lstFap = new DB_Talk.BLL.m_FAP().GetModelList("i_Flag=0 and BoxID=" + Pub.manageModel.BoxID.Value);
     foreach (DB_Talk.Model.m_FAP item in lstFap)
     {
         if (Pub.DicFap.ContainsKey(item.vc_TempAddress)==false)
         {
             Pub.DicFap.Add(item.vc_TempAddress, item.ID);    
         }
     }
 }