Ejemplo n.º 1
0
        protected string ReturnRoleCode(string sUID)
        {
            string sRole = "";

            try
            {
                sSQL  = "select vchrRoleID from dbo._UserRoleInfo where vchrUserID = '" + sUid + "'";
                sRole = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim();
            }
            catch { }
            return(sRole);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 判断角色是否不存在
        /// </summary>
        /// <param name="sUid"></param>
        /// <returns>不存在True</returns>
        public bool ChkRoleID(string sRoleID)
        {
            bool b = false;

            try
            {
                string sSQL = "SELECT COUNT(vchrRoleID) AS iCount " +
                              "FROM _RoleInfo " +
                              "WHERE (vchrRoleID = '" + sRoleID + "')";
                int iCount = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCount < 1)
                {
                    b = true;
                }
                else
                {
                    b = false;
                }
            }
            catch
            {
                throw new Exception("判断角色是否存在失败!");
            }

            return(b);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 权限判断
        /// </summary>
        /// <returns></returns>
        private bool hasRight(string sInfo, string sUid)
        {
            bool b = false;

            try
            {
                clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance();

                string sSQL = "SELECT     COUNT(*) AS iCount " +
                              "FROM         dbo._RoleRight INNER JOIN dbo._UserRoleInfo ON _RoleRight.vchrRoleID = dbo._UserRoleInfo.vchrRoleID " +
                              "WHERE   dbo._UserRoleInfo.vchrUserID = '" + sUid + "' and dbo._RoleRight.vchrRoleRight = '" + sInfo + "' ";

                int iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou > 0)
                {
                    b = true;
                }
                else
                {
                    b = false;
                }
            }
            catch
            {
                throw new Exception("判断权限失败!");
            }
            return(b);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 判断用户是否不存在
        /// </summary>
        /// <param name="sUid"></param>
        /// <returns>不存在True</returns>
        public bool ChkUID(string sUid)
        {
            bool b = false;

            try
            {
                string sSQL = "SELECT COUNT(vchrUid) AS iCount FROM _UserInfo " +
                              "WHERE (vchrUid = '" + sUid + "') ";
                int iCount = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCount < 1)
                {
                    b = true;
                }
                else
                {
                    b = false;
                }
            }
            catch
            {
                throw new Exception("判断用户是否存在失败!");
            }

            return(b);
        }
Ejemplo n.º 5
0
 private void SetTree()
 {
     try
     {
         string sSQL2 = @"select count(*) from dbo._UserRoleInfo where vchrRoleID = 'administrator' and vchrUserID = '" + 系统服务.ClsBaseDataInfo.sUid + "'";
         string sSQL;
         if (系统服务.ClsBaseDataInfo.sUid == "admin" || 系统服务.ClsBaseDataInfo.sUid == "system")
         {
             sSQL = "SELECT TOP 100 PERCENT * FROM dbo._Form WHERE (1 = 1) AND (fbitNoUse = 0) AND (fbitHide = 0) and (vchrFormBel='" + 系统服务.ClsBaseDataInfo.sProForm + "' or vchrFormBel is null)  ORDER BY fIntOrderID";
         }
         else if (Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL2)) != 0)
         {
             sSQL = "SELECT TOP 100 PERCENT * FROM dbo._Form WHERE (isnull(bUse,0) = 1) AND (fbitNoUse = 0) AND (fbitHide = 0) and (vchrFormBel='" + 系统服务.ClsBaseDataInfo.sProForm + "' or vchrFormBel is null)  ORDER BY fIntOrderID";
         }
         else
         {
             sSQL = "SELECT DISTINCT " +
                    "      dbo._Form.fchrFrmNameID, dbo._Form.fchrFrmText, dbo._Form.fchrNameSpace,  " +
                    "	  dbo._Form.fchrFrmUpName,  "+
                    "      dbo._Form.fbitHide, dbo._Form.fbitNoUse, dbo._Form.fIntOrderID " +
                    "FROM         dbo._RoleInfo INNER JOIN " +
                    "      dbo._RoleRight ON dbo._RoleInfo.vchrRoleID = dbo._RoleRight.vchrRoleID INNER JOIN " +
                    "      dbo._UserRoleInfo ON dbo._RoleInfo.vchrRoleID = dbo._UserRoleInfo.vchrRoleID and dbo._UserRoleInfo.vchrUserID='" + 系统服务.ClsBaseDataInfo.sUid + "' INNER JOIN " +
                    "      dbo._Form ON 1=1 " +
                    "		 AND dbo._Form.fchrFrmNameID +'/'+dbo._Form.fchrFrmText= RTRIM(LTRIM(RIGHT(dbo._RoleRight.vchrRoleRight, LEN(dbo._RoleRight.vchrRoleRight) - CHARINDEX('|', dbo._RoleRight.vchrRoleRight)))) "+
                    "WHERE (isnull(bUse,0) = 1) AND (fbitNoUse = 0) AND (fbitHide = 0) and (vchrFormBel='" + 系统服务.ClsBaseDataInfo.sProForm + "' or vchrFormBel is null)  " +
                    "ORDER BY fIntOrderID ";
         }
         clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance();
         dt            = clsSQLCommond.ExecQuery(sSQL);
         //ClsUseWebService clsWeb = new ClsUseWebService();
         //dt = clsWeb.dtMainSetTree(系统服务.ClsBaseDataInfo.sUid, 系统服务.ClsBaseDataInfo.sProForm);
         if (iBtnType == 0)
         {
             InitTree(treView.Nodes, "业务工作");
         }
         if (iBtnType == 1)
         {
             InitTree(treView.Nodes, "基础设置");
         }
         if (iBtnType == 2)
         {
             InitTree(treView.Nodes, "系统服务");
         }
     }
     catch (Exception ee)
     {
         throw new Exception(ee.Message);
     }
 }
