/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.TT_OutLoadWeight GetModelByCache(string OutWeightCode, string TaxType, DateTime WeightTime) { TT_OutLoadWeight olw = new TT_OutLoadWeight(); olw.OutWeightCode = OutWeightCode; olw.TaxType = TaxType; olw.WeightTime = WeightTime; string CacheKey = "TT_OutLoadWeightModel-" + OutWeightCode + TaxType + WeightTime; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(olw); if (objModel != null) { int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache"); Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero); } } catch { } } return (TDTK.PlatForm.MVC4.Model.TT_OutLoadWeight)objModel; }
public Model.TT_OutLoadWeight DataRowToModel(DataRow row) { TDTK.PlatForm.MVC4.Model.TT_OutLoadWeight model = new TDTK.PlatForm.MVC4.Model.TT_OutLoadWeight(); if (row != null) { if (row["OutWeightCode"] != null) { model.OutWeightCode = row["OutWeightCode"].ToString(); } if (row["OTrafficCode"] != null) { model.OTrafficCode = row["OTrafficCode"].ToString(); } if (row["NavicertCode"] != null) { model.NavicertCode = row["NavicertCode"].ToString(); } if (row["CoalKindCode"] != null) { model.CoalKindCode = row["CoalKindCode"].ToString(); } if (row["CoalKindName"] != null) { model.CoalKindName = row["CoalKindName"].ToString(); } if (row["CarNo"] != null) { model.CarNo = row["CarNo"].ToString(); } if (row["CurrentWeight"] != null && row["CurrentWeight"].ToString() != "") { model.CurrentWeight = decimal.Parse(row["CurrentWeight"].ToString()); } if (row["ONetWeight"] != null && row["ONetWeight"].ToString() != "") { model.ONetWeight = decimal.Parse(row["ONetWeight"].ToString()); } if (row["OverWeight"] != null && row["OverWeight"].ToString() != "") { model.OverWeight = decimal.Parse(row["OverWeight"].ToString()); } if (row["TaxAmount"] != null && row["TaxAmount"].ToString() != "") { model.TaxAmount = decimal.Parse(row["TaxAmount"].ToString()); } if (row["FundAmount"] != null && row["FundAmount"].ToString() != "") { model.FundAmount = decimal.Parse(row["FundAmount"].ToString()); } if (row["TaxType"] != null) { model.TaxType = row["TaxType"].ToString(); } if (row["RandomCode"] != null) { model.RandomCode = row["RandomCode"].ToString(); } if (row["FrontImage"] != null) { model.FrontImage = row["FrontImage"].ToString(); } if (row["BackImage"] != null) { model.BackImage = row["BackImage"].ToString(); } if (row["UpImage"] != null) { model.UpImage = row["UpImage"].ToString(); } if (row["RoomImage"] != null) { model.RoomImage = row["RoomImage"].ToString(); } if (row["RoomCode"] != null) { model.RoomCode = row["RoomCode"].ToString(); } if (row["RoomName"] != null) { model.RoomName = row["RoomName"].ToString(); } if (row["Operator"] != null) { model.Operator = row["Operator"].ToString(); } if (row["WeightTime"] != null && row["WeightTime"].ToString() != "") { model.WeightTime = DateTime.Parse(row["WeightTime"].ToString()); } if (row["OutType"] != null) { model.OutType = row["OutType"].ToString(); } if (row["BangType"] != null) { model.BangType = row["BangType"].ToString(); } if (row["DiveLicense"] != null) { model.DiveLicense = row["DiveLicense"].ToString(); } if (row["CarDriverPhone"] != null) { model.CarDriverPhone = row["CarDriverPhone"].ToString(); } if (row["EmptyWeight"] != null && row["EmptyWeight"].ToString() != "") { model.EmptyWeight = decimal.Parse(row["EmptyWeight"].ToString()); } if (row["CarownerIDCard"] != null) { model.CarownerIDCard = row["CarownerIDCard"].ToString(); } if (row["CollName"] != null) { model.CollName = row["CollName"].ToString(); } if (row["IsNormal"] != null) { model.IsNormal = row["IsNormal"].ToString(); } if (row["SendUnits"] != null) { model.SendUnits = row["SendUnits"].ToString(); } if (row["ToUnits"] != null) { model.ToUnits = row["ToUnits"].ToString(); } if (row["BillWeight"] != null && row["BillWeight"].ToString() != "") { model.BillWeight = decimal.Parse(row["BillWeight"].ToString()); } if (row["CarNoImage"] != null) { model.CarNoImage = row["CarNoImage"].ToString(); } if (row["OutWeightImage"] != null) { model.OutWeightImage = row["OutWeightImage"].ToString(); } if (row["Customers"] != null) { model.Customers = row["Customers"].ToString(); } if (row["CarOwnerName"] != null) { model.CarOwnerName = row["CarOwnerName"].ToString(); } if (row["ExceptLeft"] != null && row["ExceptLeft"].ToString() != "") { model.ExceptLeft = DateTime.Parse(row["ExceptLeft"].ToString()); } if (row["CarType"] != null) { model.CarType = row["CarType"].ToString(); } } return model; }
public Model.TT_OutLoadWeight GetModel(Model.TT_OutLoadWeight t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 OutWeightCode,OTrafficCode,NavicertCode,CoalKindCode,CoalKindName,CarNo,CurrentWeight,ONetWeight,OverWeight,TaxAmount,FundAmount,TaxType,RandomCode,FrontImage,BackImage,UpImage,RoomImage,RoomCode,RoomName,Operator,WeightTime,OutType,BangType,DiveLicense,CarDriverPhone,EmptyWeight,CarownerIDCard,CollName,IsNormal,SendUnits,ToUnits,BillWeight,CarNoImage,OutWeightImage,Customers,CarOwnerName,ExceptLeft,CarType from TT_OutLoadWeight "); strSql.Append(" where OutWeightCode=@OutWeightCode and TaxType=@TaxType and WeightTime=@WeightTime "); SqlParameter[] parameters = { new SqlParameter("@OutWeightCode", SqlDbType.VarChar,20), new SqlParameter("@TaxType", SqlDbType.NVarChar,20), new SqlParameter("@WeightTime", SqlDbType.DateTime) }; parameters[0].Value = t.OutWeightCode; parameters[1].Value = t.TaxType; parameters[2].Value = t.WeightTime; TDTK.PlatForm.MVC4.Model.TT_OutLoadWeight model = new TDTK.PlatForm.MVC4.Model.TT_OutLoadWeight(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
public TT_OutLoadWeight GetModel(TT_OutLoadWeight t) { return dal.GetModel(t); }
public bool Delete(TT_OutLoadWeight t) { return dal.Delete(t); }
public bool Update(TT_OutLoadWeight t) { return dal.Update(t); }
public int Add(TT_OutLoadWeight t) { return dal.Add(t); }
public bool Exists(TT_OutLoadWeight t) { return dal.Exists(t); }