Example #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.vm_PCdetails GetModel(int id)
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 m_UserName,m_NickName,m_RealName,sku_ModifyBy,p_ID,sku_Price,sku_CostPrice,sku_Stock,sku_SalesCount,sku_Code,sku_CreatedOn,sku_CreatedBy,sku_ModifyOn,sku_StatusCode,sku_IsDel,p_Name,p_Sort,p_MeasurementUnit,p_Province,p_City,p_County,p_CreatedOn,p_ModifyOn,p_CreatedBy,p_ModifyBy,p_StatusCode,p_IsDel,p_SellStatus,ct_ID,pt_ID,m_Password,m_UserType,m_YingYZZ,m_Score,m_Rank,m_Sex,m_Birthday,m_Phone,m_Email,m_QQ,m_CreatedOn,m_ZheK,m_StatusCode,m_ShenPstatus,pc_ID,sku_ID,pc_CreatedOn,pc_Type,pc_Content,pc_CreatedBy,pc_StatusCode,pc_huifu,pc_IsDel from vm_PCdetails ");
            strSql.Append(" where pc_id="+id);
            SqlParameter[] parameters = {
            };

            webs_YueyxShop.Model.vm_PCdetails model=new webs_YueyxShop.Model.vm_PCdetails();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.vm_PCdetails DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.vm_PCdetails model=new webs_YueyxShop.Model.vm_PCdetails();
     if (row != null)
     {
         if(row["m_UserName"]!=null)
         {
             model.m_UserName=row["m_UserName"].ToString();
         }
         if(row["m_NickName"]!=null)
         {
             model.m_NickName=row["m_NickName"].ToString();
         }
         if(row["m_RealName"]!=null)
         {
             model.m_RealName=row["m_RealName"].ToString();
         }
         if(row["sku_ModifyBy"]!=null && row["sku_ModifyBy"].ToString()!="")
         {
             model.sku_ModifyBy= new Guid(row["sku_ModifyBy"].ToString());
         }
         if(row["p_ID"]!=null && row["p_ID"].ToString()!="")
         {
             model.p_ID=int.Parse(row["p_ID"].ToString());
         }
         if(row["sku_Price"]!=null && row["sku_Price"].ToString()!="")
         {
             model.sku_Price=decimal.Parse(row["sku_Price"].ToString());
         }
         if(row["sku_CostPrice"]!=null && row["sku_CostPrice"].ToString()!="")
         {
             model.sku_CostPrice=decimal.Parse(row["sku_CostPrice"].ToString());
         }
         if(row["sku_Stock"]!=null && row["sku_Stock"].ToString()!="")
         {
             model.sku_Stock=int.Parse(row["sku_Stock"].ToString());
         }
         if(row["sku_SalesCount"]!=null && row["sku_SalesCount"].ToString()!="")
         {
             model.sku_SalesCount=int.Parse(row["sku_SalesCount"].ToString());
         }
         if(row["sku_Code"]!=null)
         {
             model.sku_Code=row["sku_Code"].ToString();
         }
         if(row["sku_CreatedOn"]!=null && row["sku_CreatedOn"].ToString()!="")
         {
             model.sku_CreatedOn=DateTime.Parse(row["sku_CreatedOn"].ToString());
         }
         if(row["sku_CreatedBy"]!=null && row["sku_CreatedBy"].ToString()!="")
         {
             model.sku_CreatedBy= new Guid(row["sku_CreatedBy"].ToString());
         }
         if(row["sku_ModifyOn"]!=null && row["sku_ModifyOn"].ToString()!="")
         {
             model.sku_ModifyOn=DateTime.Parse(row["sku_ModifyOn"].ToString());
         }
         if(row["sku_StatusCode"]!=null && row["sku_StatusCode"].ToString()!="")
         {
             model.sku_StatusCode=int.Parse(row["sku_StatusCode"].ToString());
         }
         if(row["sku_IsDel"]!=null && row["sku_IsDel"].ToString()!="")
         {
             if((row["sku_IsDel"].ToString()=="1")||(row["sku_IsDel"].ToString().ToLower()=="true"))
             {
                 model.sku_IsDel=true;
             }
             else
             {
                 model.sku_IsDel=false;
             }
         }
         if(row["p_Name"]!=null)
         {
             model.p_Name=row["p_Name"].ToString();
         }
         if(row["p_Sort"]!=null && row["p_Sort"].ToString()!="")
         {
             model.p_Sort=int.Parse(row["p_Sort"].ToString());
         }
         if(row["p_MeasurementUnit"]!=null)
         {
             model.p_MeasurementUnit=row["p_MeasurementUnit"].ToString();
         }
         if(row["p_Province"]!=null && row["p_Province"].ToString()!="")
         {
             model.p_Province=int.Parse(row["p_Province"].ToString());
         }
         if(row["p_City"]!=null && row["p_City"].ToString()!="")
         {
             model.p_City=int.Parse(row["p_City"].ToString());
         }
         if(row["p_County"]!=null && row["p_County"].ToString()!="")
         {
             model.p_County=int.Parse(row["p_County"].ToString());
         }
         if(row["p_CreatedOn"]!=null && row["p_CreatedOn"].ToString()!="")
         {
             model.p_CreatedOn=DateTime.Parse(row["p_CreatedOn"].ToString());
         }
         if(row["p_ModifyOn"]!=null && row["p_ModifyOn"].ToString()!="")
         {
             model.p_ModifyOn=DateTime.Parse(row["p_ModifyOn"].ToString());
         }
         if(row["p_CreatedBy"]!=null && row["p_CreatedBy"].ToString()!="")
         {
             model.p_CreatedBy= new Guid(row["p_CreatedBy"].ToString());
         }
         if(row["p_ModifyBy"]!=null && row["p_ModifyBy"].ToString()!="")
         {
             model.p_ModifyBy= new Guid(row["p_ModifyBy"].ToString());
         }
         if(row["p_StatusCode"]!=null && row["p_StatusCode"].ToString()!="")
         {
             model.p_StatusCode=int.Parse(row["p_StatusCode"].ToString());
         }
         if(row["p_IsDel"]!=null && row["p_IsDel"].ToString()!="")
         {
             if((row["p_IsDel"].ToString()=="1")||(row["p_IsDel"].ToString().ToLower()=="true"))
             {
                 model.p_IsDel=true;
             }
             else
             {
                 model.p_IsDel=false;
             }
         }
         if(row["p_SellStatus"]!=null && row["p_SellStatus"].ToString()!="")
         {
             model.p_SellStatus=int.Parse(row["p_SellStatus"].ToString());
         }
         if(row["ct_ID"]!=null && row["ct_ID"].ToString()!="")
         {
             model.ct_ID=int.Parse(row["ct_ID"].ToString());
         }
         if(row["pt_ID"]!=null && row["pt_ID"].ToString()!="")
         {
             model.pt_ID=int.Parse(row["pt_ID"].ToString());
         }
         if(row["m_Password"]!=null)
         {
             model.m_Password=row["m_Password"].ToString();
         }
         if(row["m_UserType"]!=null && row["m_UserType"].ToString()!="")
         {
             model.m_UserType=int.Parse(row["m_UserType"].ToString());
         }
         if(row["m_YingYZZ"]!=null)
         {
             model.m_YingYZZ=row["m_YingYZZ"].ToString();
         }
         if(row["m_Score"]!=null && row["m_Score"].ToString()!="")
         {
             model.m_Score=int.Parse(row["m_Score"].ToString());
         }
         if(row["m_Rank"]!=null && row["m_Rank"].ToString()!="")
         {
             model.m_Rank=int.Parse(row["m_Rank"].ToString());
         }
         if(row["m_Sex"]!=null && row["m_Sex"].ToString()!="")
         {
             model.m_Sex=int.Parse(row["m_Sex"].ToString());
         }
         if(row["m_Birthday"]!=null && row["m_Birthday"].ToString()!="")
         {
             model.m_Birthday=DateTime.Parse(row["m_Birthday"].ToString());
         }
         if(row["m_Phone"]!=null)
         {
             model.m_Phone=row["m_Phone"].ToString();
         }
         if(row["m_Email"]!=null)
         {
             model.m_Email=row["m_Email"].ToString();
         }
         if(row["m_QQ"]!=null)
         {
             model.m_QQ=row["m_QQ"].ToString();
         }
         if(row["m_CreatedOn"]!=null && row["m_CreatedOn"].ToString()!="")
         {
             model.m_CreatedOn=DateTime.Parse(row["m_CreatedOn"].ToString());
         }
         if(row["m_ZheK"]!=null && row["m_ZheK"].ToString()!="")
         {
             model.m_ZheK=decimal.Parse(row["m_ZheK"].ToString());
         }
         if(row["m_StatusCode"]!=null && row["m_StatusCode"].ToString()!="")
         {
             model.m_StatusCode=int.Parse(row["m_StatusCode"].ToString());
         }
         if(row["m_ShenPstatus"]!=null && row["m_ShenPstatus"].ToString()!="")
         {
             model.m_ShenPstatus=int.Parse(row["m_ShenPstatus"].ToString());
         }
         if(row["pc_ID"]!=null && row["pc_ID"].ToString()!="")
         {
             model.pc_ID=int.Parse(row["pc_ID"].ToString());
         }
         if(row["sku_ID"]!=null && row["sku_ID"].ToString()!="")
         {
             model.sku_ID=int.Parse(row["sku_ID"].ToString());
         }
         if(row["pc_CreatedOn"]!=null && row["pc_CreatedOn"].ToString()!="")
         {
             model.pc_CreatedOn=DateTime.Parse(row["pc_CreatedOn"].ToString());
         }
         if(row["pc_Type"]!=null)
         {
             model.pc_Type=row["pc_Type"].ToString();
         }
         if(row["pc_Content"]!=null)
         {
             model.pc_Content=row["pc_Content"].ToString();
         }
         if(row["pc_CreatedBy"]!=null && row["pc_CreatedBy"].ToString()!="")
         {
             model.pc_CreatedBy=int.Parse(row["pc_CreatedBy"].ToString());
         }
         if(row["pc_StatusCode"]!=null && row["pc_StatusCode"].ToString()!="")
         {
             model.pc_StatusCode=int.Parse(row["pc_StatusCode"].ToString());
         }
         if (row["pc_huifu"] != null && row["pc_huifu"].ToString() != "")
         {
             model.pc_huifu = int.Parse(row["pc_huifu"].ToString());
         }
         if(row["pc_IsDel"]!=null && row["pc_IsDel"].ToString()!="")
         {
             if((row["pc_IsDel"].ToString()=="1")||(row["pc_IsDel"].ToString().ToLower()=="true"))
             {
                 model.pc_IsDel=true;
             }
             else
             {
                 model.pc_IsDel=false;
             }
         }
     }
     return model;
 }