Beispiel #1
0
        public bool UpdateTrainman(Trainman model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update TAB_Org_Trainman set ");
            strSql.Append(" strTrainmanNumber = @strTrainmanNumber, ");
            strSql.Append(" strTrainmanName = @strTrainmanName, ");
            strSql.Append(" nPostID = @nPostID, ");
            strSql.Append(" strTelNumber = @strTelNumber, ");
            strSql.Append(" strMobileNumber = @strMobileNumber, ");
            strSql.Append(" strAddress = @strAddress, ");
            strSql.Append(" nDriverType = @nDriverType, ");
            strSql.Append(" bIsKey = @bIsKey, ");
            strSql.Append(" dtRuZhiTime = @dtRuZhiTime, ");
            strSql.Append(" dtJiuZhiTime = @dtJiuZhiTime, ");
            strSql.Append(" nDriverLevel = @nDriverLevel, ");
            strSql.Append(" strABCD = @strABCD, ");
            strSql.Append(" strRemark = @strRemark, ");
            strSql.Append(" nKeHuoID = @nKeHuoID, ");

            if (model.FingerPrint1 != null && !string.IsNullOrEmpty(Convert.ToString(model.FingerPrint1)))
            {
                strSql.Append(" FingerPrint1 = @FingerPrint1, ");
            }

            if (model.FingerPrint2 != null && !string.IsNullOrEmpty(Convert.ToString(model.FingerPrint2)))
            {
                strSql.Append(" FingerPrint2 = @FingerPrint2, ");
            }

            if (model.Picture != null && !string.IsNullOrEmpty(Convert.ToString(model.Picture)))
            {
                strSql.Append(" Picture = @Picture, ");
            }

            strSql.Append(" strJP = @strJP ");


            strSql.Append(" where strTrainmanGUID = @strTrainmanGUID ");


            SqlParameter[] parameters =
            {
                new SqlParameter("@strTrainmanGUID",   model.strTrainmanGUID),
                new SqlParameter("@strTrainmanNumber", model.strTrainmanNumber),
                new SqlParameter("@strTrainmanName",   model.strTrainmanName),
                new SqlParameter("@nPostID",           model.nPostID),
                new SqlParameter("@FingerPrint1",      ConvertBase64ToByte(model.FingerPrint1)),
                new SqlParameter("@FingerPrint2",      ConvertBase64ToByte(model.FingerPrint2)),
                new SqlParameter("@Picture",           ConvertBase64ToByte(model.Picture)),
                new SqlParameter("@strTelNumber",      model.strTelNumber),
                new SqlParameter("@strMobileNumber",   model.strMobileNumber),
                new SqlParameter("@strAddress",        model.strAddress),
                new SqlParameter("@nDriverType",       model.nDriverType),
                new SqlParameter("@bIsKey",            model.bIsKey),
                new SqlParameter("@dtRuZhiTime",       model.dtRuZhiTime),
                new SqlParameter("@dtJiuZhiTime",      model.dtJiuZhiTime),
                new SqlParameter("@nDriverLevel",      model.nDriverLevel),
                new SqlParameter("@strABCD",           model.strABCD),
                new SqlParameter("@strRemark",         model.strRemark),
                new SqlParameter("@nKeHuoID",          model.nKeHuoID),
                new SqlParameter("@strJP",             model.strJP)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters) > 0);
        }
Beispiel #2
0
        public int UpdateFingerAndPic(Trainman model, out bool updateFingerPrint, out bool updatePicture)
        {
            updateFingerPrint = false;
            updatePicture     = false;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update TAB_Org_Trainman set ");
            string strValue = string.Empty;

            if (model == null)
            {
                return(2);
            }
            strValue = "";

            if ((model.FingerPrint1 != null) && ((string)model.FingerPrint1 != string.Empty))
            {
                strValue          += " FingerPrint1 = @FingerPrint1 ";
                model.FingerPrint1 = ConvertBase64ToByte(model.FingerPrint1);
                updateFingerPrint  = true;
            }
            if ((model.FingerPrint2 != null) && ((string)model.FingerPrint2 != string.Empty))
            {
                if (strValue != "")
                {
                    strValue += " , FingerPrint2 = @FingerPrint2";
                }
                else
                {
                    strValue += " FingerPrint2 = @FingerPrint2";
                }
                model.FingerPrint2 = ConvertBase64ToByte(model.FingerPrint2.ToString());
                updateFingerPrint  = true;
            }

            if ((model.Picture != null) && ((string)model.Picture != string.Empty))
            {
                if (strValue != "")
                {
                    strValue += " , Picture = @Picture ";
                }
                else
                {
                    strValue += "  Picture = @Picture ";
                }

                model.Picture = ConvertBase64ToByte(model.Picture.ToString());
                updatePicture = true;
            }



            if (string.IsNullOrEmpty(strValue))
            {
                return(3);
            }


            strSql.Append(strValue);
            strSql.Append(" where strTrainmanGUID = @strTrainmanGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strTrainmanGUID", model.strTrainmanGUID),
                new SqlParameter("@FingerPrint1",    model.FingerPrint1),
                new SqlParameter("@FingerPrint2",    model.FingerPrint2),
                new SqlParameter("@Picture",         model.Picture)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters));
        }
