public com.jwsoft.pm.entpm.model.BillOfDocExtrDetail GetModel(int BillOfDocExtrDetailID) { StringBuilder builder = new StringBuilder(); builder.Append("select "); builder.Append(" BillOfDocExtrDetailID,BillOfDocExtrID,MaterialId,Scalar,UnitPrice,BillOfDocExtrType,ProjectId,TaskId,IsInfluence,MdResourceId "); builder.Append(" from pm_Repe_BillOfDocExtrDetail "); builder.Append(" where BillOfDocExtrDetailID=" + BillOfDocExtrDetailID + " "); com.jwsoft.pm.entpm.model.BillOfDocExtrDetail detail = new com.jwsoft.pm.entpm.model.BillOfDocExtrDetail(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["BillOfDocExtrDetailID"].ToString() != "") { detail.BillOfDocExtrDetailID = int.Parse(set.Tables[0].Rows[0]["BillOfDocExtrDetailID"].ToString()); } if (set.Tables[0].Rows[0]["BillOfDocExtrID"].ToString() != "") { detail.BillOfDocExtrID = int.Parse(set.Tables[0].Rows[0]["BillOfDocExtrID"].ToString()); } if (set.Tables[0].Rows[0]["MaterialId"].ToString() != "") { detail.MaterialId = int.Parse(set.Tables[0].Rows[0]["MaterialId"].ToString()); } if (set.Tables[0].Rows[0]["Scalar"].ToString() != "") { detail.Scalar = decimal.Parse(set.Tables[0].Rows[0]["Scalar"].ToString()); } if (set.Tables[0].Rows[0]["UnitPrice"].ToString() != "") { detail.UnitPrice = decimal.Parse(set.Tables[0].Rows[0]["UnitPrice"].ToString()); } detail.BillOfDocExtrType = set.Tables[0].Rows[0]["BillOfDocExtrType"].ToString(); if (set.Tables[0].Rows[0]["ProjectId"].ToString() != "") { detail.ProjectId = int.Parse(set.Tables[0].Rows[0]["ProjectId"].ToString()); } if (set.Tables[0].Rows[0]["TaskId"].ToString() != "") { detail.TaskId = int.Parse(set.Tables[0].Rows[0]["TaskId"].ToString()); } detail.IsInfluence = set.Tables[0].Rows[0]["IsInfluence"].ToString(); if (set.Tables[0].Rows[0]["MdResourceId"].ToString() != "") { detail.MdResourceId = int.Parse(set.Tables[0].Rows[0]["MdResourceId"].ToString()); } return(detail); }
public bool Add(com.jwsoft.pm.entpm.model.BillOfDocExtrDetail model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into pm_Repe_BillOfDocExtrDetail("); builder.Append("BillOfDocExtrID,MaterialId,Scalar,UnitPrice,BillOfDocExtrType,ProjectId,TaskId,IsInfluence,MdResourceId"); builder.Append(")"); builder.Append(" values ("); builder.Append(model.BillOfDocExtrID + ","); builder.Append(model.MaterialId + ","); builder.Append(model.Scalar + ","); builder.Append(model.UnitPrice + ","); builder.Append("'" + model.BillOfDocExtrType + "',"); builder.Append(model.ProjectId + ","); builder.Append(model.TaskId + ","); builder.Append("'" + model.IsInfluence + "',"); builder.Append(model.MdResourceId); builder.Append(")"); return(publicDbOpClass.NonQuerySqlString(builder.ToString())); }
public bool Update(com.jwsoft.pm.entpm.model.BillOfDocExtrDetail model) { StringBuilder builder = new StringBuilder(); builder.Append("update pm_Repe_BillOfDocExtrDetail set "); builder.Append("BillOfDocExtrID=" + model.BillOfDocExtrID + ","); builder.Append("MaterialId=" + model.MaterialId + ","); builder.Append("Scalar=" + model.Scalar + ","); builder.Append("UnitPrice=" + model.UnitPrice + ","); if (model.ProjectId != 0) { builder.Append("ProjectId=" + model.ProjectId + ","); } if (model.ProjectId != 0) { builder.Append("TaskId=" + model.TaskId + ","); } builder.Append("IsInfluence='" + model.IsInfluence + "',"); builder.Append("MdResourceId=" + model.MdResourceId + ","); builder.Append("BillOfDocExtrType='" + model.BillOfDocExtrType + "'"); builder.Append(" where BillOfDocExtrDetailID=" + model.BillOfDocExtrDetailID + " "); return(publicDbOpClass.NonQuerySqlString(builder.ToString())); }