Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DTcms.Model.InvoicedRecord GetModel(int Id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select Id, ReceivedMoneyId, StoreInOrderId, CustomerId, Remark, CreateTime, Admin, Price  ");
            strSql.Append("  from InvoicedRecord ");
            strSql.Append(" where Id=@Id");
                        SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            DTcms.Model.InvoicedRecord model=new DTcms.Model.InvoicedRecord();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);

            if(ds.Tables[0].Rows.Count>0)
            {
                                                if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
                {
                    model.Id=int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                                                                                                                                if(ds.Tables[0].Rows[0]["ReceivedMoneyId"].ToString()!="")
                {
                    model.ReceivedMoneyId=int.Parse(ds.Tables[0].Rows[0]["ReceivedMoneyId"].ToString());
                }
                                                                                                                                if(ds.Tables[0].Rows[0]["StoreInOrderId"].ToString()!="")
                {
                    model.StoreInOrderId=int.Parse(ds.Tables[0].Rows[0]["StoreInOrderId"].ToString());
                }
                                                                                                                                if(ds.Tables[0].Rows[0]["CustomerId"].ToString()!="")
                {
                    model.CustomerId=int.Parse(ds.Tables[0].Rows[0]["CustomerId"].ToString());
                }
                                                                                                                                                model.Remark= ds.Tables[0].Rows[0]["Remark"].ToString();
                                                                                                                if(ds.Tables[0].Rows[0]["CreateTime"].ToString()!="")
                {
                    model.CreateTime=DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                                                                                                                                                model.Admin= ds.Tables[0].Rows[0]["Admin"].ToString();
                                                                                                                if(ds.Tables[0].Rows[0]["Price"].ToString()!="")
                {
                    model.Price=decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString());
                }

                return model;
            }
            else
            {
                return null;
            }
        }