Ejemplo n.º 6
0
        public DateTime GetSerTime()
        {
            DateTime dTime;

            try
            {
                string sSQL = "select getdate() as sTime ";
                dTime = Convert.ToDateTime(clsSQLCommond.ExecGetScalar(sSQL));
            }
            catch
            {
                throw new Exception("获得服务器时间失败!");
            }
            return(dTime);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 判断角色是否关闭
        /// </summary>
        /// <param name="sRoleID"></param>
        /// <returns>True 关闭</returns>
        public bool ChkClosed(string sRoleID)
        {
            bool b = false;

            try
            {
                string sSQL = "SELECT bClosed " +
                              "FROM _RoleInfo " +
                              "WHERE vchrRoleID='" + sRoleID + "' " +
                              "ORDER BY vchrRoleID ";
                b = Convert.ToBoolean(clsSQLCommond.ExecGetScalar(sSQL));
            }
            catch
            {
                throw new Exception("获得用户信息失败!");
            }
            return(b);
        }
Ejemplo n.º 8
0
        private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                string sInfo = this.Name + "|" + e.ClickedItem.Name;

                if (e.ClickedItem.Name.ToLower().Trim() == "exit")
                {
                    //if (MessageBox.Show("是否关闭当前窗体?\n是:关闭\n否:取消", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                    //{
                    //    sSQL = "insert into Define1(S1,s2,S3,S4,S5,S6,SysCreateDate)values('" + 系统服务.ClsBaseDataInfo.sUid + "','" + 系统服务.ClsBaseDataInfo.sUserName + "','" + this.Name + "','" + this.Text + "','" + e.ClickedItem.Name.Trim() + "','" + e.ClickedItem.Text.Trim() + "',getdate())";
                    //    clsSQLCommond.ExecSql(sSQL);
                    this.Close();
                    return;
                    //}
                }

                clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance();
                string sSQL2 = @"select count(*) from dbo._UserRoleInfo where vchrRoleID = 'administrator' and vchrUserID = '" + sUid + "'";

                bool b = false;
                if (sUid == "admin" || sUid == "system")
                {
                    b = true;
                }
                if (Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL2)) != 0)
                {
                    b = true;
                }
                if (!b)
                {
                    if (!hasRight(sInfo, sUid))
                    {
                        e.ClickedItem.Enabled = false;
                        MessageBox.Show("权限不足!");
                        return;
                    }
                }


                //sSQL = "insert into Define1(S1,s2,S3,S4,S5,S6,SysCreateDate)values('" + 系统服务.ClsBaseDataInfo.sUid + "','" + 系统服务.ClsBaseDataInfo.sUserName + "','" + this.Name + "','" + this.Text + "','" + e.ClickedItem.Name.Trim() + "','" + e.ClickedItem.Text.Trim() + "',getdate())";
                //clsSQLCommond.ExecSql(sSQL);
                BtnClick(e.ClickedItem.Name, e.ClickedItem.Text);

                if (dtBtnInfo != null && dtBtnInfo.Rows.Count > 0)
                {
                    for (int i = 0; i < dtBtnInfo.Rows.Count; i++)
                    {
                        if (dtBtnInfo.Rows[i]["vchrBtnID"].ToString().Trim().ToLower() == e.ClickedItem.Name.ToLower().Trim())
                        {
                            if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 0)
                            {
                                btnEnable = true;
                                SetBtnEnable(btnEnable);
                            }
                            else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 1 || Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 2)
                            {
                                SetBtnEnable(btnEnable);
                            }
                            else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 3)
                            {
                                SetBtnEnable(true);
                            }
                            else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 4)
                            {
                                SetBtnEnable(false);
                            }
                            else if (Convert.ToInt32(dtBtnInfo.Rows[i]["bEnable"]) == 5)
                            {
                                //SetBtnEnable(false);
                            }
                        }
                    }
                }

                Cursor.Current = Cursors.Default;
            }
            catch (Exception ee)
            {
                MsgBox("操作失败", ee.Message);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 创建窗体按钮
        /// </summary>
        private void CreateBtn(string sFormInfo)
        {
            clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance();
            string sSQL2 = @"select count(*) from dbo._UserRoleInfo where vchrRoleID = 'administrator' and vchrUserID = '" + sUid + "'";
            string sSQL  = "";

            if (sUid == "admin" || sUid == "system" || Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL2)) != 0)
            {
                sSQL = "SELECT TOP 100 PERCENT fchrFrmNameID, vchrBtnID, vchrBtnText, iIcon, vchrRemark, intOrder,isnull(bEnable,0) as bEnable " +
                       "FROM dbo._FormBtnInfo " +
                       "WHERE (fchrFrmNameID = '" + sFormInfo + "') " +
                       "ORDER BY intOrder DESC";
            }
            else
            {
                sSQL = "SELECT distinct _FormBtnInfo.fchrFrmNameID, vchrBtnID, vchrBtnText, _FormBtnInfo.vchrRemark, intOrder,isnull(bEnable,0) as bEnable , " +
                       "  RTRIM(LTRIM(LEFT(dbo._RoleRight.vchrRoleRight, CHARINDEX('|', dbo._RoleRight.vchrRoleRight) - 1))) AS vchrL,  " +
                       "  RTRIM(LTRIM(RIGHT(dbo._RoleRight.vchrRoleRight, LEN(dbo._RoleRight.vchrRoleRight) - CHARINDEX('|', dbo._RoleRight.vchrRoleRight))))  " +
                       "  AS vchrR " +
                       "FROM         dbo._RoleInfo INNER JOIN " +
                       "	dbo._RoleRight ON dbo._RoleInfo.vchrRoleID = dbo._RoleRight.vchrRoleID INNER JOIN "+
                       "	dbo._UserRoleInfo ON dbo._RoleInfo.vchrRoleID = dbo._UserRoleInfo.vchrRoleID AND dbo._UserRoleInfo.vchrUserID = '"+ sUid + "'  " +
                       "	INNER JOIN "+
                       "	dbo._FormBtnInfo ON vchrBtnID = RTRIM(LTRIM(RIGHT(dbo._RoleRight.vchrRoleRight, LEN(dbo._RoleRight.vchrRoleRight) - CHARINDEX('|', dbo._RoleRight.vchrRoleRight)))) AND fchrFrmNameID = RTRIM(LTRIM(LEFT(dbo._RoleRight.vchrRoleRight, CHARINDEX('|', dbo._RoleRight.vchrRoleRight) - 1))) "+
                       "WHERE     (fchrFrmNameID = '" + sFormInfo + "')  " +
                       "ORDER BY intOrder DESC";
            }
            DataTable dt = clsSQLCommond.ExecQuery(sSQL);

            if (dt == null || dt.Rows.Count < 1)
            {
                return;
            }

            dtBtnInfo = dt.Copy();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                switch (Convert.ToInt32(dt.Rows[i]["bEnable"]))
                {
                case 0:
                    toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = true;
                    break;

                case 1:
                    toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = true;
                    break;

                case 2:
                    toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = false;
                    break;

                case 5:
                    toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = true;
                    break;

                default:
                    toolStripMenuBtn.Items[dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower()].Enabled = false;
                    break;
                }
                switch (dt.Rows[i]["vchrBtnID"].ToString().Trim().ToLower())
                {
                case "layout":
                    toolStripMenuBtn.Items["layout"].Visible = true;
                    toolStripMenuBtn.Items["layout"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tLayout.Visible = true;
                    break;

                case "printset":
                    toolStripMenuBtn.Items["printset"].Visible = true;
                    toolStripMenuBtn.Items["printset"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag       = dt.Rows[i]["bEnable"].ToString().Trim();
                    tLayout.Visible = true;
                    break;

                case "export":
                    toolStripMenuBtn.Items["export"].Visible = true;
                    toolStripMenuBtn.Items["export"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tExport.Visible = true;
                    break;

                case "print":
                    toolStripMenuBtn.Items["print"].Visible = true;
                    toolStripMenuBtn.Items["print"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag    = dt.Rows[i]["bEnable"].ToString().Trim();
                    tExport.Visible = true;
                    break;

                case "unaudit":
                    toolStripMenuBtn.Items["unaudit"].Visible = true;
                    toolStripMenuBtn.Items["unaudit"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag      = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAudit.Visible = true;
                    break;

                case "audit":
                    toolStripMenuBtn.Items["audit"].Visible = true;
                    toolStripMenuBtn.Items["audit"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag    = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAudit.Visible = true;
                    break;

                case "unlock":
                    toolStripMenuBtn.Items["unlock"].Visible = true;
                    toolStripMenuBtn.Items["unlock"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tLock.Visible = true;
                    break;

                case "lock":
                    toolStripMenuBtn.Items["lock"].Visible = true;
                    toolStripMenuBtn.Items["lock"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tLock.Visible = true;
                    break;

                case "alter":
                    toolStripMenuBtn.Items["alter"].Visible = true;
                    toolStripMenuBtn.Items["alter"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag    = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSave.Visible = true;
                    break;

                case "undo":
                    toolStripMenuBtn.Items["undo"].Visible = true;
                    toolStripMenuBtn.Items["undo"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSave.Visible = true;
                    break;

                case "save":
                    toolStripMenuBtn.Items["save"].Visible = true;
                    toolStripMenuBtn.Items["save"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSave.Visible = true;
                    break;

                case "del":
                    toolStripMenuBtn.Items["del"].Visible = true;
                    toolStripMenuBtn.Items["del"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag  = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAdd.Visible = true;
                    break;

                case "edit":
                    toolStripMenuBtn.Items["edit"].Visible = true;
                    toolStripMenuBtn.Items["edit"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAdd.Visible = true;
                    break;

                case "add":
                    toolStripMenuBtn.Items["add"].Visible = true;
                    toolStripMenuBtn.Items["add"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag  = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAdd.Visible = true;
                    break;

                case "import":
                    toolStripMenuBtn.Items["import"].Visible = true;
                    toolStripMenuBtn.Items["import"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAdd.Visible = true;
                    break;

                case "delrow":
                    toolStripMenuBtn.Items["delrow"].Visible = true;
                    toolStripMenuBtn.Items["delrow"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAddRow.Visible = true;
                    break;

                case "addrow":
                    toolStripMenuBtn.Items["addrow"].Visible = true;
                    toolStripMenuBtn.Items["addrow"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tAddRow.Visible = true;
                    break;

                case "last":
                    toolStripMenuBtn.Items["last"].Visible = true;
                    toolStripMenuBtn.Items["last"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSel.Visible      = true;
                    lPageInfo.Visible = true;
                    break;

                case "next":
                    toolStripMenuBtn.Items["next"].Visible = true;
                    toolStripMenuBtn.Items["next"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSel.Visible      = true;
                    lPageInfo.Visible = true;
                    break;

                case "prev":
                    toolStripMenuBtn.Items["prev"].Visible = true;
                    toolStripMenuBtn.Items["prev"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSel.Visible      = true;
                    lPageInfo.Visible = true;
                    break;

                case "first":
                    toolStripMenuBtn.Items["first"].Visible = true;
                    toolStripMenuBtn.Items["first"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag    = dt.Rows[i]["bEnable"].ToString().Trim();
                    tSel.Visible      = true;
                    lPageInfo.Visible = true;
                    break;

                case "sel":
                    toolStripMenuBtn.Items["sel"].Visible = true;
                    toolStripMenuBtn.Items["sel"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag  = dt.Rows[i]["bEnable"].ToString().Trim();
                    lPageInfo.Visible = true;
                    break;

                case "refresh":
                    toolStripMenuBtn.Items["refresh"].Visible = true;
                    toolStripMenuBtn.Items["refresh"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag      = dt.Rows[i]["bEnable"].ToString().Trim();
                    lPageInfo.Visible = true;
                    break;

                case "open":
                    toolStripMenuBtn.Items["open"].Visible = true;
                    toolStripMenuBtn.Items["open"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag   = dt.Rows[i]["bEnable"].ToString().Trim();
                    tOpen.Visible = true;
                    break;

                case "close":
                    toolStripMenuBtn.Items["close"].Visible = true;
                    toolStripMenuBtn.Items["close"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag    = dt.Rows[i]["bEnable"].ToString().Trim();
                    tOpen.Visible = true;
                    break;

                case "buckup":
                    toolStripMenuBtn.Items["buckup"].Visible = true;
                    toolStripMenuBtn.Items["buckup"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag     = dt.Rows[i]["bEnable"].ToString().Trim();
                    tBuckUp.Visible = true;
                    break;

                case "autobuckup":
                    toolStripMenuBtn.Items["autobuckup"].Visible = true;
                    toolStripMenuBtn.Items["autobuckup"].Text    = dt.Rows[i]["vchrBtnText"].ToString().Trim();
                    toolStripMenuBtn.Items["layout"].Tag         = dt.Rows[i]["bEnable"].ToString().Trim();
                    tBuckUp.Visible = true;
                    break;
                }
            }
            dtBtnInfo = dt.Copy();
        }
Ejemplo n.º 10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (bU8Improt && lookUpAcc.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("请选择帐套", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    lookUpAcc.Focus();
                    return;
                }

                if (!chkBaseInfo())
                {
                    MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string sErrInfo;

                if (!Login(out sErrInfo))
                {
                    MessageBox.Show("登陆失败!\n\n原因:\n  " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUID.Focus();
                    return;
                }

                if (chkPWD.Checked)
                {
                    string       sPWD      = "";
                    FrmChangePWD frmChgPWD = new FrmChangePWD();
                    frmChgPWD.ShowDialog();
                    if (frmChgPWD.DialogResult == DialogResult.OK)
                    {
                        sPWD = frmChgPWD.sNewPWD;

                        string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'";
                        clsSQLCommond.ExecSql(sSQL);

                        MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    //string sPWD = "";
                    //FrmChangePWD frmChgPWD = new FrmChangePWD();
                    //frmChgPWD.ShowDialog();
                    //if (frmChgPWD.DialogResult == DialogResult.OK)
                    //{
                    //    sPWD = frmChgPWD.sNewPWD;

                    //    string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'";
                    //    clsSQLCommond.ExecSql(sSQL);
                    //    //string s = clsWeb.saveUserInfoPwd(txtUID.Text.Trim(), clsDES.Encrypt(sPWD));
                    //    if (s != "")
                    //    {
                    //        throw new Exception(s);
                    //    }
                    //    MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    //}
                }

                WriteConfig();

                try
                {
                    系统服务.ClsBaseDataInfo.sUid          = txtUID.Text.Trim();
                    系统服务.ClsBaseDataInfo.sLogDate      = dtmLogin.Text.Trim();
                    系统服务.ClsBaseDataInfo.sDataBaseName = txtDataBase.Text;

                    if (bU8Improt)
                    {
                        系统服务.ClsBaseDataInfo.sUFDataBaseName = "UFDATA_" + lookUpAcc.EditValue.ToString().Trim() + "_" + dtmLogin.DateTime.ToString("yyyy").Trim();
                        系统服务.ClsBaseDataInfo.sUFDataBaseText = lookUpAcc.Text.Trim();
                        系统服务.ClsBaseDataInfo.sConnString2    = 系统服务.ClsBaseDataInfo.sConnString.Replace(系统服务.ClsBaseDataInfo.sDataBaseName, 系统服务.ClsBaseDataInfo.sUFDataBaseName);
                    }
                    string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' ";
                    系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim();
                    //系统服务.ClsBaseDataInfo.sUserName = clsWeb.svchrName(txtUID.Text.Trim());
                    if (bU8Improt)
                    {
                        sSQL = "select count(*) from Master.dbo.sysdatabases where name='" + 系统服务.ClsBaseDataInfo.sUFDataBaseName + "'";
                        int iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                        //int iCou = 系统服务.规格化.ReturnInt(clsWeb.sbU8Improt(系统服务.ClsBaseDataInfo.sUFDataBaseName));
                        if (iCou == 0)
                        {
                            MessageBox.Show("年度帐不存在,日期请选择" + dtmLogin.DateTime.AddYears(-1).ToString("yyyy").Trim() + "-12-31");
                            return;
                        }
                    }
                }
                catch
                { }

                DialogResult = DialogResult.OK;
            }
            catch (Exception ee)
            {
                MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 11
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                clsSQLCommond = 系统服务.ClsDataBaseFactory.Instance();

                //if (lookUpAcc.Text.Trim() == string.Empty)
                //{
                //    MessageBox.Show("请选择帐套", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //    lookUpAcc.Focus();
                //    return;
                //}

                if (!chkBaseInfo())
                {
                    MessageBox.Show("请检查信息是否完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string sErrInfo;

                if (!Login(out sErrInfo))
                {
                    MessageBox.Show("登陆失败!\n\n原因:\n  " + sErrInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUID.Focus();
                    return;
                }

                if (chkPWD.Checked)
                {
                    string       sPWD      = "";
                    FrmChangePWD frmChgPWD = new FrmChangePWD();
                    frmChgPWD.ShowDialog();
                    if (frmChgPWD.DialogResult == DialogResult.OK)
                    {
                        sPWD = frmChgPWD.sNewPWD;

                        string sSQL = "update _UserInfo set vchrPwd = '" + clsDES.Encrypt(sPWD) + "' where vchrUid = '" + txtUID.Text.Trim() + "'";
                        clsSQLCommond.ExecSql(sSQL);

                        MessageBox.Show("修改密码成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }

                WriteConfig();

                try
                {
                    系统服务.ClsBaseDataInfo.sUid          = txtUID.Text.Trim();
                    系统服务.ClsBaseDataInfo.sLogDate      = dtmLogin.Text.Trim();
                    系统服务.ClsBaseDataInfo.sDataBaseName = txtDataBase.Text;



                    string sSQL = "select vchrName from dbo._UserInfo where vchrUid = '" + txtUID.Text.Trim() + "' ";
                    系统服务.ClsBaseDataInfo.sUserName = clsSQLCommond.ExecGetScalar(sSQL).ToString().Trim();
                }
                catch
                { }

                DialogResult = DialogResult.OK;
            }
            catch (Exception ee)
            {
                MessageBox.Show("登陆失败! " + ee.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 判断编码原则    -- TH 2012-12-25 20:52
        /// </summary>
        /// <param name="TableID"></param>
        /// <param name="Code"></param>
        /// <param name="thisID"></param>
        /// <returns></returns>
        public static string CheckSerialNumber(string TableID, string thisID)
        {
            string    sSQL  = "SELECT TableID, TableName, Code, Name, Type FROM SerialNumber where TableID = '" + TableID + "'";
            DataTable dt    = clsSQLCommond.ExecQuery(sSQL);
            string    sType = dt.Rows[0]["Type"].ToString().Trim();

            int iLength = thisID.Trim().Length;

            string[] sList = sType.Split('-');

            int    i编码规则长度 = 0;
            string oldID   = "";

            for (int i = 0; i < sList.Length; i++)
            {
                i编码规则长度 = i编码规则长度 + sList[i].Length;
                if (i编码规则长度 < iLength)
                {
                    oldID = thisID.Substring(0, i编码规则长度);
                }
                if (i编码规则长度 == iLength)
                {
                    break;
                }
                if (i编码规则长度 > iLength)
                {
                    return("编码长度不符合编码原则");
                }
            }
            if (iLength > i编码规则长度)
            {
                return("编码长度超出编码原则");
            }

            int iCou = 0;

            switch (TableID.ToLower())
            {
            case "inventoryclass":
                sSQL = "select count(1) from dbo.InventoryClass where cInvClassCode = '" + thisID + "'";
                iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou == 1)
                {
                    return(thisID + "已经存在\n");
                }
                if (thisID.Length > sList[0].Length)
                {
                    sSQL = "select count(1) from dbo.InventoryClass where cInvClassCode = '" + oldID + "'";
                    iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                    if (iCou == 0)
                    {
                        return(thisID + "没有上级编码\n");
                    }
                }
                break;

            case "dealerclass":
                sSQL = "select count(1) from dbo.DealerClass where cDCode = '" + thisID + "'";
                iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou == 1)
                {
                    return(thisID + "已经存在\n");
                }
                if (thisID.Length > sList[0].Length)
                {
                    sSQL = "select count(1) from dbo.DealerClass where cDCode = '" + oldID + "'";
                    iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                    if (iCou == 0)
                    {
                        return(thisID + "没有上级编码\n");
                    }
                }
                break;

            case "customerclass":
                sSQL = "select count(1) from dbo.CustomerClass where cCCode = '" + thisID + "'";
                iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou == 1)
                {
                    return(thisID + "已经存在\n");
                }
                if (thisID.Length > sList[0].Length)
                {
                    sSQL = "select count(1) from dbo.CustomerClass where cCCode = '" + oldID + "'";
                    iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                    if (iCou == 0)
                    {
                        return(thisID + "没有上级编码\n");
                    }
                }
                break;

            case "department":
                sSQL = "select count(1) from dbo.Department where cDepCode = '" + thisID + "'";
                iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou == 1)
                {
                    return(thisID + "已经存在\n");
                }

                if (thisID.Length > sList[0].Length)
                {
                    sSQL = "select count(1) from dbo.Department where cDepCode = '" + oldID + "'";
                    iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                    if (iCou == 0)
                    {
                        return(thisID + "没有上级编码\n");
                    }
                }
                break;

            case "districtclass":
                sSQL = "select count(1) from dbo.DistrictClass where cDCCode = '" + thisID + "'";
                iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou == 1)
                {
                    return(thisID + "已经存在\n");
                }
                if (thisID.Length > sList[0].Length)
                {
                    sSQL = "select count(1) from dbo.DistrictClass where cDCCode = '" + oldID + "'";
                    iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                    if (iCou == 0)
                    {
                        return(thisID + "没有上级编码\n");
                    }
                }
                break;

            case "vendorclass":
                sSQL = "select count(1) from dbo.VendorClass where cVCCode = '" + thisID + "'";
                iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                if (iCou == 1)
                {
                    return(thisID + "已经存在\n");
                }
                if (thisID.Length > sList[0].Length)
                {
                    sSQL = "select count(1) from dbo.VendorClass where cVCCode = '" + oldID + "'";
                    iCou = Convert.ToInt32(clsSQLCommond.ExecGetScalar(sSQL));
                    if (iCou == 0)
                    {
                        return(thisID + "没有上级编码\n");
                    }
                }
                break;
            }

            return("");
        }