Esempio n. 1
0
        protected override void CtrlSearchItemCommand(object source, RepeaterCommandEventArgs e)
        {
            EventSearchItemCommand(source, e);

            var cArg = e.CommandArgument.ToString();

            switch (e.CommandName.ToLower())
            {
            case "search":
                var rp = (Repeater)source;
                SetSearchUserDataInfoVar(rp);
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "resetsearch":
                UInfo.ClearSearchData();
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "new":
                Response.Redirect(EditUrl("itemid", "0", CtrlTypeCode), true);
                break;

            case "return":
                UInfo.SelItemId  = "";    // clear any proviously selected items
                UInfo.SortItemId = "";
                UInfo.Save();
                Response.Redirect(UInfo.RtnUrl);
                break;

            case "exit":
                Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID));
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// U盾更新
        /// </summary>
        /// <param name="uInfo"></param>
        /// <returns></returns>
        public bool UInfoUpdate(UInfo uInfo)
        {
            int result;

            try
            {
                string         sql  = "U_UPDATE";
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@UID", SqlDbType.Int),
                    new SqlParameter("@UINFO", SqlDbType.VarChar, 50),
                    new SqlParameter("@ISADMIN", SqlDbType.Bit),
                    new SqlParameter("@DPID", SqlDbType.Int),
                    new SqlParameter("@IDENTIFY", SqlDbType.VarChar, 50)
                };
                para[0].Value = uInfo.UId;
                para[1].Value = uInfo.U_Info;
                para[2].Value = uInfo.IsAdmin;
                para[3].Value = uInfo.DepartId;
                para[4].Value = uInfo.Identify;
                result        = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para);
                return(result > 0 ? true : false);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("修改U盾出错:" + ex.Message, "UInfoUpdate", DateTime.Now);
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取所有U盾
        /// </summary>
        /// <returns></returns>
        public List <UInfo> UInfoSelect()
        {
            string       sql       = "U_SELECT";
            List <UInfo> listUInfo = new List <UInfo>();

            dt = new DataTable();
            try
            {
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, null))
                {
                    dt.Load(dr);
                }
                UInfo uInfoTemp;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    uInfoTemp          = new UInfo();
                    uInfoTemp.UId      = Convert.ToInt32(dt.Rows[i]["UID"]);
                    uInfoTemp.U_Info   = Convert.ToString(dt.Rows[i]["UINFO"]);
                    uInfoTemp.AddDate  = (DateTime)dt.Rows[i]["ADDDATE"];
                    uInfoTemp.IsAdmin  = (bool)dt.Rows[i]["ISADMIN"];
                    uInfoTemp.DepartId = (int)dt.Rows[i]["DPID"];
                    uInfoTemp.Identify = dt.Rows[i]["IDENTIFY"].ToString();
                    listUInfo.Add(uInfoTemp);
                }
                return(listUInfo);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("查询U盾出错:" + ex.Message, "UInfoSelect", DateTime.Now);
                return(null);
            }
        }
Esempio n. 4
0
        public UInfo GetUInfoByUMessage(UInfo uInfo)
        {
            string    sql   = "U_SELECT_BY_UINFO";
            UInfo     uTemp = new UInfo();
            DataTable dt    = new DataTable();

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@IDENTIFY", SqlDbType.VarChar, 50)
            };
            para[0].Value = uInfo.Identify;
            try
            {
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para))
                {
                    dt.Load(dr);
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    uTemp.U_Info   = dt.Rows[i]["UINFO"].ToString();
                    uTemp.UId      = (int)dt.Rows[i]["UID"];
                    uTemp.DepartId = (int)dt.Rows[i]["DPID"];
                    uTemp.AddDate  = (DateTime)dt.Rows[i]["ADDDATE"];
                    uTemp.IsAdmin  = (bool)dt.Rows[i]["ISADMIN"];
                    uTemp.Identify = dt.Rows[i]["IDENTIFY"].ToString();
                }
                return(uTemp);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("根据U盾的Info获得U顿信息出错:" + ex.Message, "U_SELECT_BY_UINFO", DateTime.Now);
                return(null);
            }
        }
