Exemplo n.º 1
0
        public bool CheckUser(string UserName, string Password)
        {
            DataSet ds      = new DataSet();
            string  SqlText = "select * from sys_auth_Users";

            string[] cols = new string[] { "UserName", "Password" };
            string[] exps = new string[] { "=", "=" };
            Password = EncryptSerivce.Encrypt(Password);
            object[] valus = new object[] { UserName, Password };
            ds = GetDataSet(SqlText, cols, exps, valus);
            if (ds.Tables[0].Rows.Count == 0)
            {
                object obj;

                try
                {
                    String moduleLibAddress = "net.tcp://Lib.kingrocket.com:8066/TransferService.svc";
                    //去模板库中验证管理员用户
                    obj = CallRemoteServerMethod(moduleLibAddress, "Yqun.BO.LoginBO.dll", "CheckAdminUser",
                                                 new Object[] { UserName, Password });
                }
                catch
                {
                    obj = false;
                }
                return(System.Convert.ToBoolean(obj));
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
    private string UserManageList(string name, string fileds, string sqlwhere, string key, int ftype, out int pageCount, out int records)
    {
        DataTable dt = DbHelperSQL.GetDataTablePager(name, fileds, sqlwhere, key, "ID", OrderType, PageIndex, PageSize, out pageCount, out records);

        if (dt != null)
        {
            DataSet ds;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ds = DbHelperSQL.Query("SELECT top 1 segment FROM sys_users_testroom where username='******'");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    dt.Rows[i]["segment"] = ds.Tables[0].Rows[0][0].ToString();
                }
            }

            DataTable dtnew = new DataTable();
            dtnew = dt.Clone();

            foreach (DataRow oldDR in dt.Rows)
            {
                DataRow newDR = dtnew.NewRow();      //新表创建新行
                newDR.ItemArray   = oldDR.ItemArray; //旧表结构行赋给新表结构行
                oldDR["Password"] = EncryptSerivce.Dencrypt(oldDR["Password"].ToString());
                dtnew.ImportRow(oldDR);
            }
            return(JsonConvert.SerializeObject(dtnew));
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 3
0
        /// <summary>
        /// 设置服务端的数据库连接信息
        /// </summary>
        public static void SettingDBConnectionInfo()
        {
            DataSet DataSet  = new DataSet("DataSourceSet");
            String  FileName = Path.Combine(SystemFolder.DataSourceFolder, "DataSource.xml");

            if (File.Exists(FileName))
            {
                DataSet.ReadXml(FileName);

                String DataAdapterType     = DataSetCoder.GetProperty(DataSet, 0, "name", "DataAdapterType", "value").ToString();
                String DataBaseType        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataBaseType", "value").ToString();
                String DataSource          = DataSetCoder.GetProperty(DataSet, 0, "name", "DataSource", "value").ToString();
                String DataInstance        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataInstance", "value").ToString();
                String DataUserName        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataUserName", "value").ToString();
                String DataPassword        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataPassword", "value").ToString();
                String DataISAttach        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataISAttach", "value").ToString();
                String DataIntegratedLogin = DataSetCoder.GetProperty(DataSet, 0, "name", "DataIntegratedLogin", "value").ToString();

                ServerLoginInfos.DBConnectionInfo.DataAdapterType     = DataAdapterType;
                ServerLoginInfos.DBConnectionInfo.DataBaseType        = DataBaseType;
                ServerLoginInfos.DBConnectionInfo.DataSource          = EncryptSerivce.Dencrypt(DataSource);
                ServerLoginInfos.DBConnectionInfo.DataInstance        = EncryptSerivce.Dencrypt(DataInstance);
                ServerLoginInfos.DBConnectionInfo.DataUserName        = EncryptSerivce.Dencrypt(DataUserName);
                ServerLoginInfos.DBConnectionInfo.DataPassword        = EncryptSerivce.Dencrypt(DataPassword);
                ServerLoginInfos.DBConnectionInfo.DataISAttach        = DataISAttach;
                ServerLoginInfos.DBConnectionInfo.LocalStartPath      = AppDomain.CurrentDomain.BaseDirectory + @"\";
                ServerLoginInfos.DBConnectionInfo.DataIntegratedLogin = DataIntegratedLogin;
            }
        }
Exemplo n.º 4
0
        public static int SetUserPassword(string UserName, string Password)
        {
            try
            {
                StringBuilder SQL_UpdateData = new StringBuilder();
                //增加条件  Scts_1=Getdate()  2013-10-17
                SQL_UpdateData.Append("Update sys_auth_Users set Scts_1=Getdate(),Password ='******' Where UserName = '******'");

                object o = CallService("Yqun.BO.BOBase.dll", "ExcuteCommand", new object[] { SQL_UpdateData.ToString() });
                if (o == null)
                {
                    return(-1);
                }

                return(System.Convert.ToInt32(o));
            }
            catch
            {
                return(-1);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 解密
        /// </summary>
        /// <returns></returns>
        public bool UnEncoderFile()
        {
            try
            {
                StringBuilder _UMSB     = new StringBuilder();
                FileStream    _FS       = new FileStream(_XMLPath, FileMode.Open);
                byte[]        _tempbyte = new byte[1024];

                int num = _FS.Read(_tempbyte, 0, 1024);
                while (num > 0)
                {
                    _UMSB.Append(System.Text.Encoding.UTF8.GetString(_tempbyte, 0, num));
                    num = _FS.Read(_tempbyte, 0, 1024);
                }
                _FS.Close();
                _FS.Dispose();
                File.Delete(_XMLPath);
                FileStream _Efs       = new FileStream(_XMLPath, FileMode.CreateNew);
                byte[]     _Etempbyte = System.Text.Encoding.UTF8.GetBytes(EncryptSerivce.Dencrypt(_UMSB.ToString()));
                _Efs.Write(_Etempbyte, 0, _Etempbyte.Length);
                _Efs.Flush();
                _Efs.Close();
                _Efs.Dispose();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int n = LineDbHelperSQL.ExecuteSql("UPDATE sys_User SET Password='******' WHERE UserName='******'");

        if (n > 0)
        {
            Label1.Text = "密码修改成功!";
        }
        Bind();
    }
Exemplo n.º 7
0
 private void Bind()
 {
     if (Session["UserName"] != null)
     {
         lbl_username.Text = Session["UserName"].ToString();
         DataSet ds = LineDbHelperSQL.Query("SELECT * FROM sys_User WHERE UserName='******'");
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             lbl_old.Text = EncryptSerivce.Dencrypt(ds.Tables[0].Rows[0]["Password"].ToString());
         }
     }
 }
Exemplo n.º 8
0
        private void NewUser()
        {
            TreeNode  Node      = OrganizationView.SelectedNode;
            Selection selection = Node.Tag as Selection;
            Boolean   IsNode    = System.Convert.ToBoolean(selection.Value);

            if (IsNode)
            {
                UserDialog userForm = new UserDialog();
                userForm.Text = "新建用户";
                if (DialogResult.OK == userForm.ShowDialog(this))
                {
                    User user = new User();
                    user.Index    = Guid.NewGuid().ToString();
                    user.Code     = DepositoryUser.GetNextCode(Node.Name);
                    user.Name     = userForm.TextBox_Name.Text;
                    user.Password = EncryptSerivce.Encrypt(userForm.TextBox_Password1.Text);
                    user.IsSys    = false;

                    foreach (DataGridViewRow row in userForm.RolesView.Rows)
                    {
                        Role role = row.Tag as Role;
                        if (role != null)
                        {
                            user.Roles.Add(role);
                        }
                    }

                    bool r = DepositoryUser.New(user);
                    if (r)
                    {
                        TreeNode uNode = new TreeNode();
                        uNode.Text               = user.Name;
                        uNode.Name               = user.Code;
                        uNode.ImageIndex         = 2;
                        uNode.SelectedImageIndex = 2;
                        selection       = new Selection();
                        selection.ID    = user.Index;
                        selection.Value = false.ToString();
                        uNode.Tag       = selection;
                        Node.Nodes.Add(uNode);

                        Node.Expand();
                        OrganizationView.SelectedNode = uNode;
                    }

                    string Msg = r ? "新建用户成功。" : "新建用户失败。";
                    MessageBox.Show(Msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 登录试验室管理系统
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public bool CheckUserSys(string UserName, string Password)
        {
            DataSet ds      = new DataSet();
            string  SqlText = "select * from sys_BaseUsers";

            string[] cols = new string[] { "UserName", "Password" };
            string[] exps = new string[] { "=", "=" };
            Password = EncryptSerivce.Encrypt(Password);
            object[] valus = new object[] { UserName, Password };

            ds = GetDataSet(SqlText, cols, exps, valus);
            if (ds.Tables[0].Rows.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 10
0
        private void EditUser()
        {
            TreeNode  Node      = OrganizationView.SelectedNode;
            Selection selection = Node.Tag as Selection;
            Boolean   IsUser    = !System.Convert.ToBoolean(selection.Value);

            if (IsUser)
            {
                UserDialog userForm = new UserDialog();
                User       user     = DepositoryUser.Init(selection.ID);
                userForm.EditUser = user;
                userForm.Text     = "编辑用户";

                if (DialogResult.OK == userForm.ShowDialog(this))
                {
                    user.Name     = userForm.TextBox_Name.Text;
                    user.Password = EncryptSerivce.Encrypt(userForm.TextBox_Password1.Text);
                    user.IsSys    = false;

                    user.Roles.Clear();
                    foreach (DataGridViewRow row in userForm.RolesView.Rows)
                    {
                        Role role = row.Tag as Role;
                        if (role != null)
                        {
                            user.Roles.Add(role);
                        }
                    }

                    bool r = DepositoryUser.Update(user);
                    if (r)
                    {
                        Node.Text = userForm.TextBox_Name.Text;
                    }

                    string Msg = r ? "更新用户成功。" : "更新用户失败。";
                    MessageBox.Show(Msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 11
0
        static TransferService()
        {
            //读取配置信息
            String DataAdapterType = ConfigurationManager.AppSettings["DataAdapterType"];
            String DataBaseType    = ConfigurationManager.AppSettings["DataBaseType"];
            String DataSource      = ConfigurationManager.AppSettings["DataSource"];
            String DataInstance    = ConfigurationManager.AppSettings["DataInstance"];
            String DataUserName    = ConfigurationManager.AppSettings["DataUserName"];
            String DataPassword    = ConfigurationManager.AppSettings["DataPassword"];
            String DataISAttach    = ConfigurationManager.AppSettings["DataISAttach"];
            String AssemblyPath    = ConfigurationManager.AppSettings["AssemblyPath"];

            ServerLoginInfos.DBConnectionInfo.DataAdapterType = DataAdapterType;
            ServerLoginInfos.DBConnectionInfo.DataBaseType    = DataBaseType;
            ServerLoginInfos.DBConnectionInfo.DataSource      = EncryptSerivce.Dencrypt(DataSource);
            ServerLoginInfos.DBConnectionInfo.DataInstance    = EncryptSerivce.Dencrypt(DataInstance);
            ServerLoginInfos.DBConnectionInfo.DataUserName    = EncryptSerivce.Dencrypt(DataUserName);
            ServerLoginInfos.DBConnectionInfo.DataPassword    = EncryptSerivce.Dencrypt(DataPassword);
            ServerLoginInfos.DBConnectionInfo.DataISAttach    = DataISAttach;
            ServerLoginInfos.DBConnectionInfo.LocalStartPath  = AppDomain.CurrentDomain.BaseDirectory + AssemblyPath.Trim("\\".ToCharArray()) + @"\";

            log4net.Config.XmlConfigurator.Configure();
            //LocalQuartzService.GetQuartzService().Start();
        }
Exemplo n.º 12
0
        public string LoginMsg(string UserName, string UserPassword, string MachineCode)
        {
            DataTable dt = GetUserInfo(UserName);

            if (dt == null)
            {
                return("用户不存在,请确认用户名正确后重新登录!");
            }
            else if (dt.Rows.Count <= 0)
            {
                object temp = GetRemoteAdminTable(UserName);
                if (temp == null)
                {
                    return("用户不存在,请确认用户名正确后重新登录!");
                }
                else
                {
                    dt = temp as DataTable;
                    if (dt.Rows.Count <= 0)
                    {
                        return("用户不存在,请确认用户名正确后重新登录!");
                    }
                    else if (dt.Rows.Count >= 2)
                    {
                        return("系统中存在多条用户信息,请联系管理员!");
                    }
                    else
                    {
                        if (EncryptSerivce.Encrypt(UserPassword) != dt.Rows[0]["Password"].ToString())
                        {
                            return("密码错误,请确认正确后重新登录!");
                        }
                    }
                }
            }
            else if (dt.Rows.Count >= 2)
            {
                return("系统中存在多条用户信息,请联系管理员!");
            }
            //else if (dt.Rows[0]["Scdel"].ToString() == "1")
            //{
            //    return "该用户信息已被删除,请联系管理员处理后重新登录!";
            //}
            else
            {
                if (EncryptSerivce.Encrypt(UserPassword) != dt.Rows[0]["Password"].ToString())
                {
                    return("密码错误,请确认正确后重新登录!");
                }
                else if (MachineCode.Length != 20)
                {
                    return("采集系统设备编码配置有误,请联系管理重新配置后重新登录!");
                }
                else
                {
                    if (dt.Rows[0]["Code"].ToString().Trim().Length > 16)
                    {
                        if (dt.Rows[0]["Code"].ToString().Trim().Substring(0, 16) != MachineCode.Trim().Substring(0, 16) && dt.Rows[0]["Devices"].ToString().Trim().IndexOf(MachineCode) < 0)
                        {
                            return("用户无权限操作此设备!");
                        }
                    }
                    else if (dt.Rows[0]["Code"].ToString().Trim().Length != 20 && dt.Rows[0]["Code"].ToString().Trim().Length != 8)
                    {
                        return("用户编码有误,请联系管理员!");
                    }
                }
            }
            return("true");
        }
Exemplo n.º 13
0
    private string SaveSysBsUsers(string RID, string uname, string upwd, string truename, string active, string group, string temp)
    {
        sys_line sysBaseLine = System.Web.HttpContext.Current.Session["SysBaseLine"] as sys_line;

        //0:操作失败,1:操作成功,2:用户名重复.
        if (!string.IsNullOrEmpty(uname))
        {
            string SQL = "";
            #region 添加线路库的数据
            SQL = "SELECT * FROM dbo.sys_BaseUsers WHERE UserName='******'";
            DataSet sys_ds = LineDbHelperSQL.Query(string.Format(SQL, uname));                      //判断大库里面的use表
            SQL = "SELECT * FROM  dbo.sys_BaseLine_Users WHERE UserName='******' AND LineID='{1}'";
            DataSet sys_line_ds = LineDbHelperSQL.Query(string.Format(SQL, uname, sysBaseLine.ID)); //判断大库里面的Line权限
            SQL = "SELECT id FROM sys_bs_users where UserName='******';";
            DataSet ds = DbHelperSQL.Query(string.Format(SQL, uname));
            if (ds != null && ds.Tables[0].Rows.Count == 0)
            {
                if (sys_ds != null && sys_ds.Tables[0].Rows.Count == 0)
                {
                    #region

                    SQL = @"INSERT dbo.sys_BaseUsers
                                                                        ( UserName ,
                                                                          Password ,
                                                                          IsActive ,
                                                                          TrueName ,
                                                                          LineID ,
                                                                          Descrption ,
                                                                          RoleName
                                                                        )VALUES  ( '{0}' ,
                                                                          '{1}' ,
                                                                          '{2}' ,
                                                                          '{3}' ,
                                                                         '{4}' , 
                                                                         '{5}' , 
                                                                         '{6}'
                                                                        )";
                    LineDbHelperSQL.ExecuteSql(string.Format(SQL, uname, EncryptSerivce.Encrypt(upwd), active, truename, sysBaseLine.ID, sysBaseLine.LineName, group));


                    SQL = @"INSERT dbo.sys_BaseLine_Users
                                                                ( UserName, LineID)
                                                        VALUES  ( '{0}', 
                                                                  '{1}'
                                                                  )";
                    LineDbHelperSQL.ExecuteSql(string.Format(SQL, uname, sysBaseLine.ID));
                    #endregion
                }
                else
                {
                    #region
                    //if ((group == "S" && ((sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "S") || (sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "SS"))) || (group == "SS" && ((sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "S") || (sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "SS"))))
                    if ((group == "S" || group == "SS" || group == "X" || group == "A") && ((sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "S") || (sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "SS") || (sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "X") || (sys_ds.Tables[0].Rows[0]["RoleName"].ToString() == "A")))
                    {
                        SQL = @"INSERT dbo.sys_BaseLine_Users
                                                                ( UserName, LineID )
                                                        VALUES  ( '{0}', 
                                                                  '{1}'
                                                                  )";
                        LineDbHelperSQL.ExecuteSql(string.Format(SQL, uname, sysBaseLine.ID));
                    }
                    else
                    {
                        return("2");
                    }
                    #endregion
                }
                SQL = "INSERT INTO sys_bs_users(UserName,Password,IsActive,TrueName)VALUES('{0}','{1}','{2}','{3}');";
                int userCount = DbHelperSQL.ExecuteSql(string.Format(SQL, uname, EncryptSerivce.Encrypt(upwd), active, truename));
                if (userCount > 0)
                {
                    StringBuilder str = new StringBuilder();
                    SQL = "INSERT INTO sys_users_testroom(username,testroomcode,segment)VALUES('{0}','{1}','{2}');";
                    string[] roomCode = temp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < roomCode.Length; i++)
                    {
                        str.Append(string.Format(SQL, uname, roomCode[i], group));
                    }
                    DbHelperSQL.ExecuteSql(str.ToString());
                    return("1");
                }
                return("0");
            }
            else
            {
                SQL = "UPDATE sys_bs_users set Password='******',IsActive='{1}',TrueName='{2}' where UserName='******';";
                int userCount = DbHelperSQL.ExecuteSql(string.Format(SQL, EncryptSerivce.Encrypt(upwd), active, truename, uname));
                if (userCount > 0)
                {
                    SQL = "delete from sys_users_testroom where username='******';";
                    DbHelperSQL.ExecuteSql(string.Format(SQL, uname));
                    StringBuilder str = new StringBuilder();
                    SQL = "INSERT INTO sys_users_testroom(username,testroomcode,segment)VALUES('{0}','{1}','{2}');";
                    string[] roomCode = temp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < roomCode.Length; i++)
                    {
                        str.Append(string.Format(SQL, uname, roomCode[i], group));
                    }
                    DbHelperSQL.ExecuteSql(str.ToString());

                    #region 修改大库的密码
                    SQL = "SELECT * FROM dbo.sys_BaseUsers WHERE UserName='******' ";
                    DataSet sys_ds_edit = LineDbHelperSQL.Query(string.Format(SQL, uname));//判断大库里面的use表
                    if (sys_ds_edit != null && sys_ds_edit.Tables.Count > 0)
                    {
                        SQL = @"UPDATE dbo.sys_BaseUsers SET  Password='******' WHERE UserName='******'";
                        LineDbHelperSQL.ExecuteSql(string.Format(SQL, EncryptSerivce.Encrypt(upwd), uname));
                    }
                    #endregion
                    return("1");
                }
                return("0");
            }
            #endregion
        }
        else
        {
            return("0");
        }
    }
Exemplo n.º 14
0
        /// <summary>
        /// 同步本地用户信息
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="UserPwd"></param>
        /// <param name="UserCode"></param>
        /// <param name="UserTestCode"></param>
        /// <returns></returns>
        public bool SysUserInfo(string UserName, string UserPwd, string UserCode, string UserTestCode)
        {
            DataTable _dt = _SqlLocalHlper.GetLocalData("select * from userinfo where UserName='******'");
            if (_dt != null && _dt.Rows.Count > 0)
            {
                _SqlLocalHlper.Execute("delete from userinfo where UserName='******'");

            }
            return _SqlLocalHlper.Execute("insert into UserInfo values('" + Guid.NewGuid().ToString() + "','" + UserName + "','" + EncryptSerivce.Encrypt(UserPwd) + "','" + UserCode + "','" + UserTestCode + "')");
        }
Exemplo n.º 15
0
 /// <summary>
 /// 获取用户登录信息
 /// </summary>
 /// <param name="UserName"></param>
 /// <returns></returns>
 public DataTable GetUserInfo(string UserName, string Pwd)
 {
     return _SqlLocalHlper.GetLocalData("select * from userinfo where UserName='******' and UserPwd='" + EncryptSerivce.Encrypt(Pwd) + "'");
 }
Exemplo n.º 16
0
        private void ButtonExe_Click(object sender, EventArgs e)
        {
            String  Info   = "";
            Boolean Result = false;

            try
            {
                DataSet DataSet  = new DataSet("DataSourceSet");
                String  FileName = Path.Combine(SystemFolder.DataSourceFolder, "DataSource.xml");

                if (File.Exists(FileName))
                {
                    DataSet.ReadXml(FileName);

                    String DataAdapterType     = DataSetCoder.GetProperty(DataSet, 0, "name", "DataAdapterType", "value").ToString();
                    String DataBaseType        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataBaseType", "value").ToString();
                    String DataSource          = DataSetCoder.GetProperty(DataSet, 0, "name", "DataSource", "value").ToString();
                    String DataInstance        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataInstance", "value").ToString();
                    String DataUserName        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataUserName", "value").ToString();
                    String DataPassword        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataPassword", "value").ToString();
                    String DataISAttach        = DataSetCoder.GetProperty(DataSet, 0, "name", "DataISAttach", "value").ToString();
                    String DataIntegratedLogin = DataSetCoder.GetProperty(DataSet, 0, "name", "DataIntegratedLogin", "value").ToString();

                    ServerLoginInfos.DBConnectionInfo.DataAdapterType     = DataAdapterType;
                    ServerLoginInfos.DBConnectionInfo.DataBaseType        = DataBaseType;
                    ServerLoginInfos.DBConnectionInfo.DataSource          = EncryptSerivce.Dencrypt(DataSource);
                    ServerLoginInfos.DBConnectionInfo.DataInstance        = EncryptSerivce.Dencrypt(DataInstance);
                    ServerLoginInfos.DBConnectionInfo.DataUserName        = EncryptSerivce.Dencrypt(DataUserName);
                    ServerLoginInfos.DBConnectionInfo.DataPassword        = EncryptSerivce.Dencrypt(DataPassword);
                    ServerLoginInfos.DBConnectionInfo.DataISAttach        = DataISAttach;
                    ServerLoginInfos.DBConnectionInfo.LocalStartPath      = AppDomain.CurrentDomain.BaseDirectory + @"\";
                    ServerLoginInfos.DBConnectionInfo.DataIntegratedLogin = DataIntegratedLogin;

                    String DataBaseName = ServerLoginInfos.DBConnectionInfo.DataInstance;
                    int    index        = DataBaseName.ToLower().IndexOf("[apppath]");
                    if (index != -1)
                    {
                        DataBaseName = DataBaseName.ToLower().Replace("[apppath]", Application.StartupPath);
                    }

                    StringBuilder sql_select = new StringBuilder();
                    sql_select.Append("dump transaction [");
                    sql_select.Append(DataBaseName);
                    sql_select.Append("] with no_log;backup log [");
                    sql_select.Append(DataBaseName);
                    sql_select.Append("] with no_log;dbcc shrinkdatabase([");
                    sql_select.Append(DataBaseName);
                    sql_select.Append("])");

                    object o = Agent.CallLocalService("Yqun.BO.BOBase.dll", "ExcuteCommand", new object[] { sql_select.ToString() });
                    Result = (System.Convert.ToInt32(o) == 1);

                    Info = (Result ? "压缩数据库成功。" : "压缩数据库失败!");
                }
                else
                {
                    Info = "数据库连接信息未找到,请核实与铁路试验信息管理系统放在同一目录下!";
                }
            }
            catch (Exception ex)
            {
                logger.Error("ShrinkDatabaseApp:" + ex.Message);
                Info = "压缩数据库失败!";
            }

            this.label1.Text      = Info;
            this.label1.ForeColor = (Result ? Color.Black : Color.Red);
            this.label1.Font      = (Result ? defaultFont : boldFont);
        }