public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } SheepStatusEnum gender = (SheepStatusEnum)value; return(((int)gender).ToString()); }
public void UpdateSheep(string breedId, GenderEnum gender, GrowthStageEnum growthStage, OriginEnum origin, float?birthWeight, int compatriotNumber, DateTime?birthDay, float?ablactationWeight, DateTime?ablactationDate, string fatherId, string motherId, string sheepfoldId, SheepStatusEnum sheepStatusEnum, string principalId, string remark, string id) { string sql = "update \"T_Sheep\" set \"BreedId\"=:breedId,\"Gender\"=:gender,\"GrowthStage\"=:growthStage,\"SheepfoldId\"=:sheepfoldId,\"BirthWeight\"=:birthWeight,\"CompatriotNumber\"=:compatriotNumber,\"Birthday\"=:birthday,\"Origin\"=:origin, \"AblactationWeight\"=:ablactationWeight,\"AblactationDate\"=:ablactationDate,\"FatherId\"=:fatherId,\"MotherId\"=:motherId,\"Status\"=:status,\"PrincipalId\"=:principalId,\"Remark\"=:remark where \"Id\"=:id"; IDbParameters pms = AdoTemplate.CreateDbParameters(); pms.AddWithValue("breedId", breedId); pms.AddWithValue("gender", (int)gender); pms.AddWithValue("growthStage", (int)growthStage); pms.AddWithValue("sheepfoldId", sheepfoldId); pms.AddWithValue("birthWeight", birthWeight); pms.AddWithValue("compatriotNumber", compatriotNumber); pms.AddWithValue("birthday", birthDay); pms.AddWithValue("origin", (int)origin); pms.AddWithValue("ablactationWeight", ablactationWeight); pms.AddWithValue("ablactationDate", ablactationDate); pms.AddWithValue("fatherId", fatherId); pms.AddWithValue("motherId", motherId); pms.AddWithValue("status", (int)sheepStatusEnum); pms.AddWithValue("principalId", principalId); pms.AddWithValue("remark", remark); pms.AddWithValue("id", id); AdoTemplate.ExecuteNonQuery(CommandType.Text, sql, pms); }
public void AddSheep(string id, string serialNumber, string breedId, GenderEnum gender, GrowthStageEnum growthStage, OriginEnum origin, float?birthWeight, int compatriotNumber, DateTime?birthDay, string fatherId, string motherId, string sheepfoldId, SheepStatusEnum sheepStatusEnum, string principalId, string operatorId, DateTime createTime, string remark, string buySource, decimal buyMoney, float?buyWeight, DateTime buyOperationDate, string buyPrincipalId, string buyRemark) { string sql = "INSERT into \"T_Sheep\" (\"Id\",\"SerialNumber\",\"BreedId\",\"Gender\",\"GrowthStage\",\"SheepfoldId\",\"BirthWeight\",\"CompatriotNumber\",\"Birthday\",\"Origin\",\"FatherId\",\"MotherId\",\"Status\",\"PrincipalId\",\"OperatorId\",\"CreateTime\",\"Remark\")VALUES(:id,:serialNumber,:breedId,:gender,:growthStage,:sheepfoldId,:birthWeight,:compatriotNumber,:birthday,:origin,:fatherId,:motherId,:status,:principalId,:operaterId,:createTime,:remark);INSERT into \"T_BuySheep\" (\"ExpenditureId\",\"SheepId\",\"Source\",\"Weight\")VALUES(:expenditureId,:sheepId,:source,:buyWeight);INSERT into \"T_Expenditure\" (\"Id\",\"Money\",\"OperationDate\",\"PrincipalId\",\"OperatorId\",\"CreateTime\",\"Remark\")VALUES(:exId,:money,:buyOperationDate,:buyPrincipalId,:buyOperatorId,:buyCreateTime,:buyRemark)"; IDbParameters pms = AdoTemplate.CreateDbParameters(); pms.AddWithValue("id", id); pms.AddWithValue("serialNumber", serialNumber); pms.AddWithValue("breedId", breedId); pms.AddWithValue("gender", (int)gender); pms.AddWithValue("growthStage", (int)growthStage); pms.AddWithValue("sheepfoldId", sheepfoldId); pms.AddWithValue("birthWeight", birthWeight); pms.AddWithValue("compatriotNumber", compatriotNumber); pms.AddWithValue("birthday", birthDay); pms.AddWithValue("origin", (int)origin); pms.AddWithValue("fatherId", fatherId); pms.AddWithValue("motherId", motherId); pms.AddWithValue("status", (int)sheepStatusEnum); pms.AddWithValue("principalId", principalId); pms.AddWithValue("operaterId", operatorId); pms.AddWithValue("createTime", createTime); pms.AddWithValue("remark", remark); string expenditureId = Guid.NewGuid().ToString(); pms.AddWithValue("expenditureId", expenditureId); pms.AddWithValue("sheepId", id); pms.AddWithValue("source", buySource); pms.AddWithValue("buyWeight", buyWeight); pms.AddWithValue("exId", expenditureId); pms.AddWithValue("money", buyMoney); pms.AddWithValue("buyOperationDate", buyOperationDate); pms.AddWithValue("buyPrincipalId", buyPrincipalId); pms.AddWithValue("buyOperatorId", operatorId); pms.AddWithValue("buyCreateTime", createTime); pms.AddWithValue("buyRemark", buyRemark); AdoTemplate.ExecuteNonQuery(CommandType.Text, sql, pms); }