Beispiel #1
0
        private void btnImprot()
        {
            string sSQL = "insert into dbo._UserInfo(vchrUid,vchrName,vchrPwd,vchrRemark,dtmCreate,dtmClose)select cUser_Id,cUser_Name,'999','','1900-01-01','2099-12-31' from UFSystem..UA_User where cUser_Id not in (select vchrUid from _UserInfo)";

            clsSQL.ExecSql(sSQL);
            GetGridView();
            MessageBox.Show("同步U8账号成功,请进入系统设置权限!");
        }
Beispiel #2
0
        private bool Login(out string sEr)
        {
            bool b = false;

            sEr = "";
            try
            {
                string sSQL = "";
                if (txtUID.Text.ToLower().Trim() != "admin" || txtUID.Text.ToLower().Trim() != "system")
                {
                    sSQL = "select  vchrUid, vchrPwd, vchrRemark, tstamp, dtmCreate, dtmClose from  _UserInfo " +
                           "where vchrUid = '" + txtUID.Text.Trim() + "' and vchrPwd = '" + clsDES.Encrypt(txtPWD.Text.Trim()) + "'";
                }
                else
                {
                    sSQL = "select  vchrUid, vchrPwd, vchrRemark, tstamp, dtmCreate, dtmClose from  _UserInfo " +
                           "where vchrUid = '" + txtUID.Text.Trim() + "' and (vchrPwd = '" + (txtPWD.Text.Trim()) + "' or vchrPwd = '" + clsDES.Encrypt(txtPWD.Text.Trim()) + "')";
                }

                DataTable dt = clsSQLCommond.ExecQuery(sSQL);

                int iCou = dt.Rows.Count;
                if (iCou == 1)
                {
                    if (DateTime.Parse(Convert.ToDateTime(dt.Rows[0]["dtmClose"]).ToString("yyyy-MM-dd")) < DateTime.Today.AddDays(+1))
                    {
                        sEr = "帐号已被停用!";
                    }
                    else
                    {
                        sSQL = "insert into Define1(S1,s6,SysCreateDate)values('" + txtUID.Text.Trim() + "','系统登录',getdate())";
                        clsSQLCommond.ExecSql(sSQL);
                        b = true;
                    }
                }
                else
                {
                    sEr = "帐号或者密码错误!";
                }
            }
            catch (Exception ee)
            {
                sEr = ee.Message;
                b   = false;
            }
            return(b);
        }
Beispiel #3
0
        public bool BuckUpDataBase(string sPathInfo)
        {
            bool b = false;

            try
            {
                string sSQL = "BACKUP DATABASE [" + 系统服务.ClsBaseDataInfo.sDataBaseName + "] TO  DISK = N'" + sPathInfo + "' " +
                              "WITH NOFORMAT, NOINIT,  NAME = N'TH_Test-完整 数据库 备份',  " +
                              "SKIP, NOREWIND, NOUNLOAD,  STATS = 10";
                clsSQLCommond.ExecSql(sSQL);
                b = true;
            }
            catch
            {
                throw new Exception("备份数据库操作失败!");
            }
            return(b);
        }
Beispiel #4
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 (!sInfo.ToLower().EndsWith("exit") && !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);
            }
        }
Beispiel #5
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);
            }
        }
Beispiel #6
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);
            }
        }