Esempio n. 5
0
        /* the only function in the class that delete file on the sftp server */
        public static void Delete(string host, string username, string password, string fileName)
        {
            JSch js = new JSch();

            // declare sftp connection
            Sftp sftp = new Sftp(host, username, password);

            sftp.Connect();

            // Create a session with SFTP credentials
            Session session = js.getSession(sftp.Username, sftp.Host);

            // Get a UserInfo object
            UserInfo ui = new UInfo(sftp.Password);

            // Pass user info to session
            session.setUserInfo(ui);

            // Open the session
            session.connect();

            // Tell it is an SFTP
            Channel     channel = session.openChannel("sftp");
            ChannelSftp cSftp   = (ChannelSftp)channel;

            cSftp.connect();

            // Delete the file
            cSftp.rm(fileName);

            // disconnection
            channel.disconnect();
            cSftp.exit();
            sftp.Close();
        }
Esempio n. 6
0
        /// <summary>
        /// 根据CRID获得U盾
        /// </summary>
        /// <returns></returns>
        public UInfo UInfoSelectById(UInfo uInfo)
        {
            string sql = "U_SELECT_BY_UID";

            dt = new DataTable();
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@UID", SqlDbType.Int)
                };
                para[0].Value = uInfo.UId;
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para))
                {
                    dt.Load(dr);
                }
                UInfo uTemp = new UInfo();
                uTemp.UId      = Convert.ToInt32(dt.Rows[0]["UID"]);
                uTemp.U_Info   = Convert.ToString(dt.Rows[0]["UINFO"]);
                uTemp.IsAdmin  = (bool)dt.Rows[0]["ISADMIN"];
                uTemp.AddDate  = (DateTime)dt.Rows[0]["ADDDATE"];
                uTemp.DepartId = (int)dt.Rows[0]["DPID"];
                uTemp.Identify = dt.Rows[0]["IDENTIFY"].ToString();
                return(uTemp);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("查询U盾出错:" + ex.Message, "UInfoSelectById", DateTime.Now);
                return(null);
            }
        }
Esempio n. 7
0
        protected override void CtrlListItemCommand(object source, RepeaterCommandEventArgs e)
        {
            EventListItemCommand(source, e);

            var cArg = e.CommandArgument.ToString();

            switch (e.CommandName.ToLower())
            {
            case "selectitemid":
                UInfo.SelItemId = cArg;
                UInfo.Save();
                Response.Redirect(UInfo.RtnSelUrl);
                break;

            case "edit":
                Response.Redirect(EditUrl("itemid", cArg, CtrlTypeCode));
                break;

            case "delete":
                if (Utils.IsNumeric(cArg))
                {
                    var obj = ((DataCtrlInterface)ObjCtrl).Get(Convert.ToInt32(cArg));
                    if (obj.ModuleId == ModuleId | obj.ModuleId == -1)                             //only delete items linked with this module or portalwide (-1).
                    {
                        ((DataCtrlInterface)ObjCtrl).Delete(Convert.ToInt32(cArg));
                    }
                }
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "search":
                var rp = (Repeater)source;
                SetSearchUserDataInfoVar(rp);
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "sort":
                UInfo.SortItemId = cArg;
                UInfo.Save();
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "sortselect":
                SortEntityRecords(EntityTypeCode, UInfo.SortItemId, cArg);
                UInfo.SortItemId = "";
                UInfo.Save();
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "copy":
                CopyEntry(cArg);
                Response.Redirect(EditUrl(CtrlTypeCode));
                break;

            case "exit":
                Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID));
                break;
            }
        }
