Esempio n. 1
0
        public int InsertWorkShift2WorkShop(WorkShift2WorkShop obj)
        {
            string     sql = @"INSERT INTO[BE_WorkShift2WorkShop]([WorkShiftID]
				, [WorkShopID]
				) VALUES(@WorkShiftID
				, @WorkShopID
				)"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pWorkShiftID = new SqlParameter("WorkShiftID", Convert2DBnull(obj.WorkShiftID));

            pWorkShiftID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pWorkShiftID);

            SqlParameter pWorkShopID = new SqlParameter("WorkShopID", Convert2DBnull(obj.WorkShopID));

            pWorkShopID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pWorkShopID);

            return(cmd.ExecuteNonQuery());
        }
Esempio n. 2
0
        public List <WorkShift2WorkShop> LoadWorkShift2WorkShopsByWorkShopID(Guid workShopID)
        {
            string     sql = @"SELECT [WorkShiftID]
				, [WorkShopID]
				 FROM [BE_WorkShift2WorkShop] WHERE [WorkShopID]=@WorkShopID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pWorkShopID = new SqlParameter("WorkShopID", workShopID);

            pWorkShopID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pWorkShopID);

            List <WorkShift2WorkShop> ret = new List <WorkShift2WorkShop>();
            SqlDataReader             dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    WorkShift2WorkShop iret = new WorkShift2WorkShop();
                    if (!Convert.IsDBNull(dr["WorkShiftID"]))
                    {
                        iret.WorkShiftID = (Guid)dr["WorkShiftID"];
                    }
                    if (!Convert.IsDBNull(dr["WorkShopID"]))
                    {
                        iret.WorkShopID = (Guid)dr["WorkShopID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }