private VTrainman DrToVTrainmanBrief(DataRow dr, int Option)
        {
            VTrainman model = new VTrainman();

            model.strTrainmanGUID   = ObjectConvertClass.static_ext_string(dr["strTrainmanGUID"]);
            model.strTrainmanNumber = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber"]);
            model.strTrainmanName   = ObjectConvertClass.static_ext_string(dr["strTrainmanName"]);
            model.nID   = ObjectConvertClass.static_ext_int(dr["nID"]);
            model.strJP = ObjectConvertClass.static_ext_string(dr["strJP"]);
            if ((Option & 1) != 0)
            {
                if (dr.Table.Columns.Contains("FingerPrint1"))
                {
                    model.FingerPrint1 = ToBase64String(dr["FingerPrint1"]);
                }


                if (dr.Table.Columns.Contains("FingerPrint2"))
                {
                    model.FingerPrint2 = ToBase64String(dr["FingerPrint2"]);
                }
            }

            if ((Option & 2) != 0)
            {
                if (dr.Table.Columns.Contains("Picture"))
                {
                    model.Picture = ToBase64String(dr["Picture"]);
                }
            }

            return(model);
        }
Exemple #2
0
        public static void TrainmanFromDB(VTrainman model, DataRow dr, int Option)
        {
            model.strTrainmanNumber = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber"]);
            model.strTrainmanName   = ObjectConvertClass.static_ext_string(dr["strTrainmanName"]);
            model.strTelNumber      = ObjectConvertClass.static_ext_string(dr["strTelNumber"]);
            model.strRemark         = ObjectConvertClass.static_ext_string(dr["strRemark"]);
            model.nID          = ObjectConvertClass.static_ext_int(dr["nID"]);
            model.dtCreateTime = ObjectConvertClass.static_ext_date(dr["dtCreateTime"]);

            if (Option == 0)//都不要
            {
                model.FingerPrint1 = "";
                model.Picture      = "";
                model.FingerPrint2 = "";
            }
            else if (Option == 1)//只要指纹
            {
                model.FingerPrint1 = ToBase64String(dr["FingerPrint1"]);
                model.FingerPrint2 = ToBase64String(dr["FingerPrint2"]);
                model.Picture      = "";
            }
            else if (Option == 2)//要照片
            {
                model.Picture      = ToBase64String(dr["Picture"]);
                model.FingerPrint1 = "";
                model.FingerPrint2 = "";
            }
            else if (Option == 3)//都要
            {
                model.FingerPrint1 = ToBase64String(dr["FingerPrint1"]);
                model.FingerPrint2 = ToBase64String(dr["FingerPrint2"]);
                model.Picture      = ToBase64String(dr["Picture"]);
            }
            else
            {
                model.FingerPrint1 = "错误的类别";
                model.Picture      = "错误的类别";
                model.FingerPrint2 = "错误的类别";
            }
            model.nTrainmanState     = ObjectConvertClass.static_ext_int(dr["nTrainmanState"]);
            model.nPostID            = ObjectConvertClass.static_ext_int(dr["nPostID"]);
            model.strWorkShopGUID    = ObjectConvertClass.static_ext_string(dr["strWorkShopGUID"]);
            model.strGuideGroupGUID  = ObjectConvertClass.static_ext_string(dr["strGuideGroupGUID"]);
            model.strMobileNumber    = ObjectConvertClass.static_ext_string(dr["strMobileNumber"]);
            model.strAddress         = ObjectConvertClass.static_ext_string(dr["strAddress"]);
            model.strTrainmanGUID    = ObjectConvertClass.static_ext_string(dr["strTrainmanGUID"]);
            model.nDriverType        = ObjectConvertClass.static_ext_int(dr["nDriverType"]);
            model.bIsKey             = ObjectConvertClass.static_ext_int(dr["bIsKey"]);
            model.dtRuZhiTime        = ObjectConvertClass.static_ext_date(dr["dtRuZhiTime"]);
            model.dtJiuZhiTime       = ObjectConvertClass.static_ext_date(dr["dtJiuZhiTime"]);
            model.nDriverLevel       = ObjectConvertClass.static_ext_int(dr["nDriverLevel"]);
            model.strABCD            = ObjectConvertClass.static_ext_string(dr["strABCD"]);
            model.nKeHuoID           = ObjectConvertClass.static_ext_string(dr["nKeHuoID"]);
            model.strTrainJiaoluGUID = ObjectConvertClass.static_ext_string(dr["strTrainJiaoluGUID"]);
            model.dtLastEndWorkTime  = ObjectConvertClass.static_ext_date(dr["dtLastEndWorkTime"]);
            model.nDeleteState       = ObjectConvertClass.static_ext_int(dr["nDeleteState"]);
            model.strTrainJiaoluName = ObjectConvertClass.static_ext_string(dr["strTrainJiaoluName"]);
            model.strGuideGroupName  = ObjectConvertClass.static_ext_string(dr["strGuideGroupName"]);
            model.strWorkShopName    = ObjectConvertClass.static_ext_string(dr["strWorkShopName"]);
            model.strAreaName        = ObjectConvertClass.static_ext_string(dr["strAreaName"]);
            model.strJWDNumber       = ObjectConvertClass.static_ext_string(dr["strJWDNumber"]);
            model.strJP = ObjectConvertClass.static_ext_string(dr["strJP"]);
            model.strTrainmanJiaoluGUID = ObjectConvertClass.static_ext_string(dr["strTrainmanJiaoluGUID"]);
            model.strareaguid           = ObjectConvertClass.static_ext_string(dr["strareaguid"]);
            model.dtLastInRoomTime      = ObjectConvertClass.static_ext_date(dr["dtLastInRoomTime"]);
            model.dtLastOutRoomTime     = ObjectConvertClass.static_ext_date(dr["dtLastOutRoomTime"]);
        }
        private VTrainman DrToVTrainman(DataRow dr, int Option)
        {
            VTrainman model = new VTrainman();

            if (dr != null)
            {
                model.nID               = DBFieldToInt(dr, "nID");
                model.strTrainmanGUID   = ObjectConvertClass.static_ext_string(dr["strTrainmanGUID"]);
                model.strTrainmanNumber = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber"]);
                model.strTrainmanName   = ObjectConvertClass.static_ext_string(dr["strTrainmanName"]);
                model.strTelNumber      = DBFieldToString(dr, "strTelNumber");
                model.strRemark         = DBFieldToString(dr, "strRemark");

                model.dtCreateTime = DBFieldToTime(dr, "dtCreateTime");

                if ((Option & 1) != 0)
                {
                    if (dr.Table.Columns.Contains("FingerPrint1"))
                    {
                        model.FingerPrint1 = ToBase64String(dr["FingerPrint1"]);
                    }


                    if (dr.Table.Columns.Contains("FingerPrint2"))
                    {
                        model.FingerPrint2 = ToBase64String(dr["FingerPrint2"]);
                    }
                }

                if ((Option & 2) != 0)
                {
                    if (dr.Table.Columns.Contains("Picture"))
                    {
                        model.Picture = ToBase64String(dr["Picture"]);
                    }
                }


                //此三个字段,总是同时出现
                if (dr.Table.Columns.Contains("FG1ISNULL"))
                {
                    model.nFingerPrint1_Null = ObjectConvertClass.static_ext_int(dr["FG1ISNULL"]);
                    model.nFingerPrint2_Null = ObjectConvertClass.static_ext_int(dr["FG2ISNULL"]);
                    model.nPicture_Null      = ObjectConvertClass.static_ext_int(dr["PICISNULL"]);;
                }


                model.nTrainmanState     = DBFieldToInt(dr, "nTrainmanState");
                model.nPostID            = DBFieldToInt(dr, "nPostID");
                model.strWorkShopGUID    = DBFieldToString(dr, "strWorkShopGUID");
                model.strGuideGroupGUID  = DBFieldToString(dr, "strGuideGroupGUID");
                model.strMobileNumber    = DBFieldToString(dr, "strMobileNumber");
                model.strAddress         = DBFieldToString(dr, "strAddress");
                model.nDriverType        = DBFieldToInt(dr, "nDriverType");
                model.bIsKey             = DBFieldToInt(dr, "bIsKey");
                model.dtRuZhiTime        = DBFieldToTime(dr, "dtRuZhiTime");
                model.dtJiuZhiTime       = DBFieldToTime(dr, "dtJiuZhiTime");
                model.nDriverLevel       = DBFieldToInt(dr, "nDriverLevel");
                model.strABCD            = DBFieldToString(dr, "strABCD");
                model.nKeHuoID           = DBFieldToString(dr, "nKeHuoID");
                model.strTrainJiaoluGUID = DBFieldToString(dr, "strTrainJiaoluGUID");
                model.dtLastEndWorkTime  = DBFieldToTime(dr, "dtLastEndWorkTime");
                model.nDeleteState       = DBFieldToInt(dr, "nDeleteState");
                model.strTrainJiaoluName = DBFieldToString(dr, "strTrainJiaoluName");
                model.strGuideGroupName  = DBFieldToString(dr, "strGuideGroupName");
                model.strWorkShopName    = DBFieldToString(dr, "strWorkShopName");
                model.strAreaName        = DBFieldToString(dr, "strAreaName");
                model.strJWDNumber       = DBFieldToString(dr, "strJWDNumber");
                model.strJP = DBFieldToString(dr, "strJP");
                model.strTrainmanJiaoluGUID = DBFieldToString(dr, "strTrainmanJiaoluGUID");
                model.strareaguid           = DBFieldToString(dr, "strareaguid");
                model.dtLastInRoomTime      = DBFieldToTime(dr, "dtLastInRoomTime");
                model.dtLastOutRoomTime     = DBFieldToTime(dr, "dtLastOutRoomTime");
            }


            return(model);
        }