Esempio n. 8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtMiGo.Text.Trim() == "")
            {
                MessageBox.Show("请输入加密狗秘钥!");
                return;
            }
            string code = txtMiGo.Text.Trim();

            try
            {
                int result = API.NTFindFirst(code);
                if (result == 20)
                {
                    MessageBox.Show("请插入加密锁!");
                }
                else if (result == 1)
                {
                    MessageBox.Show("请插入正确的加密锁!");
                }
                else
                {
                    StringBuilder HardwareId = new StringBuilder();
                    try
                    {
                        API.NTGetHardwareID(HardwareId);
                    }
                    catch (Exception ex)
                    {
                    }
                    uInfo.Identify = HardwareId.ToString();
                    uInfo.U_Info   = code;
                    try
                    {
                        uInfo = uBLL.GetUInfoByMessage(uInfo);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + "," + ex.Source.ToString());
                    }
                    if (uInfo != null)
                    {
                        isTrue  = true;
                        isAdmin = uInfo.IsAdmin;
                        DpId    = uInfo.DepartId;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("密码输入有误!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("加载DLL出现问题!");
            }
        }
Esempio n. 9
0
 public UInfoChange(int id)
 {
     InitializeComponent();
     uInfo      = new UInfo();
     departInfo = new DepartInfo();
     departBLL  = new DepartBLL();
     uBLL       = new UInfoBLL();
     Id         = id;
 }
Esempio n. 10
0
 public UInfoAdd()
 {
     InitializeComponent();
     rbNoAdmin.Checked = true;
     uInfo             = new UInfo();
     departInfo        = new DepartInfo();
     departBLL         = new DepartBLL();
     uBLL = new UInfoBLL();
 }
Esempio n. 11
0
 public UManageWindow()
 {
     InitializeComponent();
     uInfo                  = new UInfo();
     uBLL                   = new UInfoBLL();
     departInfo             = new DepartInfo();
     departBLL              = new DepartBLL();
     bg.DoWork             += new DoWorkEventHandler(bg_DoWork);                         //异步操作时要做的操作,一般去查列表,这个列表在本页面内先声明,然后在这个dowork方法里去取数填充他
     bg.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted); //这个是取数完成后进行的操作,去到数后,这里取用去到的列表绑定到控件
 }
Esempio n. 12
0
 private void FillUMessage(int id)
 {
     uInfo.UId  = id;
     uInfo      = uBLL.UInfoSelectById(uInfo);
     txtGo.Text = uInfo.U_Info;
     cmbDepart.SelectedValue = uInfo.DepartId;
     if (uInfo.IsAdmin)
     {
         rbAdmin.Checked = true;
     }
     else
     {
         rbNoAdmin.Checked = true;
     }
 }
Esempio n. 13
0
            // -----------------------------------------------
            public void Set_NewUInfo(int id_this_session, BanCtrl_GUI ctrl_GUI, UInfo uinfo)
            {
                m_id_this_session = id_this_session;
                m_GUI             = null;      // Draw_AsRoomUsr() で設定 & 描画を行う

                m_uinfo       = uinfo;
                m_exit_unames = null;
                m_encip       = uinfo.m_encip.m_str_encip;

                mb_Rgst_ban = uinfo.mb_to_ban_onAttend;
                mb_Exec_Ban = false;
                mb_AI_talk  = false;

                this.Draw_AsRoomUsr(ctrl_GUI);
            }
Esempio n. 14
0
        /// <summary>
        /// 删除U盾
        /// </summary>
        /// <param name="uInfo"></param>
        /// <returns></returns>
        public bool UInfoDelete(UInfo uInfo)
        {
            string sql = "U_DELETE";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@UID", SqlDbType.Int)
                };
                para[0].Value = uInfo.UId;
                int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para);
                return(result > 0 ? true : false);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("删除U盾出错:" + ex.Message, "UInfoDelete", DateTime.Now);
                return(false);
            }
        }
Esempio n. 15
0
            // -----------------------------------------------
            public void Set_NewExitUsr(int id_this_session, BanCtrl_GUI ctrl_GUI, int idx_eusr)
            {
                m_id_this_session = id_this_session;
                m_GUI             = null;      // Draw_AsExitUsr() で設定 & 描画を行う

                m_uinfo       = null;
                m_exit_unames = string.Join(", ", ExitEip_onTalks.msa_unames_on_talks[idx_eusr]);
                m_encip       = ExitEip_onTalks.msa_encip_on_talks[idx_eusr];

                if ((ExitEip_onTalks.msa_flags[idx_eusr] & ExitEip_onTalks.ExitUsr_Stt.EN_Regist_BAN) == 0)
                {
                    mb_Rgst_ban = false;
                }
                else
                {
                    mb_Rgst_ban = true;
                }

                mb_Exec_Ban = false;
                mb_AI_talk  = false;

                this.Draw_AsExitUsr(ctrl_GUI);
            }
