Beispiel #1
0
        public static int InsertUserAptitude(UserAptitude Uap, byte[] fileByte, ref string a_strErr)
        {
            int intInsert = 0;

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@fileByte", fileByte)
            };
            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            //string strInsert = GSqlSentence.GetInsertInfoByD<UserAptitude>(Uaptitude, "tk_UserAptitude");
            string strInsert = "insert into tk_UserAptitude (UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,"
                               + "CertificateUnit,LastCertificatDate,CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate) values ("
                               + "'" + Uap.StrUserID + "','" + Uap.StrUserName + "','" + Uap.StrBusinessType + "','" + Uap.StrTecoName + "','" + Uap.StrTecoClass + "','" + Uap.StrGetTime + "',"
                               + "'" + Uap.StrCertificatCode + "','" + Uap.StrCertificateName + "','" + Uap.StrCertificateUnit + "','" + Uap.StrLastCertificatDate + "','" + Uap.StrCertificatDate + "',"
                               + "'" + Uap.StrFileName + "',@fileByte,'" + Uap.StrRemark + "','" + Uap.StrUnit + "','" + Uap.StrState + "','" + Uap.StrCreateTime + "','" + Uap.StrCreateUser + "','" + Uap.StrValidate + "')";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, para);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Beispiel #2
0
        public static int UpdateUserAptitude(string ID, UserAptitude Uap, byte[] fileByte, ref string a_strErr)
        {
            int intInsert    = 0;
            int intUpdate    = 0;
            int intInsertHis = 0;

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@fileByte", fileByte)
            };
            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsertHis = "insert into tk_UserAptitudeHis (UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,CertificateUnit,"
                                  + "LastCertificatDate,CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate"
                                  + ") select UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,CertificateUnit,LastCertificatDate,"
                                  + "CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate from tk_UserAptitude where ID = '" + ID + "'";

            string strInsert = "update tk_UserAptitude set BusinessType = '" + Uap.StrBusinessType + "',TecoName = '" + Uap.StrTecoName + "',TecoClass = '" + Uap.StrTecoClass + "',"
                               + "GetTime = '" + Uap.StrGetTime + "',CertificatCode = '" + Uap.StrCertificatCode + "',CertificateName = '" + Uap.StrCertificateName + "',CertificateUnit = '" + Uap.StrCertificateUnit + "',"
                               + "LastCertificatDate = '" + Uap.StrLastCertificatDate + "',CertificatDate = '" + Uap.StrCertificatDate + "',Remark = '" + Uap.StrRemark + "' where ID = '" + ID + "'";

            string strUpdate = "";

            if (Uap.StrFileName != null)
            {
                strUpdate = "update tk_UserAptitude set FileName = '" + Uap.StrFileName + "',FileInfo = @fileByte where ID = '" + ID + "'";
            }

            try
            {
                if (strInsertHis != "")
                {
                    intInsertHis = sqlTrans.ExecuteNonQuery(strInsertHis, CommandType.Text, null);
                }
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, para);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Beispiel #3
0
 public static bool UpdateNewUserAptitude(string ID, UserAptitude Uap, byte[] fileByte, ref string a_strErr)
 {
     if (UserAptitudePro.UpdateUserAptitude(ID, Uap, fileByte, ref a_strErr) >= 1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #4
0
 public static bool InsertNewUserAptitude(UserAptitude Uaptitude, byte[] fileByte, ref string a_strErr)
 {
     if (UserAptitudePro.InsertUserAptitude(Uaptitude, fileByte, ref a_strErr) >= 1)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #5
0
        public static UserAptitude getUpdateUserAptitude(string id)
        {
            UserAptitude Uap    = new UserAptitude();
            string       strSql = "select * from tk_UserAptitude where ID = '" + id + "'";
            DataTable    dt     = SQLBase.FillTable(strSql, "SupplyCnn");

            if (dt.Rows.Count > 0)
            {
                Uap.StrUserID             = dt.Rows[0]["UserID"].ToString();
                Uap.StrUserName           = dt.Rows[0]["UserName"].ToString();
                Uap.StrBusinessType       = dt.Rows[0]["BusinessType"].ToString();
                Uap.StrTecoName           = dt.Rows[0]["TecoName"].ToString();
                Uap.StrTecoClass          = dt.Rows[0]["TecoClass"].ToString();
                Uap.StrGetTime            = Convert.ToDateTime(dt.Rows[0]["GetTime"]).ToString("yyyy-MM-dd");
                Uap.StrCertificatCode     = dt.Rows[0]["CertificatCode"].ToString();
                Uap.StrCertificateName    = dt.Rows[0]["CertificateName"].ToString();
                Uap.StrCertificateUnit    = dt.Rows[0]["CertificateUnit"].ToString();
                Uap.StrLastCertificatDate = Convert.ToDateTime(dt.Rows[0]["LastCertificatDate"]).ToString("yyyy-MM-dd");
                Uap.StrCertificatDate     = Convert.ToDateTime(dt.Rows[0]["CertificatDate"]).ToString("yyyy-MM-dd");
                Uap.StrFileName           = dt.Rows[0]["FileName"].ToString();
                Uap.StrRemark             = dt.Rows[0]["Remark"].ToString();
            }
            return(Uap);
        }