public List<LabMS.Model.SuppliesRecipients> ExtendGetModuleList(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select s.[ID],EncodedWarehouse,Numbers,[Name],Words,Arrow,QuantityRecipients,"+ "Recipients,Laboratory,EncodedTime,UnitPrice,TotalAmount,Comment,Operator,"+ "OperatDate, Teacher_Name, l.Location_Name as lname1, l2.Lab_Name as lname2"); strSql.Append(" FROM SuppliesRecipients s, Teacher t, Location l, Lab l2 "); strSql.Append(" where s.Recipients = t.Teacher_Code and l.ID = s.EncodedWarehouse and"+ " l2.Lab_Code = s.Laboratory"); if (strWhere.Trim() != "") { strSql.Append(" and " + strWhere); } DataSet ds = DbHelperSQL.Query(strSql.ToString()); List<LabMS.Model.SuppliesRecipients> modelList = new List<LabMS.Model.SuppliesRecipients>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { LabMS.Model.SuppliesRecipients model; for (int n = 0; n < rowsCount; n++) { model = new LabMS.Model.SuppliesRecipients(); model.ID= long.Parse(ds.Tables[0].Rows[n]["ID"].ToString()); model.EncodedWarehouse = ds.Tables[0].Rows[n]["lname1"].ToString(); model.Numbers = ds.Tables[0].Rows[n]["Numbers"].ToString(); model.Name = ds.Tables[0].Rows[n]["Name"].ToString(); model.Words = ds.Tables[0].Rows[n]["Words"].ToString(); model.Arrow = ds.Tables[0].Rows[n]["Arrow"].ToString(); model.QuantityRecipients = ds.Tables[0].Rows[n]["QuantityRecipients"].ToString(); model.Recipients = ds.Tables[0].Rows[n]["Teacher_Name"].ToString(); model.Laboratory = ds.Tables[0].Rows[n]["lname2"].ToString(); if (ds.Tables[0].Rows[n]["EncodedTime"].ToString() != "") { model.EncodedTime = DateTime.Parse(ds.Tables[0].Rows[n]["EncodedTime"].ToString()); } model.UnitPrice = ds.Tables[0].Rows[n]["UnitPrice"].ToString(); model.TotalAmount = ds.Tables[0].Rows[n]["TotalAmount"].ToString(); model.Comment = ds.Tables[0].Rows[n]["Comment"].ToString(); model.Operator = ds.Tables[0].Rows[n]["Operator"].ToString(); if (ds.Tables[0].Rows[n]["OperatDate"].ToString() != "") { model.OperatDate = DateTime.Parse(ds.Tables[0].Rows[n]["OperatDate"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// ��������б� /// </summary> public List<LabMS.Model.SuppliesRecipients> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<LabMS.Model.SuppliesRecipients> modelList = new List<LabMS.Model.SuppliesRecipients>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { LabMS.Model.SuppliesRecipients model; for (int n = 0; n < rowsCount; n++) { model = new LabMS.Model.SuppliesRecipients(); //model.ID=ds.Tables[0].Rows[n]["ID"].ToString(); model.EncodedWarehouse=ds.Tables[0].Rows[n]["EncodedWarehouse"].ToString(); model.Numbers=ds.Tables[0].Rows[n]["Numbers"].ToString(); model.Name=ds.Tables[0].Rows[n]["Name"].ToString(); model.Words=ds.Tables[0].Rows[n]["Words"].ToString(); model.Arrow=ds.Tables[0].Rows[n]["Arrow"].ToString(); model.QuantityRecipients=ds.Tables[0].Rows[n]["QuantityRecipients"].ToString(); model.Recipients=ds.Tables[0].Rows[n]["Recipients"].ToString(); model.Laboratory=ds.Tables[0].Rows[n]["Laboratory"].ToString(); if(ds.Tables[0].Rows[n]["EncodedTime"].ToString()!="") { model.EncodedTime=DateTime.Parse(ds.Tables[0].Rows[n]["EncodedTime"].ToString()); } model.UnitPrice=ds.Tables[0].Rows[n]["UnitPrice"].ToString(); model.TotalAmount=ds.Tables[0].Rows[n]["TotalAmount"].ToString(); model.Comment=ds.Tables[0].Rows[n]["Comment"].ToString(); model.Operator=ds.Tables[0].Rows[n]["Operator"].ToString(); if(ds.Tables[0].Rows[n]["OperatDate"].ToString()!="") { model.OperatDate=DateTime.Parse(ds.Tables[0].Rows[n]["OperatDate"].ToString()); } modelList.Add(model); } } return modelList; }