Esempio n. 16
0
        // ---------------------------------------------------
        // 戻り値: ban すべきユーザであった場合、true が返される
        public static void Attend(ref Uid uid, string uname, ref Uencip encip)
        {
            int idx_uid = -1;

            for (int idx = msa_uinfo.Count; --idx >= 0;)
            {
                if (msa_uinfo[idx].m_uid.IsEqualTo(ref uid) == true)
                {
                    idx_uid = idx;  break;
                }
            }

            if (idx_uid < 0)
            {
                // 新規ユーザを検出したときの処理
                msb_dtct_new_usr = true;

                UInfo new_uinfo = new UInfo(ref uid, uname, ref encip, m_next_id_this_session);
                msa_uinfo.Add(new_uinfo);
                m_next_id_this_session++;
                msab_attend.Add(true);

                // 新規登録時にのみ、eip to ban チェックを行う
                if (DB_static.IsBanned(encip.m_str_encip))
                {
                    new_uinfo.mb_to_ban_onAttend = true;
                }
                if (uname.StartsWith("ロン"))
                {
                    new_uinfo.mb_to_ban_onAttend = true;
                }
            }
            else
            {
                msab_attend[idx_uid] = true;
            }
        }
Esempio n. 17
0
 /// <summary>
 /// 删除U盾
 /// </summary>
 /// <param name="uInfo"></param>
 /// <returns></returns>
 public bool UInfoDelete(UInfo uInfo)
 {
     return(uInfoDal.UInfoDelete(uInfo));
 }
Esempio n. 18
0
 public CheckMiGo()
 {
     InitializeComponent();
     uBLL  = new UInfoBLL();
     uInfo = new UInfo();
 }
Esempio n. 19
0
 /// <summary>
 /// U盾添加
 /// </summary>
 /// <param name="depart"></param>
 /// <returns></returns>
 public bool UInfoInsert(UInfo uInfo)
 {
     return(uInfoDal.UInfoInsert(uInfo));
 }
Esempio n. 20
0
 /// <summary>
 /// U盾更新
 /// </summary>
 /// <param name="uInfo"></param>
 /// <returns></returns>
 public bool UInfoUpdate(UInfo uInfo)
 {
     return(uInfoDal.UInfoUpdate(uInfo));
 }
Esempio n. 21
0
 /// <summary>
 /// 根据CRID获得U盾
 /// </summary>
 /// <returns></returns>
 public UInfo UInfoSelectById(UInfo uInfo)
 {
     return(uInfoDal.UInfoSelectById(uInfo));
 }
Esempio n. 22
0
            // ban_ctrl に変更を行うときにコールされる関数
            // 戻り値: 実際に登録された BanCtrl
            public static BanCtrl Update_RoomUsr(BanCtrl pos_ctrl, int id_this_session, BanCtrl_GUI ctrl_GUI, UInfo uinfo)
            {
                BanCtrl ctrl = pos_ctrl;

                if (ctrl == ms_BanCtrl_bottom)
                {
                    ctrl.Set_NewUInfo(id_this_session, ctrl_GUI, uinfo);
                }
                else
                {
                    while (true)
                    {
                        int ctrl_id_this_session = ctrl.m_id_this_session;
                        if (ctrl_id_this_session == id_this_session)
                        {
                            // ユーザ情報はそのままでよい
                            ctrl.Draw_AsRoomUsr(ctrl_GUI);
                            break;
                        }

                        if (ctrl_id_this_session == 0)
                        {
                            ctrl.Set_NewUInfo(id_this_session, ctrl_GUI, uinfo);
                            break;
                        }
                        if (ctrl_id_this_session < 0)
                        {
                            ctrl = InsertFromLast(ctrl);
                            ctrl.Set_NewUInfo(id_this_session, ctrl_GUI, uinfo);
                            break;
                        }
                        if (ctrl_id_this_session > id_this_session)
                        {
                            throw new Exception(
                                      "!!! エラー検出: ctrl_id__this_session > id_this_session in BanCtrls_Ctrlr.Update_onRoomUsr()");
                        }

                        ctrl = MoveToLast(ctrl);
                    }
                }

                // GUI の表示を update する
//				ctrl.Draw_AsRoomUsr();
                return(ctrl);
            }