Beispiel #3
0
        public bool AddTrainman(Trainman model)
        {
            string strFingerPrintAndPicture  = "";
            string strFingerPrintAndPicture1 = "";

            if (!string.IsNullOrEmpty(model.FingerPrint1.ToString()))
            {
                strFingerPrintAndPicture  += "FingerPrint1,";
                strFingerPrintAndPicture1 += "@FingerPrint1,";
                model.FingerPrint1         = ConvertBase64ToByte(model.FingerPrint1);
            }
            if (!string.IsNullOrEmpty(model.FingerPrint2.ToString()))
            {
                strFingerPrintAndPicture  += "FingerPrint2,";
                strFingerPrintAndPicture1 += "@FingerPrint2,";
                model.FingerPrint2         = ConvertBase64ToByte(model.FingerPrint2.ToString());
            }
            if (!string.IsNullOrEmpty(model.Picture.ToString()))
            {
                strFingerPrintAndPicture  += "Picture,";
                strFingerPrintAndPicture1 += "@Picture,";
                model.Picture              = ConvertBase64ToByte(model.Picture.ToString());
            }


            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TAB_Org_Trainman");
            strSql.Append("(strTrainmanGUID,strTrainmanNumber,strTrainmanName,nPostID,strWorkShopGUID," + strFingerPrintAndPicture + "strGuideGroupGUID,strTelNumber,strMobileNumber,strAddress,nDriverType,bIsKey,dtRuZhiTime,dtJiuZhiTime,nDriverLevel,strABCD,strRemark,nKeHuoID,strTrainJiaoluGUID,dtCreateTime,nTrainmanState,strJP,strTrainmanJiaoluGUID,strareaguid,dtLastEndworkTime)");
            strSql.Append("values(@strTrainmanGUID,@strTrainmanNumber,@strTrainmanName,@nPostID,@strWorkShopGUID," + strFingerPrintAndPicture1 + "@strGuideGroupGUID,@strTelNumber,@strMobileNumber,@strAddress,@nDriverType,@bIsKey,@dtRuZhiTime,@dtJiuZhiTime,@nDriverLevel,@strABCD,@strRemark,@nKeHuoID,@strTrainJiaoluGUID,@dtCreateTime,@nTrainmanState,@strJP,@strTrainmanJiaoluGUID,@strareaguid,@dtLastEndworkTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strTrainmanGUID",       model.strTrainmanGUID),
                new SqlParameter("@strTrainmanNumber",     model.strTrainmanNumber),
                new SqlParameter("@strTrainmanName",       model.strTrainmanName),
                new SqlParameter("@nPostID",               model.nPostID),
                new SqlParameter("@strWorkShopGUID",       model.strWorkShopGUID),
                new SqlParameter("@FingerPrint1",          model.FingerPrint1),
                new SqlParameter("@FingerPrint2",          model.FingerPrint2),
                new SqlParameter("@Picture",               model.Picture),
                new SqlParameter("@strGuideGroupGUID",     model.strGuideGroupGUID),
                new SqlParameter("@strTelNumber",          model.strTelNumber),
                new SqlParameter("@strMobileNumber",       model.strMobileNumber),
                new SqlParameter("@strAddress",            model.strAddress),
                new SqlParameter("@nDriverType",           model.nDriverType),
                new SqlParameter("@bIsKey",                model.bIsKey),
                new SqlParameter("@dtRuZhiTime",           model.dtRuZhiTime),
                new SqlParameter("@dtJiuZhiTime",          model.dtJiuZhiTime),
                new SqlParameter("@nDriverLevel",          model.nDriverLevel),
                new SqlParameter("@strABCD",               model.strABCD),
                new SqlParameter("@strRemark",             model.strRemark),
                new SqlParameter("@nKeHuoID",              model.nKeHuoID),
                new SqlParameter("@strTrainJiaoluGUID",    model.strTrainJiaoluGUID),
                new SqlParameter("@dtCreateTime",          model.dtCreateTime),
                new SqlParameter("@nTrainmanState",                                  7),
                new SqlParameter("@strJP",                 model.strJP),
                new SqlParameter("@strTrainmanJiaoluGUID", model.strTrainmanJiaoluGUID),
                new SqlParameter("@strareaguid",           model.strareaguid),
                new SqlParameter("@dtLastEndworkTime",     model.dtLastEndWorkTime)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters) > 0);
        }