Beispiel #1
0
        /// <summary>
        /// 附件上传
        /// </summary>
        /// <param name="SBID"></param>
        /// <param name="fileBytes"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool RetBoolUpFile(string SBID, byte[] fileBytes, out string errMsg)
        {
            errMsg = "";

            bool flag = false;

            if (fileBytes.Length > 0)
            {
                sql = "update T_BASE_DEVICE set B_ATTACHMENT=? where T_DEVICEID='" + SBID + "'";

                OleDbConnection con = new OleDbConnection(DBdb2.SetConString());
                try
                {
                    con.Open();
                    OleDbCommand oledbcom = new OleDbCommand(sql, con);

                    oledbcom.Parameters.Add("?", fileBytes);

                    if (oledbcom.ExecuteNonQuery() > 0)
                    {
                        flag = true;
                    }

                    con.Close();
                }
                catch (Exception ex)
                {
                    errMsg = ex.Message;
                }
                finally { con.Close(); }
            }

            return(flag);
        }
Beispiel #2
0
 /// <summary>
 /// 编辑人员信息
 /// </summary>
 /// <param name="oldId">原用户名称</param>
 /// <param name="trueName">真实姓名</param>
 /// <param name="id">新用户名称</param>
 /// <param name="pwd">用户密码</param>
 /// <param name="classID">班值编码</param>
 /// <param name="path">图片文件(字节数组)</param>
 /// <returns></returns>
 public bool EditMemberInfo(string oldId, string trueName, string id, string pwd, string classID, byte[] img)
 {
     try
     {
         if (img != null)
         {
             OleDbConnection con = new OleDbConnection(DBdb2.SetConString());
             con.Open();
             if (oldId == id)
             {
                 sql += "update T_SYS_MEMBERINFO set T_USERNAME=?,T_PASSWD=?,T_CLASSID=?,B_ATTACHMENT=? where T_USERID='" + oldId + "'";
                 OleDbCommand oledbcom = new OleDbCommand(sql, con);
                 oledbcom.Parameters.Add("?", trueName);
                 oledbcom.Parameters.Add("?", pwd);
                 oledbcom.Parameters.Add("?", classID);
                 oledbcom.Parameters.Add("?", img);
                 if (oledbcom.ExecuteNonQuery() > 0)
                 {
                     result = true;
                 }
             }
             else
             {
                 sql += "update T_SYS_MEMBERINFO set T_USERID=?,T_USERNAME=?,T_PASSWD=?,T_CLASSID=?,B_ATTACHMENT=? where T_USERID='" + oldId + "'";
                 OleDbCommand oledbcom = new OleDbCommand(sql, con);
                 oledbcom.Parameters.Add("?", id);
                 oledbcom.Parameters.Add("?", trueName);
                 oledbcom.Parameters.Add("?", pwd);
                 oledbcom.Parameters.Add("?", classID);
                 oledbcom.Parameters.Add("?", img);
                 result = DBdb2.RunNonQuery("update T_SYS_MEMBERRELATION set T_USERID='" + id + "' where T_USERID='" + oldId + "';", out errMsg);
                 if (oledbcom.ExecuteNonQuery() > 0 && result == true)
                 {
                     result = true;
                 }
             }
             con.Close();
         }
         else
         {
             if (oldId == id)
             {
                 sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "',T_CLASSID='" + classID + "' where T_USERID='" + oldId + "';";
             }
             else
             {
                 sql += "update T_SYS_MEMBERINFO set T_USERID='" + id + "',T_USERNAME='******',T_PASSWD='" + pwd + "',T_CLASSID='" + classID + "' where T_USERID='" + oldId + "';update T_SYS_MEMBERRELATION set T_USERID='" + id + "' where T_USERID='" + oldId + "';";
             }
             result = DBdb2.RunNonQuery(sql, out errMsg);
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message);
     }
     return(result);
 }