Esempio n. 23
0
        // GetJSON() の後にコールされる
        void Update_BanCtrls()
        {
            int     c_num_on_room = Math.Min(NUM_Btn_BAN, UInfo_onRoom.msa_uinfo.Count);
            BanCtrl ban_ctrl      = BanCtrls_Ctrlr.ms_BanCtrl_top;

            for (int idx = 0; idx < c_num_on_room; idx++)
            {
                UInfo       uinfo        = UInfo_onRoom.msa_uinfo[idx];
                BanCtrl_GUI ban_ctrl_GUI = msa_BanCtrl_GUIs[idx];

                // uinfo、ban_ctrl、ban_ctrl_GUI の3つを lead_id_this_session を軸として結びつけていく
                int lead_id_this_session = uinfo.m_id_this_session;

                if (ban_ctrl_GUI.m_id_this_session != lead_id_this_session)
                {
                    ban_ctrl = BanCtrls_Ctrlr.Update_RoomUsr(ban_ctrl, lead_id_this_session, ban_ctrl_GUI, uinfo);
                    ban_ctrl_GUI.m_id_this_session = lead_id_this_session;
                    ban_ctrl_GUI.m_ban_ctrl        = ban_ctrl;
                }

                if (ban_ctrl.mb_Rgst_ban && ban_ctrl.mb_Exec_Ban == false)
                {
                    ma_btn_idx_to_ban[m_tmnt_btn_idx_to_ban] = idx;
                    m_tmnt_btn_idx_to_ban++;
                }
                ban_ctrl = ban_ctrl.m_next;
            }

            int idx_tmnt;

            {
                int idx_eusr = ExitEip_onTalks.msa_encip_on_talks.Count;
                idx_tmnt = Math.Min(NUM_Btn_BAN, c_num_on_room + idx_eusr);
                idx_eusr--;                  // eusr は、後方から処理をしていく(時間的順序を考慮)

                for (int idx_GUI = c_num_on_room; idx_GUI < idx_tmnt; idx_eusr--, idx_GUI++)
                {
                    BanCtrl_GUI ban_ctrl_GUI = msa_BanCtrl_GUIs[idx_GUI];

                    // exit_user、ban_ctrl、ban_ctrl_GUI の3つを lead_id_this_session を軸として結びつけていく
                    int lead_id_this_session = ExitEip_onTalks.msa_id_this_session[idx_eusr];

                    if (ban_ctrl_GUI.m_id_this_session != lead_id_this_session)
                    {
                        ban_ctrl = BanCtrls_Ctrlr.Update_ExitUsr(ban_ctrl, lead_id_this_session, ban_ctrl_GUI, idx_eusr);

                        ban_ctrl_GUI.m_id_this_session = lead_id_this_session;
                        ban_ctrl_GUI.m_ban_ctrl        = ban_ctrl;
                    }
                    ban_ctrl = ban_ctrl.m_next;
                }
            }

            // 非使用の ban_ctrl_GUI の id_this_session をクリア
            for (int idx_GUI = idx_tmnt; idx_GUI < NUM_Btn_BAN; idx_GUI++)
            {
                BanCtrl_GUI ban_ctrl_GUI = msa_BanCtrl_GUIs[idx_GUI];
                if (ban_ctrl_GUI.m_id_this_session == 0)
                {
                    break;
                }

                ban_ctrl_GUI.m_Btn_AI_talk.Text    = "---";
                ban_ctrl_GUI.m_Btn_AI_talk.Enabled = false;

                ban_ctrl_GUI.m_Btn_ban.Text    = " ---";
                ban_ctrl_GUI.m_Btn_ban.Enabled = false;

                ban_ctrl_GUI.m_TBox_info.Visible = false;
                ban_ctrl_GUI.m_id_this_session   = 0;
            }

            // 非使用の ban_ctrl の id_this_session をクリア
            while (ban_ctrl != null)
            {
                if (ban_ctrl.m_id_this_session == 0)
                {
                    break;
                }

                ban_ctrl.m_id_this_session = 0;
                ban_ctrl = ban_ctrl.m_next;
            }

            // BanCtrl の表示更新を終えたタイミングで、即時 BAN 対象者がいたら BAN を実行する
            for (int i = 0; i < m_tmnt_btn_idx_to_ban; i++)
            {
                msa_BanCtrl_GUIs[ma_btn_idx_to_ban[i]].m_ban_ctrl.OnClk_Btn_BAN();
            }
            m_tmnt_btn_idx_to_ban = 0;

            // AI_talk 対応ユーザがいたら、AI_talk に対応させる
            if (DB_cur.msb_to_appear_AI_talk)
            {
                AI_talk.Talk_toTgt();
                DB_cur.msb_to_appear_AI_talk = false;
            }
        }
Esempio n. 24
0
 public UInfo GetUInfoByMessage(UInfo uInfo)
 {
     return(uInfoDal.GetUInfoByUMessage(uInfo));
 }