Пример #1
0
        public static DataTable toDataTable(ServiceTransfer bean)
        {
            DataTable dt = getEmptyTable();      //new DataTable(tableName);

            #region 添加表列
            //可以省事,查询下数据库就有了
            #endregion

            DataRow row = dt.NewRow();
            #region 给表添加一行
            //此处添加的列名称,全大写
            row["TransferId"]          = bean.TransferId;
            row["CompanyId"]           = bean.CompanyId;
            row["WarehouseIdFrom"]     = bean.WarehouseIdFrom;
            row["WarehouseIdTo"]       = bean.WarehouseIdTo;
            row["CreateUser"]          = bean.CreateUser;
            row["CreateDate"]          = bean.CreateDate;
            row["PickUser"]            = bean.PickUser;
            row["ConfirmOutboundUser"] = bean.ConfirmOutboundUser;
            row["ConfirmOutboundTime"] = bean.ConfirmOutboundTime;
            row["TransitCompanyId"]    = bean.TransitCompanyId;
            row["ConfirmInboundUser"]  = bean.ConfirmInboundUser;
            row["ConfirmInboundTime"]  = bean.ConfirmInboundTime;
            row["ConfirmLocationUser"] = bean.ConfirmLocationUser;
            row["CommentOfClient"]     = bean.CommentOfClient;
            row["CommentOfWarehouse"]  = bean.CommentOfWarehouse;
            row["Disabled"]            = bean.Disabled;
            row["TimeId"] = bean.TimeId;
            #endregion

            return(dt);
        }
Пример #2
0
        public static int insert(ServiceTransfer bean)
        {
            DataTable dt = toDataTable(bean);

            return(insert(dt));
        }
Пример #3
0
        /// <summary>
        /// 按表更新
        /// </summary>
        /// <param name="bean"></param>
        /// <returns></returns>
        public static int update(ServiceTransfer bean)
        {
            DataTable dt = toDataTable(bean);

            return(update(dt));
        }
Пример #4
0
        public static ServiceTransfer toClassBean(DataRow row)
        {
            ServiceTransfer bean = new ServiceTransfer();      //new DataTable(tableName);

            #region 给表添加一行

            if (row.Table.Columns.IndexOf("TransferId") > -1)
            {
                bean.TransferId = Convert.ToInt32(row["TransferId"]);
            }
            if (row.Table.Columns.IndexOf("CompanyId") > -1)
            {
                bean.CompanyId = Convert.ToInt32(row["CompanyId"]);
            }
            if (row.Table.Columns.IndexOf("WarehouseIdFrom") > -1)
            {
                bean.WarehouseIdFrom = Convert.ToInt32(row["WarehouseIdFrom"]);
            }
            if (row.Table.Columns.IndexOf("WarehouseIdTo") > -1)
            {
                bean.WarehouseIdTo = Convert.ToInt32(row["WarehouseIdTo"]);
            }
            if (row.Table.Columns.IndexOf("CreateUser") > -1)
            {
                bean.CreateUser = row["CreateUser"].ToString();;
            }
            if (row.Table.Columns.IndexOf("CreateDate") > -1)
            {
                bean.CreateDate = Convert.ToInt32(row["CreateDate"]);
            }
            if (row.Table.Columns.IndexOf("PickUser") > -1)
            {
                bean.PickUser = row["PickUser"].ToString();;
            }
            if (row.Table.Columns.IndexOf("ConfirmOutboundUser") > -1)
            {
                bean.ConfirmOutboundUser = row["ConfirmOutboundUser"].ToString();;
            }
            if (row.Table.Columns.IndexOf("ConfirmOutboundTime") > -1)
            {
                bean.ConfirmOutboundTime = Convert.ToInt32(row["ConfirmOutboundTime"]);
            }
            if (row.Table.Columns.IndexOf("TransitCompanyId") > -1)
            {
                bean.TransitCompanyId = Convert.ToInt32(row["TransitCompanyId"]);
            }
            if (row.Table.Columns.IndexOf("ConfirmInboundUser") > -1)
            {
                bean.ConfirmInboundUser = row["ConfirmInboundUser"].ToString();;
            }
            if (row.Table.Columns.IndexOf("ConfirmInboundTime") > -1)
            {
                bean.ConfirmInboundTime = Convert.ToInt32(row["ConfirmInboundTime"]);
            }
            if (row.Table.Columns.IndexOf("ConfirmLocationUser") > -1)
            {
                bean.ConfirmLocationUser = row["ConfirmLocationUser"].ToString();;
            }
            if (row.Table.Columns.IndexOf("CommentOfClient") > -1)
            {
                bean.CommentOfClient = row["CommentOfClient"].ToString();;
            }
            if (row.Table.Columns.IndexOf("CommentOfWarehouse") > -1)
            {
                bean.CommentOfWarehouse = row["CommentOfWarehouse"].ToString();;
            }
            if (row.Table.Columns.IndexOf("Disabled") > -1)
            {
                bean.Disabled = Convert.ToInt32(row["Disabled"]);
            }
            if (row.Table.Columns.IndexOf("TimeId") > -1)
            {
                bean.TimeId = Convert.ToInt32(row["TimeId"]);
            }

            //if (row.Table.Columns.IndexOf("ColName") > -1)
            //{
            //    bean.ColName = row["ColName"];
            //}
            #endregion

            return(bean);
        }