Beispiel #3
0
 /// <summary>
 /// 添加人员信息
 /// </summary>
 /// <param name="id">用户编码</param>
 /// <param name="name">真实姓名</param>
 /// <param name="pwd">登陆密码</param>
 /// <param name="classId">值别ID</param>
 /// <param name="img">图片</param>
 /// <returns></returns>
 public bool AddMember(string id, string name, string pwd, string classId, byte[] img)
 {
     if (img.Length > 0)
     {
         sql = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD,T_CLASSID,B_ATTACHMENT) values(?,?,?,?,?);";
     }
     else
     {
         sql = "insert into T_SYS_MEMBERINFO(T_USERID,T_USERNAME,T_PASSWD,T_CLASSID) values(?,?,?,?);";
     }
     try
     {
         OleDbConnection con = new OleDbConnection(DBdb2.SetConString());
         con.Open();
         OleDbCommand oledbcom = new OleDbCommand(sql, con);
         if (img.Length > 0)
         {
             oledbcom.Parameters.Add("?", id);
             oledbcom.Parameters.Add("?", name);
             oledbcom.Parameters.Add("?", pwd);
             oledbcom.Parameters.Add("?", classId);
             oledbcom.Parameters.Add("?", img);
         }
         else
         {
             oledbcom.Parameters.Add("?", id);
             oledbcom.Parameters.Add("?", name);
             oledbcom.Parameters.Add("?", pwd);
             oledbcom.Parameters.Add("?", classId);
         }
         if (oledbcom.ExecuteNonQuery() > 0)
         {
             result = true;
         }
         con.Close();
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message);
     }
     return(result);
 }
Beispiel #4
0
        /// <summary>
        /// 上传文档
        /// </summary>
        /// <param name="xmlID"></param>
        /// <param name="xmlName"></param>
        /// <param name="fileBytes"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool RetBoolUpFile(string unit_id, string Name, string type, byte[] fileBytes)
        {
            this.init();
            string errMsg = "";
            bool   flag   = false;

            if (fileBytes.Length > 0)
            {
                if (rlDBType == "DB2")
                {
                }
                else
                {
                    string sql = "insert into  T_BASE_DATUNM_DATA(UNIT_ID,FILE_DESC,FILE_TYPE,FILE_DATA,T_TIME)values('" + unit_id + "','" + Name + "','" + type + "',? ,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "') ";
                    //string sql = "insert into  T_BASE_DATUNM_DATA(UNIT_ID,FILE_DESC,FILE_TYPE,T_TIME)values('" + unit_id + "','" + Name + "','" + type + "' ,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "') ";
                    OleDbConnection con = new OleDbConnection(DBdb2.SetConString());
                    try
                    {
                        con.Open();
                        OleDbCommand oledbcom = new OleDbCommand(sql, con);

                        oledbcom.Parameters.Add("?", fileBytes);

                        if (oledbcom.ExecuteNonQuery() > 0)
                        {
                            flag = true;
                        }

                        con.Close();
                    }
                    catch (Exception ex)
                    {
                        errMsg = ex.Message;
                    }
                    finally { con.Close(); }
                }
            }

            return(flag);
        }
