Esempio n. 1
0
        public LCOutput Get(string data)
        {
            outPut.Clear();
            try
            {
                KMQueryQC queryQC = Newtonsoft.Json.JsonConvert.DeserializeObject <KMQueryQC>(data);

                outPut.data = new DBKeyMan().Get(queryQC);
            }
            catch (Exception ex)
            {
                outPut.result    = 1;
                outPut.resultStr = ex.Message.ToString();
            }


            return(outPut);
        }
Esempio n. 2
0
 public List <KeyMan> GetHistory(KMQueryQC queryQC)
 {
     return(InnerGet(queryQC, "tab_keyTrainman_His"));
 }
Esempio n. 3
0
        private List <KeyMan> InnerGet(KMQueryQC queryQC, string TableName)
        {
            List <KeyMan> ret = new List <KeyMan>();
            string        sql = "select * from " + TableName + " where 1=1 ";

            if (!string.IsNullOrEmpty(queryQC.WorkShopGUID))
            {
                sql += " and strWorkShopGUID = @strWorkShopGUID";
            }

            if (!string.IsNullOrEmpty(queryQC.CheDuiGUID))
            {
                sql += " and strCheJianGUID = @strCheJianGUID";
            }


            if (!string.IsNullOrEmpty(queryQC.KeyTMNumber))
            {
                sql += " and strTrainmanNumber = @strTrainmanNumber";
            }

            if (!string.IsNullOrEmpty(queryQC.KeyTMName))
            {
                sql += " and strTrainmanName = @strTrainmanName";
            }


            if (queryQC.RegisterEndTime != null)
            {
                sql += " and dtRegisterTime >= @dtRegisterStartTime";
            }


            if (queryQC.RegisterStartTime != null)
            {
                sql += " and dtRegisterTime <= @dtRegisterEndTime";
            }

            sql += " order by dtRegisterTime desc,eOpt desc";

            DbParamDict dbParamDict = new DbParamDict();

            dbParamDict.Add("strWorkShopGUID", queryQC.WorkShopGUID, ParamDataType.dtString);
            dbParamDict.Add("strCheJianGUID", queryQC.CheDuiGUID, ParamDataType.dtString);
            dbParamDict.Add("strTrainmanNumber", queryQC.KeyTMNumber, ParamDataType.dtString);
            dbParamDict.Add("strTrainmanName", queryQC.KeyTMName, ParamDataType.dtString);
            dbParamDict.Add("dtRegisterStartTime", queryQC.RegisterStartTime, ParamDataType.dtDateTime);
            dbParamDict.Add("dtRegisterEndTime", queryQC.RegisterEndTime, ParamDataType.dtDateTime);

            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, sql, dbParamDict.GetParams()).Tables[0];

            KeyMan keyman;

            foreach (DataRow dr in dt.Rows)
            {
                keyman = new KeyMan();

                keyman.ID = ObjectConvertClass.static_ext_string(dr["strGUID"]);
                keyman.KeyAnnouncements  = ObjectConvertClass.static_ext_string(dr["strAnnouncements"]);
                keyman.KeyEndTime        = ObjectConvertClass.static_ext_date(dr["dtEndTime"]);
                keyman.KeyReason         = ObjectConvertClass.static_ext_string(dr["strReason"]);
                keyman.KeyStartTime      = ObjectConvertClass.static_ext_date(dr["dtStartTime"]);
                keyman.KeyTMCheDuiGUID   = ObjectConvertClass.static_ext_string(dr["strCheJianGUID"]);
                keyman.KeyTMCheDuiName   = ObjectConvertClass.static_ext_string(dr["strCheJianName"]);
                keyman.KeyTMName         = ObjectConvertClass.static_ext_string(dr["strTrainmanName"]);
                keyman.KeyTMNumber       = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber"]);
                keyman.KeyTMWorkShopGUID = ObjectConvertClass.static_ext_string(dr["strWorkShopGUID"]);
                keyman.KeyTMWorkShopName = ObjectConvertClass.static_ext_string(dr["strWorkShopName"]);
                keyman.RegisterName      = ObjectConvertClass.static_ext_string(dr["strRegisterName"]);
                keyman.RegisterNumber    = ObjectConvertClass.static_ext_string(dr["strRegisterNumber"]);
                keyman.RegisterTime      = ObjectConvertClass.static_ext_date(dr["dtRegisterTime"]);
                keyman.ClientNumber      = ObjectConvertClass.static_ext_string(dr["strClientNumber"]);
                keyman.ClientName        = ObjectConvertClass.static_ext_string(dr["strClientName"]);
                keyman.eOpt = ObjectConvertClass.static_ext_int(dr["eOpt"]);

                ret.Add(keyman);
            }


            return(ret);
        }