Beispiel #5
0
        public bool EditMemberInfo(string userIDO, string userID, string userName, string pwd, byte[] img, string treeNodeId)
        {
            string rlDBType = dl.init();
            string sql      = "";
            string errMsg   = "";
            bool   result   = false;

            if (rlDBType == "SQL")
            {
                try
                {
                    if (img != null)
                    {
                        SqlConnection sqlconn = SAC.DBOperations.DBsql.GetConnection();
                        if (userIDO == userID)
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERNAME=@T_USERNAME,T_PASSWD=@T_PASSWD,B_ATTACHMENT=@B_ATTACHMENT where T_USERID='" + userIDO + "'";
                            SqlCommand sqlcmd = new SqlCommand(sql, sqlconn);
                            sqlcmd.Parameters.Add("@T_USERNAME", userName);
                            sqlcmd.Parameters.Add("@T_PASSWD", pwd);
                            sqlcmd.Parameters.Add("@B_ATTACHMENT", img);
                            if (sqlcmd.ExecuteNonQuery() > 0)
                            {
                                result = true;
                            }
                        }
                        else
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERID=@T_USERID,T_USERNAME=@T_USERNAME,T_PASSWD=@T_PASSWD,B_ATTACHMENT=@B_ATTACHMENT where T_USERID='" + userIDO + "'";
                            SqlCommand sqlcmd = new SqlCommand(sql, sqlconn);
                            sqlcmd.Parameters.Add("@T_USERID", userID);
                            sqlcmd.Parameters.Add("@T_USERNAME", userName);
                            sqlcmd.Parameters.Add("@T_PASSWD", pwd);
                            sqlcmd.Parameters.Add("@B_ATTACHMENT", img);
                            result = DBsql.RunNonQuery("update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';", out errMsg);
                            if (sqlcmd.ExecuteNonQuery() > 0 && result == true)
                            {
                                result = true;
                            }
                        }
                        sqlconn.Close();
                    }
                    else
                    {
                        if (userIDO == userID)
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';";
                        }
                        else
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERID='" + userID + "',T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';";
                        }
                        result = dl.RunNonQuery(sql, out errMsg);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message);
                }
            }
            else if (rlDBType == "DB2")
            {
                try
                {
                    if (img != null)
                    {
                        OleDbConnection con = new OleDbConnection(DBdb2.SetConString());
                        con.Open();
                        if (userIDO == userID)
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERNAME=?,T_PASSWD=?,B_ATTACHMENT=? where T_USERID='" + userIDO + "'";
                            OleDbCommand oledbcom = new OleDbCommand(sql, con);
                            oledbcom.Parameters.Add("?", userName);
                            oledbcom.Parameters.Add("?", pwd);
                            oledbcom.Parameters.Add("?", img);
                            if (oledbcom.ExecuteNonQuery() > 0)
                            {
                                result = true;
                            }
                        }
                        else
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERID=?,T_USERNAME=?,T_PASSWD=?,B_ATTACHMENT=? where T_USERID='" + userIDO + "'";
                            OleDbCommand oledbcom = new OleDbCommand(sql, con);
                            oledbcom.Parameters.Add("?", userID);
                            oledbcom.Parameters.Add("?", userName);
                            oledbcom.Parameters.Add("?", pwd);
                            oledbcom.Parameters.Add("?", img);
                            result = DBdb2.RunNonQuery("update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';", out errMsg);
                            if (oledbcom.ExecuteNonQuery() > 0 && result == true)
                            {
                                result = true;
                            }
                        }
                        con.Close();
                    }
                    else
                    {
                        if (userIDO == userID)
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';";
                        }
                        else
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERID='" + userID + "',T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';";
                        }
                        result = dl.RunNonQuery(sql, out errMsg);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message);
                }
            }
            else if (rlDBType == "ORACLE")
            {
                try
                {
                    if (img != null)
                    {
                        OracleConnection con = new OracleConnection(SAC.DBOperations.OracleHelper.retStr());
                        con.Open();
                        if (userIDO == userID)
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERNAME=:blobtodb,T_PASSWD=:blobtodb,B_ATTACHMENT=:blobtodb where T_USERID='" + userIDO + "'";
                            OracleCommand orlcmd = new OracleCommand(sql, con);
                            orlcmd.Parameters.Add("blobtodb", userName);
                            orlcmd.Parameters.Add("blobtodb", pwd);
                            orlcmd.Parameters.Add("blobtodb", img);
                            if (orlcmd.ExecuteNonQuery() > 0)
                            {
                                result = true;
                            }
                        }
                        else
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERID=:blobtodb,T_USERNAME=:blobtodb,T_PASSWD=:blobtodb,B_ATTACHMENT=:blobtodb where T_USERID='" + userIDO + "'";
                            OracleCommand orlcmd = new OracleCommand(sql, con);
                            orlcmd.Parameters.Add("blobtodb", userID);
                            orlcmd.Parameters.Add("blobtodb", userName);
                            orlcmd.Parameters.Add("blobtodb", pwd);
                            orlcmd.Parameters.Add("blobtodb", img);
                            result = SAC.DBOperations.DBoracle.RunNonQuery("update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';", out errMsg);
                            if (orlcmd.ExecuteNonQuery() > 0 && result == true)
                            {
                                result = true;
                            }
                        }
                        con.Close();
                    }
                    else
                    {
                        if (userIDO == userID)
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';";
                        }
                        else
                        {
                            sql += "update T_SYS_MEMBERINFO set T_USERID='" + userID + "',T_USERNAME='******',T_PASSWD='" + pwd + "' where T_USERID='" + userIDO + "';update T_SYS_MEMBERGRP set T_USERID='" + userID + "' where T_USERID='" + userIDO + "';";
                        }
                        result = dl.RunNonQuery(sql, out errMsg);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogHelper.EnLogType.Run, "发生时间:" + DateTime.Now.ToString("yyyy-MM-dd H:mm:ss") + "/n错误信息:" + ex.Message);
                }
            }
            return(result);
        }